Implement failure for mobile robots (AGVs)

Hi all,
I modelled a custom mobile robot using the standard mobile robot and exchanging the geometry. Now I’d like to implement failures for this resource using Mean-Time-Between-Failure (MTBF) and Mean-Time-To-Repair (MTTR).

My approach:

  1. Add a new State “Broken”
  2. Add a new class “FailureManager” with attribute mtbf, mttr
  3. onSimulationUpdate() the failure manager checks if the sim time is greater than mtbf than a failure should occurr for the period of mttr. The state changes to “Broken” for that time.(same mechanism as for the power manager)
  4. After that the state is set to the previous state

So far everything is working as the states are set correctly. My problem is that the mobile robot doesn’t stop its current action (e.g. moving, picking etc.). I already checked if I could use comp.stopMovement() or suspendRun(), but it doesn’t work. I feel like I need to clear the actions from the ActionManager and then implement a action for failure, but I struggle to make it work.

My question: How can I implement to interrupt the current action for a certain time and then resume with the previous task?

Thanks in advance for your help!