Reusing a State Machine

Hi all,

I’m trying to model a mobile robot system that will be used to transport materials inside a factory. I’m trying to model it’s working cycle in System Analysis with some MSM but I’m finding some trouble to do so and I can’t find much information on this online.

First of all, let me explain how the system is supposed to work in a very simple way:
There are 3 main locations in the factory:

  • Base: This is the base location for the robot in the factory. This is where it should “sleep” when not being used and where it could get charged.
  • Warehouse: The warehouse is where the robot is loaded with materials
  • Production Station: Represents the production station that requires the materials (unloads the robot)

The basic working cycle is:

  1. Start at Base
  2. when command received, go to warehouse
  3. Once loaded with materials, go to the production station
  4. Once onloaded, go to base
  5. Repeat.

I could do a simple State-Machine for this case but I think that all the “go to” states should have some common properties and substates: they all share a common ‘motion’ state that enables the trajectory planners, motion controllers, obstacle detection and avoidance, motion sensors, etc.

I don’t think I should replicate in each of them these substates but rather have another MSM that represent a generic “transit” which starts at a generic “calculating trajectory” state and once the trajectory is calculated (will have different goal for each case) transitions to a “motion” state that enables all the previous substates I mentioned. This MSM is finished when goal is reached (different for each case). I think this approach would be better to allow custom goal-locations (like different production stations) and not having to define every single one by hand at this level.

Here below is a screenshot of what I could do that barely works for me. I don’t really like it but I cannot find a better way to handle situations like these because I can’t find a way to add parameters to a specific state or transition and I can’t also reference another MSM or even states from a different region. So here, in each of the “GoTo [Location]” states, I make a fork that also activates the “in transit” state and transitions to “At [Location]” when the Goal is Reached.


What do you think of this approach ? Could you suggest something clearer ? If I needed to reuse the ‘in transit’ state for another situations, how should I proceed? Different MSM? Adding lots of analogous conditions in this one?

Any tip is highly appreciated.

Regards
Guillermo