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

Revision history [back]

click to hide/show revision 1
initial version

Hello, you should have a laser link which represents the origin of your laser hardware attached to base_link or etc.. in your model such as in turtlebot 's urdf

<joint name="laser_joint" type="fixed">
<origin xyz="-0.065 0 0.075" rpy="0 0 0" />
<parent link="base_link" />
<child link="laser" />

</joint>

<link name="laser"> <visual> <geometry> <box size="0.02 0.035 0.002"/> </geometry> <material name="Green"/> </visual> <inertial> <mass value="0.001"/> <origin xyz="0 0 0"/> <inertia ixx="0.0001" ixy="0.0" ixz="0.0" iyy="0.0001" iyz="0.0" izz="0.0001"/> </inertial> </link>

then in order to use this laser scanner in gazebo you should add laser scanner plugin

    <xacro:macro name="turtlebot_sim_laser">
  <gazebo reference="laser">
    <sensor:ray name="laser">
      <rayCount>180</rayCount>
      <rangeCount>180</rangeCount>
      <laserCount>1</laserCount>

      <origin>0.0 0.0 0.0</origin>
      <displayRays>false</displayRays>

      <minAngle>-130</minAngle>
      <maxAngle>130</maxAngle>

      <minRange>0.08</minRange>
      <maxRange>10.0</maxRange>
      <resRange>0.01</resRange>
      <updateRate>20</updateRate>
      <controller:gazebo_ros_laser name="gazebo_ros_laser_controller" plugin="libgazebo_ros_laser.so">
    <gaussianNoise>0.005</gaussianNoise>
    <alwaysOn>true</alwaysOn>
    <updateRate>20</updateRate>
    <topicName>scan</topicName>
    <frameName>laser</frameName>
    <interface:laser name="gazebo_ros_laser_iface" />
      </controller:gazebo_ros_laser>
    </sensor:ray>
  </gazebo>
</xacro:macro>

Hello, you should have a laser link which represents the origin of your laser hardware attached to base_link or etc.. in your model such as in turtlebot 's urdf

 <joint name="laser_joint" type="fixed">
 <origin xyz="-0.065 0 0.075" rpy="0 0 0" />
 <parent link="base_link" />
 <child link="laser" />
  </joint>

</joint>

<link name="laser"> <visual> <geometry> <box size="0.02 0.035 0.002"/> </geometry> <material name="Green"/> </visual> <inertial> <mass value="0.001"/> <origin xyz="0 0 0"/> <inertia ixx="0.0001" ixy="0.0" ixz="0.0" iyy="0.0001" iyz="0.0" izz="0.0001"/> </inertial> </link>

then in order to use this laser scanner in gazebo you should add laser scanner plugin

    <xacro:macro name="turtlebot_sim_laser">
  <gazebo reference="laser">
    <sensor:ray name="laser">
      <rayCount>180</rayCount>
      <rangeCount>180</rangeCount>
      <laserCount>1</laserCount>

      <origin>0.0 0.0 0.0</origin>
      <displayRays>false</displayRays>

      <minAngle>-130</minAngle>
      <maxAngle>130</maxAngle>

      <minRange>0.08</minRange>
      <maxRange>10.0</maxRange>
      <resRange>0.01</resRange>
      <updateRate>20</updateRate>
      <controller:gazebo_ros_laser name="gazebo_ros_laser_controller" plugin="libgazebo_ros_laser.so">
    <gaussianNoise>0.005</gaussianNoise>
    <alwaysOn>true</alwaysOn>
    <updateRate>20</updateRate>
    <topicName>scan</topicName>
    <frameName>laser</frameName>
    <interface:laser name="gazebo_ros_laser_iface" />
      </controller:gazebo_ros_laser>
    </sensor:ray>
  </gazebo>
</xacro:macro>