Ask Your Question
0

Problem using a lidar sensor in gazebo

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

patrchri gravatar image

Hello,

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">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <box size="0.15 0.15 0.15"/>
      </geometry>
    </collision>

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

    <inertial>
      <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" />
    </inertial>
  </link>

  <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"/>
  </joint>

  <!-- hokuyo -->
  <gazebo reference="hokuyo_link">
    <sensor type="gpu_ray" name="head_hokuyo_sensor">
      <pose>0 0 0 0 0 0</pose>
      <visualize>false</visualize>
      <update_rate>40</update_rate>
      <ray>
        <scan>
          <horizontal>
            <samples>720</samples>
            <resolution>1</resolution>
            <min_angle>-1.570796</min_angle>
            <max_angle>1.570796</max_angle>
          </horizontal>
        </scan>
        <range>
          <min>0.10</min>
          <max>30.0</max>
          <resolution>0.01</resolution>
        </range>
        <noise>
          <type>gaussian</type>
          <!-- 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. -->
          <mean>0.0</mean>
          <stddev>0.01</stddev>
        </noise>
      </ray>
      <plugin name="gazebo_ros_head_hokuyo_controller" filename="libgazebo_ros_gpu_laser.so">
        <topicName>/labrob/laser/scan</topicName>
        <frameName>hokuyo_link</frameName>
      </plugin>
    </sensor>
  </gazebo>

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:

header: 
  seq: 37775
  stamp: 
    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 ...
(more)
edit retag flag offensive close merge delete

Comments

4

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 -> libgazebo_ros_laser.so.

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
1

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
2

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

2 followers

Stats

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

Seen: 1,506 times

Last updated: Aug 15 '16