Gazebo | Ignition | Community
Ask Your Question

How to get laser data from gazebo?

asked 2017-05-19 05:09:20 -0500

lory18 gravatar image

updated 2017-05-19 08:52:32 -0500

sloretz gravatar image

I have modeled a robot with a laser sensor. Whenever it sees anything it range I want to set some force to a joint. I don't understand how to get the laser data via gazebo.

Any help will be appreciated

edit retag flag offensive close merge delete


What version of gazebo are you using?

sloretz gravatar imagesloretz ( 2017-05-19 14:55:25 -0500 )edit

i'm using gazebo ver 7

lory18 gravatar imagelory18 ( 2017-05-19 16:24:25 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-05-22 09:31:19 -0500

sloretz gravatar image

There are a couple ways to get the laser data. These work for both the Gpu based ray sensor and CPU based ray sensor, but I'll assume the former. If you're using the CPU based sensor just remove Gpu from everything.


The laser data topic uses publishes a protobuf message every time the sensor makes a measurement. The message definition is LaserScanStamped which is a time stamped LaserScan message. You can see how it gets populated here.

This tutorial shows how you implement a plugin. You'll want to implementing a sensor plugin and inherit from GpuRayPlugin. Specifically your code will go in OnNewLaserFrame

edit flag offensive delete link more


Thanks for the answer, i was missing the part of extrapolating data from msgs, after reading the code it's more clear!

lory18 gravatar imagelory18 ( 2017-05-22 13:31:59 -0500 )edit
Login/Signup to Answer

Question Tools



Asked: 2017-05-19 05:09:20 -0500

Seen: 4,457 times

Last updated: May 22 '17