Setting Up Your Robot’s Model

One of the features of the Robot Customizer ROS package is automatically adding models of sensors onto your robot’s model.

To use this feature, you will need to build your robot’s model, include the Robot Customizer ROS package’s sensor models in your robot’s model, and broadcast your robot’s updated model in ROS.

URDF

  1. Create a .urdf.xacro file that describes your robot’s model.

Note

A .urdf.xacro file serves the same purpose as a regular .urdf file; that is, describing a robot’s model through URDF. However, a .urdf.xacro file also enables the usage of xacro macros.

Note

If you are unfamiliar with what URDF is, how URDF works, and/or how to use xacro to improve a .urdf file, check out this tutorial on the ROS Wiki.

For the purpose of this tutorial, we will be using the example generic_robot.urdf.xacro file which can be found here. Upon closer inspection, you will notice that this file simply creates the links and joints for a generic robot. This file also leverages xacro to reuse properties, create macros, and most importantly, include other .urdf.xacro files!

  1. Scroll to the bottom of the example generic_robot.urdf.xacro file and notice the following line responsible for including the Robot Customizer ROS package’s sensor models:

<xacro:include filename="$(find cpr_robot_customizer)/urdf/accessories.urdf.xacro" />
  1. Add the line in step 2. to the bottom of your robot’s .urdf.xacro file.

Launch

  1. Create a .launch file that loads your robot’s .urdf.xacro file into the robot_description parameter, and launches robot_state_publisher to broadcast your robot’s tf transforms to ROS. If your robot has any non-fixed joints (e.g. wheels), your .launch file will also need to launch the joint_state_publisher to broadcast your robot’s joints information.

Note

If you are unfamiliar with using robot_state_publisher to broadcast a robot’s model from a .launch file, check out this tutorial on the ROS Wiki.

For the purpose of this tutorial, we will be using the example description.launch file which can be found here. Upon closer inspection, you will notice that this file simply loads the generic_robot.urdf.xacro file into the robot_description parameter, and launches both robot_state_publisher and joint_state_publisher.

  1. Scroll to the bottom of the example description.launch file and notice the following line responsible for including the Robot Customizer ROS package’s sensor driver launch files:

<include file="$(find cpr_robot_customizer)/launch/accessories.launch"/>
  1. DO NOT add the line in step 2. to the bottom of your robot’s .launch file yet! Please continue to the next section to learn how to include the sensors’ drivers launch files to your robot.