Gazebo | Ignition | Community
Ask Your Question

What does the sensor tag do?

asked 2018-11-02 07:58:01 -0600

kumpakri gravatar image

updated 2018-11-02 09:54:18 -0600

I understand a link tag adds a block of matter into the simulation. The joint tag adds a connection between the two links. But what does the sensor tag actually do?

When look at this chunk of code for example

<sensor name='contact_sensor' type='contact'>
    <plugin name="gazebo_ros_bumper_controller" filename="">

This sensor loads a plugin. This plugin has a bumperTopicName tag with the same topic name as the sensor tag has in its contacts/topic tag. I can look into the plugin's source code and see what it does with it's tags. But I have no idea what happens with the information inside the sensor tag.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-11-02 12:12:54 -0600

chapulina gravatar image

updated 2018-11-02 17:19:33 -0600

The <sensor> tag adds a sensor to the link, which usually publishes the sensor readings to a Gazebo Transport topic.

According to the configurations of your contact sensor, it will publish messages to the /gazebo/caster_bumper Gazebo topic whenever the link's caster_link_collision touches something. That's the sensor's basic functionality and it will work even if you remove the <plugin> tag.

Adding a plugin to a sensor lets the user extend the sensor's functionality directly in the C++ code. The referenced plugin library will be loaded together with the sensor and can tie callbacks to specific simulation events.

The functionality of plugin in your example is to publish ROS messages with the sensor readings. So the sensor on your example is _publishing to 2 different transport systems: Gazebo's and ROS_. The parameters inside the plugin tag only affect the plugin - in this case, they're setting the TF frame name for the readings, and the ROS topic name.


Source code:

edit flag offensive delete link more


So is there a source code of the sensor available?

kumpakri gravatar imagekumpakri ( 2018-11-02 16:57:55 -0600 )edit

updated the answer with links to the source code

chapulina gravatar imagechapulina ( 2018-11-02 17:19:53 -0600 )edit

Question Tools

1 follower


Asked: 2018-11-02 07:58:01 -0600

Seen: 1,212 times

Last updated: Nov 02 '18