How to modify gazebo sensors
Hello,
I would like to modify the behaviour of a gazebo sensor, in particular wireless sensor. The headers are in:
/usr/include/gazebo-5.1/gazebo/sensors
in particular, I would like to change the code of WirelessTransmitter. This folder only includes the .hh files, for example WirelessTransmitter.hh.
I downloaded from osrf (https://bitbucket.org/osrf/gazebo/downloads, default brach ) the code of all the sensors but I do not how to recompile only the sensor that I am interested in.
Any suggestions?
Best regards,
Teresa
Asked by tseco on 2016-03-30 07:50:21 UTC
Answers
Some suggestions:
Follow http://gazebosim.org/tutorials?tut=contact_sensor (I tried this out for gazebo 5.0 in https://github.com/lucasw/gazebo_contact_tutorial), make sure it works for that example sensor, then swap in the WirelessTransmitter code.
Or find the source code to someone else's standalone gazebo sensor repository, make sure you can build it unchanged first, then swap in WirelessTransmitter code. (If you find one of these, or end up making one yourself, post a link to it here)
Or comment out all the sensors you aren't using from the gazebo repo sensor CMakeLists.txt file, and maybe entire other chunks of gazebo not needed for building just the one sensor, and then make your changes.
Or run the gazebo cmake verbosely in a clean build dir and save all output, then inspect the output for the build commands that involve WirelessTransmitter, and reverse engineer your own standalone cmake from that. This is painful.
Asked by Lucas Walter on 2016-03-30 13:16:05 UTC
Comments
Thank you for your suggestions.
Follow http://gazebosim.org/tutorials?tut=co..., make sure it works for that example sensor, then swap in the WirelessTransmitter code.
It is difficult to do that beacuse the WirelessTransmitter class inherits of Sensor class and this class includes another ones, so there are a lot of dependencies.
Or find the source code to someone else's standalone gazebo sensor repository, make sure you can build it unchanged first, then swap in WirelessTransmitter code. (If you find one of these, or end up making one yourself, post a link to it here)
I did not find any standalone gazebo sensor repository. I think it would be the best option.
Or comment out all the sensors you aren't using from the gazebo repo sensor CMakeLists.txt file, and maybe entire other chunks of gazebo not needed for building just the one sensor, and then make your changes.
Or run the gazebo cmake verbosely in a clean build dir and save all output, then inspect the output for the build commands that involve WirelessTransmitter, and reverse engineer your own standalone cmake from that. This is painful.
I agree with you, it could be very painful.
I downloaded gazebo from osfr and built it from sources using a workspace (following this tutorial http://gazebosim.org/tutorials?tut=install_from_source&cat=install) and after several build errors that I had to fix manualy, I got it. The purpose of doing this is to have all the code available to do any change. The problem now is how to use ROS with the installed gazebo in the workspace. Moreover, I am working with Indigo and the gazebo in the workspace is the last version (Gazebo7), so I supponse I have to work with different gazebo_ros_pkg.
Has anyone worked like that?
Thanks in advance
Asked by tseco on 2016-03-31 11:14:55 UTC
Comments
The contact sensor example also inherits from Sensor
, and any sensor would have to- so starting with that example and swapping in WirelessTransmitter should be your best route, and a lot less work than overriding the installed gazebo with a custom one. If you encounter issues with building the example start a new question here.
Asked by Lucas Walter on 2016-03-31 15:08:20 UTC
Comments