Ask Your Question

Revision history [back]

MoveGroupCommander unable to connect

Hallo,

So, my setup is based on:

  • http://docs.ros.org/indigo/api/moveit_tutorials/html/doc/pr2_tutorials/planning/scripts/doc/move_group_python_interface_tutorial.html
  • and on package, which I generated with the moveit wizard.

The wizard gives me a demo.launch file, which is okay, I can run it. But as soon as I run my node, based on the code above on a different namespace with a launch file I am getting this error:

RuntimeError: Unable to connect to move_group action server 'move_group' within allotted time (5s).

Starting my node in the launch file looks like this:

<launch> <arg name="robot_name" default="move_it_robot"/>

<node ns="$(arg robot_name)" pkg="rosweld_drivers" name="move_it_robot" type="moveit.sh" output="screen" >
    <param name="robot_name" value="$(arg robot_name)"/>
</node>

</launch>

My python file:

name = rospy.get_param("robot_name", "move_it_robot")
rospy.init_node(name, anonymous=True)

try:
    rospy.wait_for_service('/move_group/load_map', 1)
except ROSException:
    rospy.logerr("Please start MoveIt first")
    rospy.wait_for_service('/move_group/load_map')

moveit_commander.roscpp_initialize(sys.argv)
moveit_commander.RobotCommander()
moveit_commander.PlanningSceneInterface()
global group
group_name = rospy.get_param("move_group_name", "welding")
group = moveit_commander.MoveGroupCommander(group_name)

What am I missing here?

Please note: I can run my node on the global namespace (removing ns from the launch file), then it is working fine, but moving it to a specified namespace makes it crash.

Thanks in advance!