Ask Your Question

How to simulate a simple light sensor in Gazebo?

asked 2011-06-06 05:00:20 -0500

updated 2014-01-28 17:09:48 -0500

ngrennan gravatar image

What is the best way to simulate a simple Lego NXT light sensor in Gazebo? Is there already some existing photodetector Gazebo plugin? If not, what rough steps would you propose?

edit retag flag offensive close delete

3 answers

Sort by » oldest newest most voted

answered 2011-06-06 05:11:26 -0500

I don't know if this is overkill, or if there is something simpler, but I'd modify the camera sensor code, and either adjust it to a single pixel, or do averaging over many, and publish intensity instead of an image.

edit flag offensive delete publish link more

answered 2011-06-08 05:17:36 -0500

nkoenig gravatar image

Using a modified camera is definitely a good idea. You should look at the specification of your light sensor, and determine how it behaves in the real world (sensitivity, range, field-of-view, etc).

I would then right a simple shader to attach to the camera (look at the StereoCamera for an example). The shader should fill a texture with light intensity. Right now the StereoCamera has a shader that fills a texture with depth data. You can use this as a starting point, and google should tell you how to compute light intensity in GLSL.

If the above seems overkill, or too much work. Then you can write a sensor that just iterates over all the lights in the world, and computes distance to the sensor. This will have some drawbacks: occlusions and reflections are problematic.

edit flag offensive delete publish link more

answered 2013-01-18 05:26:07 -0500

Giacomo gravatar image

When Gazebo renders the scene theoretically it should calculate the color (and thus the brightness) of each point in the scene. Is there a way to access the parameters of the Gazebo main camera to retrieve the light intensity?

edit flag offensive delete publish link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]


Asked: 2011-06-06 05:00:20 -0500

Seen: 393 times

Last updated: Jan 18 '13