Ask Your Question

Problem using a lidar sensor in gazebo

asked 2016-07-27 09:49:26 -0600

patrchri gravatar image


I am new to ROS and I am using ROS Kinetic. So far I have found a URDF code for a hokuyo laser sensor, which I would like to use for simulations and I have put it on my robot:

 <link name="hokuyo_link">
      <origin xyz="0 0 0" rpy="0 0 0"/>
        <box size="0.15 0.15 0.15"/>

      <origin xyz="0 0 0" rpy="0 0 0"/>
        <mesh filename="package://labrob_description/meshes/hokuyo.dae"/>

      <mass value="1e-5" />
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" />

  <property name="hokuyo_link" value="0.15" />
  <joint name="hokuyo_joint" type="fixed">
    <axis xyz="0 1 0" />
    <origin xyz="0.425 0 0.15" rpy="0 0 0"/>
    <parent link="base_link"/>
    <child link="hokuyo_link"/>

  <!-- hokuyo -->
  <gazebo reference="hokuyo_link">
    <sensor type="gpu_ray" name="head_hokuyo_sensor">
      <pose>0 0 0 0 0 0</pose>
          <!-- Noise parameters based on published spec for Hokuyo laser
               achieving "+-30mm" accuracy at range < 10m.  A mean of 0.0m and
               stddev of 0.01m will put 99.7% of samples within 0.03m of the true
               reading. -->
      <plugin name="gazebo_ros_head_hokuyo_controller" filename="">

I can successfully roslaunch the robot with the sensor in gazebo and see that the /labrob/laser/scan topic is being used from the sensor. I have tried adding objects really close to the sensor (tables for example), but I get the same data as when the sensor is in an empty world. The data which are being published on the topic are the following:

  seq: 37775
    secs: 1156
    nsecs: 736000000
  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 ...
edit retag flag offensive close merge delete



You can set the visualize tag to true in order to see your laserscan in Gazebo's GUI. If laser impacts don't stop on obstacle maybe you could try the laser plugin which is not using gpu ->

F.Brosseau gravatar imageF.Brosseau ( 2016-07-28 01:39:18 -0600 )edit

Thank you, it worked...Could you please tell me the difference between the gpu_ray and ray?

patrchri gravatar imagepatrchri ( 2016-07-28 09:31:39 -0600 )edit

The gpu_ray will use your graphic card but the other will not (I don't know about the details, maybe you will have more answer about that on the gazebo version of this site).

F.Brosseau gravatar imageF.Brosseau ( 2016-07-28 09:40:55 -0600 )edit

Ok, thanks a lot !!

patrchri gravatar imagepatrchri ( 2016-07-28 10:07:42 -0600 )edit

I have added the same code to my urdf. It gives inf when there is no obstacle. But as soon as the object detects an obstacle, simulation crashes, giving a Segmentation Fault (core dumped). Could someone help me?

viswa_1211 gravatar imageviswa_1211 ( 2019-03-04 00:54:34 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-08-15 18:24:43 -0600

patrchri gravatar image

updated 2016-08-15 18:25:02 -0600

The answer/comment from F.Brosseau was really helpful and I fixed the issue.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools



Asked: 2016-07-27 09:49:26 -0600

Seen: 1,506 times

Last updated: Aug 15 '16