Gazebo | Ignition | Community
Ask Your Question

get data from sensor

asked 2015-02-26 06:04:54 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hello Dear Gazebo Users, Experts

I am new to Gazebo. I am working on a project. I managed to add a laser to a robot arm in Gazebo and the sensor i used was the hokuyo sensor. I managed to add it all fine and i can see the blue field which is being emitted by the sensor. To see that everything is fine I also added some grey walls models which come from the Database of Gazebo. Now my question is how to get the sensor data, in the mean of getting the distance from the sensor to the wall (knowing how far away this particular object is). I know it has to do something with Ros, but as i said before i am really new to this.

Can anyone make a list of the things i would need to accomplish my idea.

Thanks in Advanced,

Kind Regards and greetings from Germany,


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-02-26 10:31:29 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

No need to use ROS. I'll use the worlds/ as an example. You can run thie world from the command line with:

gazebo worlds/

You have two options to get data from the sensor:

  1. Subscribe to the laser topic.

    View the list of topics from the command line with:
        `gz topic -l`
    Or from the GUI by pressing `CTRL-t`
    In this case, the topic is `/gazebo/default/pioneer2dx/hokuyo/link/laser/scan`
    You can now write a stand-alone program that subscribes to that topic in order to receive  laser data. See [this tutorial](, and [this example](
  2. Write a plugin for the sensor or model that gets the information via Gazebo's C++ API. Here is a example for a camera that you can modify for the hokuyo.

edit flag offensive delete link more


What if i have the Real UR10 Robot in the Laboratory and i connect it and want to get the data from the sensor mounted to it? Is it possible to control the UR10 Robot using Gazebo? Or is gazebo just used to simulate?

edo_raci gravatar imageedo_raci ( 2015-02-27 04:16:45 -0500 )edit

Well if you have the real robot you don't need Gazebo. You can control it via ROS and visualize the data using RViz

AndreiHaidu gravatar imageAndreiHaidu ( 2015-02-27 07:22:45 -0500 )edit

Thank you very much!

edo_raci gravatar imageedo_raci ( 2015-03-02 03:45:36 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2015-02-26 06:04:54 -0500

Seen: 3,197 times

Last updated: Feb 26 '15