Creating custom sensors

We create a plugin for a sensor only when no sensor plugin is available that satisfies our requirements. In this subsection, we will describe how one would conceptually proceed with developing a wind sensor. A wind sensor usually measures the airspeed on a robot. This airspeed is the difference between the wind speed wind and the current velocity of the robot:

=

To integrate this sensor into the simulation, we can follow the procedure for creating a Model-Plugin, as described at http://gazebosim.org/tutorials?tut=plugins_model&cat=write_plugin.

We will create a subscriber to the wind topic, and store the pointer to the link, which the plugin gets attached to. Additionally, we will create a publisher on the desired topic, for example air_speed. All of this can be implemented in the Load method of the plugins. In the OnUpdate method, which gets called at every single simulation iteration, we are getting the link's velocity in world frame by calling GetWorldLinearVel():

link_− >GetWorldLinearVel() 

And perform the calculation described previously, in the equation. We can also add some additional noise to the the calculated value. Moreover, we can refer the GazeboImuPlugin and the GazeboOdometryPlugin to get an idea of how to add noise to our calculated value.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.158.184