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

You haven't actually added the sensor or plugin to your link.

You have created the link, but nothing more, just a link.

Links in ROS are nothing more than saying telling ROS (your software): This component is located here relative to my other components. Comparing that to the real world. Let's say you've got a sonar and you've added it to your turtlebot. Your sonar ROS driver will create a message saying something like (partial message):

Header:
    seq
    timestamp
    frame_id
...

The frame_id is something you can often configure as a parameter. In your case, you would like it to (probably) be base_sonar_front.

That way, if some other node in ROS needs that sonar data, it can use the tf tree to see how the sensor is connected to the rest of the robot (if the sensor is on a 1m pole sticking forward, the data needs to be interpreted a lot differently than when it's directly in the center of rotation for instance).

What you've done is added the link, which will places your sonar data relative to the rest of the robot. What you haven't done is add the actual sensor to it in Gazebo (basically, you've told ROS where you want the sensor to be, but it's still lying on your virtual shelf).

Looking at the link you've send, they do this at the heading called Adding the sensor plugin for Sonar and IR.

  <ray>
     <scan>
        <horizontal>
           <samples>10</samples>
           <resolution>1</resolution> 
           <min_angle>-0.14835</min_angle>
           <max_angle>0.14835</max_angle>
        </horizontal>
        <vertical>
           <samples>10</samples>
           <resolution>1</resolution> 
           <min_angle>-0.14835</min_angle>
           <max_angle>0.14835</max_angle> 
        </vertical>
     </scan>
     <range>
        <min>0.01</min>
        <max>2</max>
        <resolution>0.02</resolution>
     </range>
  </ray>

That ^ part adds the sensor (so actually mounting it to your robot and not leaving it on your shelf)

  <plugin filename="libgazebo_ros_range.so" name="gazebo_ros_range">
     <gaussianNoise>0.005</gaussianNoise>
     <alwaysOn>true</alwaysOn>
     <updateRate>50</updateRate>
     <topicName>sensor/ir_front</topicName>
     <frameName>base_ir_front</frameName>
     <radiation>INFRARED</radiation>
     <fov>0.2967</fov>
  </plugin>

The plugin part can be seen like the driver. You have added the sensor to Gazebo (mounted it on your robot), but you until you add the plugin part, you aren't actually running the driver to publish the data in ROS.

Since I don't know your level of expertise in simulations, I hope my real world comparisons helped you understand exactly what's going on. If you need any more clarification, please let me know.