MoveGroupCommander unable to connect

asked 2019-01-16 04:14:21 -0500

balint.tahi gravatar image

Hallo,

So, my setup is based on:

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!

edit retag flag offensive close merge delete

Comments

UPDATE: if the demo.launch and my node is started on the same namespace, it is working. Why isn't it working with different namespaces? Where can I set the namespace of the RobotController / MoveIt commander / whatever?

balint.tahi gravatar image balint.tahi  ( 2019-01-16 08:53:37 -0500 )edit