jrl-umi3218 / mc_rtc

mc_rtc is an interface for simulated and real robotic systems suitable for real-time control
BSD 2-Clause "Simplified" License
122 stars 36 forks source link

[FSM/Executor] Make resetting posture tasks optional #389

Closed arntanguy closed 1 year ago

arntanguy commented 1 year ago

This PR allows to skip the reset of the posture tasks before transitioning to the next state. This has been requested multiple times, and proves useful in some cases where the user does not want to keep the current posture. Example:

base: Meta
ResetPostures: false
transitions:
- [ChooseState, A, StateA, Auto]
- [ChooseState, B, StateB, Auto]
- [StateA, OK, HalfSitting, Auto]
- [StateB, OK, HalfSitting, Auto]
- [HalfSitting, OK, ChooseState, Auto]

This will set the desired posture to HalfSitting instead of keeping it to the current posture. Not that with ResetPostures: true in this example, the behaviour would be counterintuitive: the effet of the HalfSitting state is immediately canceled by the resetting of the posture tasks done by the Exectutor (as we are not awaiting for completion of the HalfSitting state).

arntanguy commented 1 year ago

However, I think the default should be reconsidered:

  1. True for the main executor
  2. False for Meta executors

Done, I agree this is a saner default. This might cause subtle issues in existing controllers as this changes the default reset behavior of all Meta states. I don't think this is a serious concern though, and we're better off with a good default for the future.

mmurooka commented 1 year ago

This might cause subtle issues in existing controllers as this changes the default reset behavior of all Meta states.

Thanks for the update. Could you elaborate a bit more on how the behavior could change?

gergondet commented 1 year ago

Thanks for the update. Could you elaborate a bit more on how the behavior could change?

Before this PR the posture task would be reset at every transition in a Meta state with no way to disable the behavior (other than removing the FSM posture tasks)

After this PR, this only happens (by default) for the main FSM and not for nested FSM. The old behavior can be re-enabled by setting ResetPostures: true in the Meta FSM

mmurooka commented 1 year ago

Thank you, I understood that the behavior does not change unless nested FSM is used.