Home | Tutorials | Wiki | Issues
Ask Your Question
1

How to modify gazebo sensors

asked 2016-03-30 07:50:21 -0600

tseco gravatar image

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/dow..., 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

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-03-30 13:16:05 -0600

updated 2016-04-02 07:47:22 -0600

Some suggestions:

Follow http://gazebosim.org/tutorials?tut=co... (I tried this out for gazebo 5.0 in https://github.com/lucasw/gazebo_cont...), 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.

edit flag offensive delete link more
0

answered 2016-03-31 11:14:55 -0600

tseco gravatar image

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=in...) 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

edit flag offensive delete link more

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.

Lucas Walter gravatar imageLucas Walter ( 2016-03-31 15:08:20 -0600 )edit
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2016-03-30 07:50:21 -0600

Seen: 287 times

Last updated: Apr 02 '16