Action Server (Move Base Flex) not working in SMACH state machine: Still waiting for action server '/move_base_flex/get_path' to start… is it running?
I'm trying to implement a state machine (SMACH) that uses Move Base Flex following this tutorial.
Therefore, my state machine (which would be too complex to show completely here) proceed as follows:
1. State: launches all required launch-files that are necessary including the move base flex - launchfile using subprocess:
...
try:
log4 = open('/home/faps/catkin_ws/src/pathplanning/state_machine/logs/move_base_flex_log.txt', 'w')
process4 = subprocess.Popen('roslaunch joggingblinde_2dnav move_base_flex.launch',
stdout=log4, stderr=subprocess.STDOUT,
shell=True, preexec_fn=os.setsid)
except Exception:
f = open("/home/faps/catkin_ws/src/pathplanning/state_machine/logs/main_log.txt", "a")
f.write('state: ' + 'launch_service_nodes' + '; error: ' + 'Error in move_base_flex-node.\n')
f.close()
os.killpg(os.getpgid(process4.pid), signal.SIGTERM)
userdata.in_termination_cause[0] = 'error'
return 'aborted'
...
with the launch-file looking as follows:
<launch>
<!-- Move Base Flex -->
<master auto="start"/>
<node pkg="mbf_costmap_nav" type="mbf_costmap_nav" respawn="false" name="move_base_flex" output="screen">
<param name="tf_timeout" value="1.5"/>
<param name="planner_max_retries" value="3"/>
<rosparam file="$(find joggingblinde_2dnav)/config/planners.yaml" command="load" />
<rosparam file="$(find joggingblinde_2dnav)/config/costmap_common_params.yaml" command="load" ns="global_costmap"/>
<rosparam file="$(find joggingblinde_2dnav)/config/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find joggingblinde_2dnav)/config/global_costmap_params.yaml" command="load" />
<rosparam file="$(find joggingblinde_2dnav)/config/local_costmap_params.yaml" command="load" />
</node>
</launch>
2. State: computing new goalpoint and writing the resulting goalpoint into the corresponding userdata-variable. (I've tested this one: the goalpoint exists after this state, so it's not empty.)
3. State: calling the get_path action of move base flex like described in the linked tutorial above:
smach.StateMachine.add('GET_GLOBAL_PATH_IN_GOAL_CHECK_SM',
smach_ros.SimpleActionState(
'/move_base_flex/get_path',
GetPathAction,
goal_slots=['target_pose'],
result_slots=['path']
),
transitions={
'succeeded': 'FEEDBACK_IN_GOAL_CHECK_SM',
'aborted': 'SECURE_STATE_IN_GOAL_CHECK_SM',
'preempted': 'preempted'
},
remapping={
'target_pose': 'test_goal'
}
)
When running the state machine, everything works fine until state 3 is called which throws a warning:
'Still waiting for action server '/move_base_flex/get_path' to start... is it running?'
And after terminating the program using Ctrl+C, another error appears:
'Action server for /move_base_flex/get_path is not running.'
Most issue threads dealing with similar errors are caused because the given namespace is wrong or because the Action Server isn't running (which apparently can be checked by rostopic list).
Using rostopic list
shows that the Action Server is running and that the namespace is correct as the following lines are do appear in the rostopic list - output:
/move_base_flex/current_goal
/move_base_flex/exe_path/cancel
/move_base_flex/exe_path/feedback
/move_base_flex/exe_path/goal
/move_base_flex/exe_path/result
/move_base_flex/exe_path/status
/move_base_flex/get_path/cancel
/move_base_flex/get_path/feedback
/move_base_flex/get_path/goal
/move_base_flex/get_path/result
/move_base_flex/get_path/status
Did I miss something? Any ideas on what could cause the error?