smach_viewer returns incorrect states for smach concurrency
I am using ros_kinetic and learning the state machine implementations in ROS. I am trying to run two states in parallel, following the code provided here http://wiki.ros.org/smach/Tutorials/C... However, I am unable to visualize the states FOO and BAR. The diagram has SM_PATH, BAS, CON and the corresponding outcomes (outcome 3,4,5 and 6).
Main function definition
# Create the top level SMACH state machine
sm_top = smach.StateMachine(outcomes=['outcome6'])
sis = smach_ros.IntrospectionServer('introspection_server', sm_top, '/SM_ROOT')
sis.start()
# Open the container
with sm_top:
smach.StateMachine.add('BAS', Bas(),
transitions={'outcome3':'CON'})
sm_con = smach.Concurrence(outcomes=['outcome4','outcome5'],
default_outcome='outcome4',
outcome_map={'outcome5':
{ 'FOO':'outcome2',
'BAR':'outcome1'}})
with sm_con:
smach.Concurrence.add('FOO', Foo())
smach.Concurrence.add('BAR', Bar())
smach.StateMachine.add('CON', sm_con,
transitions={'outcome4':'CON',
'outcome5':'outcome6'})
outcome = sm_top.execute()
rospy.spin()
sis.stop()
There is an edge 'outcome4' from CON to itself and another edge 'outcome5' to 'outcome6' but FOO and BAR are missing in the graph view.
small correction: SMACH (as nice as it is/was) is just one of the implementations of the state machine pattern with ROS compatibility / integration.
It is by no means "the state machine implementation in ROS", as that would imply that it is either the only one, or the best/recommended one.
I too have been having trouble with smach viewer crashing claiming "tail inside head". It seems as the graph loop closure algorithm can not handle something in my code despite the code being good.
I suspect it has something to do with the dict inside dict of the outcome_map declaration. I had no trouble until I started working with the concurrent state.I haven't had time to experiment with this to know for sure. It is really annoying, every time I change the view depth smach viewer crashes.