Rosanswers logo


I am trying to test several robot-tool configurations. Doing that, I combined the tool urdfs (as discussed here) with the urdf of my robot.

To me it seems the only way to test that configuration with my robot is to create a moveit package for every single robot-tool configuration. I was wondering if there is a convinient way to switch beetween urdf or xacro files to be able to switch between robot models and still use only a single movit package.

Any ideas?

Thanks a lot.

Originally posted by nmelchert on ROS Answers with karma: 143 on 2018-07-20

Post score: 1


1 Answer 1


Rosanswers logo

The moveit_setup_assistant doesn't support doing that, but you can do it yourself by editing the files inside your moveit config package. Assuming the only thing that needs to change between your moveit packages is the SRDF, and you already have one SRDF for each robot-tool configuration. Then you can add "robot" and "tool" args to your planning_config.launch to look something like this:


  <arg name="robot" default="myrobot1"/>
  <arg name="tool" default="mytool1"/>

  <!-- Load universal robot description format (URDF) -->
  <param if="$(arg load_robot_description)" name="$(arg robot_description)" command="$(find xacro)/xacro --inorder $(find myrobot_description)/urdf/$(robot)_$(tool).urdf.xacro" />

  <!-- The semantic description that corresponds to the URDF -->
  <param name="$(arg robot_description)_semantic" textfile="$(find myrobot_moveit_config)/config/$(robot)_$(tool).srdf" />


... and then of course you need to edit the launch files that include planning_context.launch and pass through the robot and tool args. If you do a diff between your current "robot+tool" moveit configs and find things that are different between them other than the SRDF, you need to make them parametrizable as well, perhaps doing something like this in the launch files:

<include if="$(eval robot == 'myrobot1')" [...] />

Originally posted by Martin Günther with karma: 11816 on 2018-07-20

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by nmelchert on 2018-07-30:
Ok. Thanks for your answer.

Comment by bakerhillpins on 2019-06-17:
I thought I'd comment on my approach as the response helped me get to a solution. I've got a robot arm that sits on a rail system (prismatic joint). I wanted to have the ability to launch the moveit package for the Arm, or the Arm on Rail cfgs using a cmd line switch (for which the above answer was very useful). What really helped me visualize a solution to the moveit package files was the following:

  • Create a moveit package for just the Arm and check that into source control.
  • Create a 2nd separate moveit package for the Arm/Rail combination based upon the ROS-i tutorials (http://wiki.ros.org/Industrial/Tutorials) Sec 2.2
  • Copy the Arm/Rail files into the Arm only package and review the changes.

The diff tool highlighted how to merge the 2 packages - I.e Create 2 different Planning Groups (one for each cfg) and then relate things like Poses/Kinematics/etc back to those 2 groups. The .yaml files (joint limits/etc) were tolerant of missing joints in the simpler Arm only case.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.