Sensor Creation Tutorial
This tutorial describes how to make a new sensor.The contents of this page include:
Overview
Sensors in Gazebo are designed to simulate the data returned from real-world devices. One simple example is a camera sensor, which captures an image of the environment.Data is output from a sensor via a controller and interface pair. Just as a physical model may use a controller and interface to receive controll commands, a sensor can use the controller and interface to process sensor data nd publish it to libgazebo.
Sensor Creation
Sensors do not have a phyiscal representation. Instead they define how data is captured from the Gazebo environment. To create a sensor, copy the stubbed out sensor class fromgazebo/server/sensors/SensorStub.*
to your new directory. Change the name of the sensor appropriatly.Load the Sensor
Use theLoadChild
function to read any parameters from the XML configuration file. For example, the camera sensor reads the size of the image, horizontal field of view, clipping planes, and a few other miscellaneous parameters.Update the Sensor
Once every iteration theUpdateChild
function is called. Use this function to collect, process, and store all data relvant to the sensor. A controller will use this information to fill in a libgazebo interface.Both the RaySensor and CameraSensor provide good examples of how to gather different kinds of data from the Gazebo world, and make it accessible to a controller.