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¶
Create a
.urdf.xacrofile 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!
Scroll to the bottom of the example
generic_robot.urdf.xacrofile 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" />
Add the line in step 2. to the bottom of your robot’s
.urdf.xacrofile.
Launch¶
Create a
.launchfile that loads your robot’s.urdf.xacrofile into therobot_descriptionparameter, and launchesrobot_state_publisherto broadcast your robot’stftransforms to ROS. If your robot has any non-fixed joints (e.g. wheels), your.launchfile will also need to launch thejoint_state_publisherto 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.
Scroll to the bottom of the example
description.launchfile 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"/>
DO NOT add the line in step 2. to the bottom of your robot’s
.launchfile yet! Please continue to the next section to learn how to include the sensors’ drivers launch files to your robot.