Robot setup - zitongbai/ur_project_ros2 GitHub Wiki

This page provides some tips for setting up a robot in ROS2. It is not a tutorial but gives some scattered suggestions.

Use xacro to organize urdf, srdf, etc.

For example, for robot ur_robotiq_rs, we create a ur_robotiq_rs_macro.urdf.xacro to describe it. Inside this file, we put xacro macro of universal robot arm, robotiq gripper and realsense camera together to make a new robot: ur_robotiq_rs. Xacro param is used to extend the capability. ur_robotiq_rs is also defined as a xacro macro for the convenience of re-use in other xacro files.

Check your xacro file

Use xacro in terminal to check whether your xacro file is valid, for example:

xacro ur_robotiq_rs.urdf.xacro > test.urdf

Loading 3D files

Consider using:

<mesh filename="file://$(find robotiq_description)/xxx"/>

insteal of:

<mesh filename="package://robotiq_description/xxx"/>

The last way would make gazebo fail to load your urdf file 😢.

Avoid using : in xacro comment

It would cause error that is hard to find. For example: Unable to parse the value of parameter robot_description as yaml

What you need to rewrite when you put different robot together

  • controllers.yaml (used for ros2 control controller_manager or libgazebo_ros2_control.so)
  • initial_positions.yaml (used for ros2 control, it would affect the <state_interface> in <ros2_control> tag in urdf)

Multi robot setup

  • Use prefix for link and joint.
  • Add prefix to blocks like ros2_control tag
  • Use xacro property, argument, etc. to make your code clear and readable.

For some gazebo plugins

Sometimes it is better to add gazebo plugin tag in low level robot description files to make your code clear. But for some plugins like libgazebo_ros2_control.so and libgazebo_grasp_fix.so, it is better to only load them once at the top level description file, this is because:

How to import your own 3D model into gazebo

In the package.xml of your package, add the following:

  <export>
    <build_type>ament_cmake</build_type>
    <!-- gazebo_ros_paths_plugin automatically adds these to
    GAZEBO_PLUGIN_PATH and GAZEBO_MODEL_PATH when you do this export inside
    the package.xml file. You can than use URIs of type model://my_package/stuff. -->
    <!-- https://answers.gazebosim.org/question/6568/uri-paths-to-packages-in-the-sdf-model-file/ -->
    <gazebo_ros                                                                 
        gazebo_plugin_path="${prefix}/lib"
        gazebo_model_path="${prefix}/.." /> 
  </export>
⚠️ **GitHub.com Fallback** ⚠️