Python namespace ignored in MoveIt

asked 2019-03-29 22:20:37 -0600

screen33 gravatar image

My robot has its parameters (robot_description, robot_description_semantic and so on...) under the /robot/ namespace because Move Group's launchfile starts it that way: <group ns="$(arg robot_name)">.

Starting a Python script that opens a RobotCommander() thanks to a launchfile having <group ns="$(arg robot_name)"> as well works very fine.

I'm more puzzled for the case the script is not started from a launchfile, so namespace can't be specified within the launchfile. But the commander has to take into account the namespace anyway, which is normally achieved this way: moveit_commander.RobotCommander(ns="robot"). However it fails, the ns parameter seems ignored here, and the commander reports there's no group with the specified name. The only way I found is to set environ["ROS_NAMESPACE"]="robot", which looks a bit overkill.

Is there any reason the ns= option does not work?

edit retag flag offensive close merge delete


The commander is a hybrid C++ & Python node that does some strange things under the hood. You might need to include the first / in your ns argument to make it an absolute name.

gvdhoorn gravatar image gvdhoorn  ( 2019-03-30 02:51:47 -0600 )edit

Indeed, the environ option was the best option in the end.

screen33 gravatar image screen33  ( 2019-05-20 17:52:37 -0600 )edit

Thanks, that worked for me too!

JunTuck gravatar image JunTuck  ( 2019-11-28 04:02:28 -0600 )edit