Adding the laser scanner to Gazebo

We add the laser scanner on the top of Gazebo in order to perform high-end operations such as autonomous navigation using this robot. Here, we can see that an extra code section needed to be added in diff_wheeled_robot.xacro to have the laser scanner on the robot:

  <link name="hokuyo_link"> 
    <visual> 
      <origin xyz="0 0 0" rpy="0 0 0" /> 
      <geometry> 
        <box size="${hokuyo_size} ${hokuyo_size} ${hokuyo_size}"/> 
      </geometry> 
      <material name="Blue" /> 
    </visual> 
  </link> 
  <joint name="hokuyo_joint" type="fixed"> 
    <origin xyz="${base_radius - hokuyo_size/2} 0 ${base_height+hokuyo_size/4}" rpy="0 0 0" /> 
    <parent link="base_link"/> 
    <child link="hokuyo_link" /> 
  </joint> 
  <gazebo reference="hokuyo_link"> 
    <material>Gazebo/Blue</material> 
    <turnGravityOff>false</turnGravityOff> 
    <sensor type="ray" name="head_hokuyo_sensor"> 
      <pose>${hokuyo_size/2} 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>10.0</max> 
          <resolution>0.001</resolution> 
        </range> 
      </ray> 
      <plugin name="gazebo_ros_head_hokuyo_controller" filename="libgazebo_ros_laser.so"> 
        <topicName>/scan</topicName> 
        <frameName>hokuyo_link</frameName> 
      </plugin> 
    </sensor> 
  </gazebo> 

In this section, we use the Gazebo ROS plugin file called libgazebo_ros_laser.so to simulate the laser scanner.

We can view the laser scanner data by adding some objects in the simulation environment. Here, we add some cylinders around the robot and can see the corresponding laser view in the next section of the figure:

Figure 12 : Differential drive robot in random object in Gazebo

The laser scanner plugin publishes laser data to scan a topic; we can just echo the topic to get the laser scan data array:

    $ rostopic echo /scan
  
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.86.138