ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Not getting laser scan runing libgazebo_ros_gpu_laser plugin

asked 2019-06-23 01:11:11 -0500

logan.ydid gravatar image

updated 2019-06-23 12:35:53 -0500

Hello all,

I have been following the tutorials in the book Programming Robots with ROS and I am on the part on page 306 where we create a simulation of the robots laser scanner in gazebo. My goal is to use what I learn from the book to be able to make my own autonomous robot for school. The computer I will be using in my final robot doesn't seem to be powerful enough to run gazebo and rviz. Thus I am trying to split all the code up so that the robot computer runs all the navigation and everything that would be on the robot itself while the simulation is running on my beefier machine. i am running ROS Kinetic and Ubuntu on both

With that said the problem I am running into is that when I run the simulation I can't see any data from the laser scanner in rviz. To investigate, I ran rostopic echo /scan and this is what I got back

  seq: 7178
    secs: 180
    nsecs: 212000000
  frame_id: "hokuyo_link"
angle_min: -1.57079994678
angle_max: 1.57079994678
angle_increment: 0.00436940183863
time_increment: 0.0
scan_time: 0.0
range_min: 0.10000000149
range_max: 30.0
ranges: [-inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf ...
edit retag flag offensive close merge delete


Did you ever get it to work? What computer and GPU were you running it on?

tropic gravatar image tropic  ( 2020-10-15 16:52:29 -0500 )edit

3 Answers

Sort by » oldest newest most voted

answered 2019-06-23 23:10:30 -0500

cassini.huygens gravatar image

If I understand you well you are trying to see the output of your 2D laser scan. Is your world empty? if so there is not object to reflect back the laser points therefore your laser /scan message will include nothing but infinity distance measured by the laser (there is no object to return back any laser points). Also as a good rule of thumb, when you visualize it in rviz make sure you are on the right tf tree. (i.e. base_link)

edit flag offensive delete link more


thank you for your reply! the tutorial says to start in an empty world and place items in front of the robot to see the laser lines in RViz. i also tried placing the robot in the willowGarage example world (commented in my code). in both instances the output from rostopic was as seen above. what do you meen by make sure youre on the right tf tree?

logan.ydid gravatar image logan.ydid  ( 2019-06-25 21:03:18 -0500 )edit

Display->Global Option->Fixed Frame: make sure in this section in rviz, you are on your base_link frame of your robot. What's your rosrun rqt_tf_tree rqt_tf_tree? so you can see all inf being printed at your terminal when your rostopic echo the laser topic?

cassini.huygens gravatar image cassini.huygens  ( 2019-06-26 16:44:13 -0500 )edit

My rviz configuration is as you said. I ran tf_ tree (see image here) the hokuyo_link is coming off of the base_link but I notice there are 0 transforms. What does this mean? And yes no matter what I do to the robot in gazebo I show all inf in rostopic.

logan.ydid gravatar image logan.ydid  ( 2019-06-26 19:41:26 -0500 )edit

answered 2021-02-07 00:32:25 -0500

I run into the same problem when following examples in the book. Then finally figure out you have to take out the 'gpu_' reference and use non-gpu version of the library if your computer does not have GPU, and to change the parameter 'visualize' to true (don't know why it was set to false in the first place). Then you can see the laser beams working in Gazebo and visualize them in rviz.

edit flag offensive delete link more

answered 2022-04-30 11:57:53 -0500

DrPhoenix gravatar image

Hello, I encoutered the same kind of unusual behaviour with my ydlidar. After few days of intense research I understood that my graphic card was not using (I was using the integrated Intel one). Using Ubuntu Software and Update > Additional Drivers I forced the use of my graphic card with proprietary drivers (not xserver open source ones) and it worked perfectly fine. Hope it helps someone :)

edit flag offensive delete link more

Question Tools



Asked: 2019-06-23 01:11:11 -0500

Seen: 1,250 times

Last updated: Jun 23 '19