|Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.|
Adding New 3D SensorDescription: Add support for a new 3D sensor to the turtlebot stack.
Keywords: turtlebot camera 3D sensor
Tutorial Level: INTERMEDIATE
Next Tutorial: Adding a lidar to the turtlebot
The goal of this tutorial is to describe the steps necessary for a developer to add support for a new 3D sensor to the turtlebot stack.
3D Sensor Driver Package
This tutorial assumes you have a 3D sensor driver package that emulates the standard ROS camera API, like openni_camera or freenect_camera. The standard pattern is to have a driver in a package named <TURTLEBOT_3D_SENSOR>_camera (e.g., astra_camera) and a launch package with runtime dependencies on this driver package named <TURTLEBOT_3D_SENSOR>_launch, which includes a launch file for bringing up the sensor with a standard layout.
There are several changes you will need to make to the turtlebot bringup package to add support.
You will need to create a launch file for your 3D sensor called <TURTLEBOT_3D_SENSOR>.launch.xml in the turtlebot_bringup/launch/includes/3dsensor/ directory. This launch file will likely include the standard bring-up launch file from your sensor's driver launch package (mentioned above). See the other existing 3D sensor launch files in this directory for examples.
In order for you to visualize your sensor on the turtlebot in rviz, you will need to add URDF files into the turtlebot description package.
Add a sensor description file called <TURTLEBOT_3D_SENSOR>.urdf.xacro in the turtlebot_description/urdf/sensors/ directory. This file should describe the location and shape of your camera, and include any visualization meshes (located in turtlebot_description/meshes/sensors/) that you wish to include. See the other existing 3D sensor URDF files for examples.
Add a top-level robot description URDF xacro file called <TURTLEBOT_BASE>_<TURTLEBOT_STACKS>_<TURTLEBOT_3D_SENSOR>.urdf.xacro in the turtlebot_description/robots/ directory. The values for these need to match the values users will set in the corresponding environment variables. Follow the examples in this directory for how to include the turtlebot_description/urdf/turtlebot_library.urdf.xacro file.
Lastly, modify the turtlebot_description/urdf/turtlebot_library.urdf.xacro file to include a link to the 3D sensor urdf.xacro file you created above.
If you intend to upstream support for this sensor, modify the turtlebot_bringup/package.xml file to include a run-time dependency on your 3D sensor's driver package.
There are several changes you will need to make to the turtlebot navigation package to add support.
In order for your sensor to perform optimally, you will need too add a costmap parameter file. See the other existing 3D sensor parameter files for examples.
Add a yaml file called <TURTLEBOT_3D_SENSOR>_costmap_params.yaml to the turtlebot_apps/turtlebot_navigation/param/ directory.
You will need to add your sensor specific launch files for gmapping and amcl. See the other existing 3D sensor launch files in this directory for examples.
Add a gmapping launch file called <TURTLEBOT_3D_SENSOR>_gmapping.launch.xml to the turtlebot_apps/turtlebot_navigation/l'aunch/includes/gmapping directory.
Add an amcl launch file called <TURTLEBOT_3D_SENSOR>_amcl.launch.xml to the turtlebot_apps/turtlebot_navigation/launch/includes/amcl directory.