smach: advice on conditional logic
I have a smach tree with "SimpleActionState"s as the leaf states. I am trying to create a good concept for conditional logic in the SMACH level. A state should check a condition and only progress to its children states, if the condition is met. It the condition is not met, the state completes as "skipped" which would translate to "succeeded", so the execution continues with other states.
The data that the condition would refer to might be stuff like
- Is motor X busy?
- Is motor X initialized?
- Is motor Y position in range [P1:P2]
Should I create ROS services where these answers can be provided, and create my own version of ConditionState that would call this service and act on the response appropriately? Or should I ensure the status data for motors are posted on the ROS parameter server, so I can test these data in a state? Or should involve the userdata in a collaboration between several states?
I can see that some of this logic is involved in ConditionState and MonitorState but not sure how far these states can take me. Also I am building the SMACH hierarchy from an xml description so I need a very generic way of describing a condition to be tested. I cannot depend on per-case customized callbacks.
This is not an answer, but I've seen you post a lot of questions about SMACH recently and wanted to make sure you are/were aware of flexbe.
Thanks, and no, I was not aware of flexbe. I have briefly looked through the flexbe introduction and I am in two minds. I am somewhat hesitant to pull in a large framework if it may be overkill. Maybe I should ask a separate question on the how flexbe will meet my requirements better than SMACH.
FlexBE essentially is SMACH, but with a GUI and a lot of convenience.