# Python namespace ignored in MoveIt

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 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.
Indeed, the environ option was the best option in the end.