0
$\begingroup$

Rosanswers logo

I'm new at gazebo, and I would like to know how to put a hokuyo sensor on my p2os model. I am not using a real robot, I just want to know how to add a sensor on my simulation. Thanks!


Originally posted by Mendelson on ROS Answers with karma: 73 on 2012-09-27

Post score: 0


Original comments

Comment by allenh1 on 2015-07-07:
Are you using P2OS or are you using ROSARIA?

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Or just create a laser link and add something similar to this:

  <link name="laser_scan_link" type="laser"> 
 <inertial> 
      <mass value="0.5" /> 
      <origin xyz="0 0 0" /> 
      <inertia ixx="0.3"  ixy="0.3"  ixz="0.3" iyy="0.3"  iyz="0.3"  izz="0.3" /> 
     </inertial> 
     <visual> 
       <origin xyz="0 0 0" rpy="0 0 0"/> 
       <geometry> 
         <cylinder length="0.1" radius="0.05" /> 
       </geometry> 
     </visual> 
     <collision> 
      <origin xyz="0 0 0" rpy="0 0 0"/> 
       <geometry> 
         <cylinder length="0.1" radius="0.05" /> 
       </geometry> 
     </collision> 
  </link> 

<joint name="laser_to_base_link" type="fixed"> 
  <origin xyz="0.25 0 0.32" rpy="0 0 0" /> 
  <parent link="base_link" /> 
  <child link="laser_scan_link"/> 
</joint> 

   <gazebo reference="laser_scan_link"> 
  <sensor:ray name="laser_scan_link"> 
     <rayCount>683</rayCount> 
     <rangeCount>683</rangeCount> 
     <laserCount>1</laserCount> 

         <origin>0.0 0.0 0.0</origin> 
         <displayRays>true</displayRays> 

         <minAngle>-105</minAngle> 
         <maxAngle>105</maxAngle> 

         <minRange>0.06</minRange> 
         <maxRange>4.0</maxRange> 
         <resRange>0.01</resRange> 
         <updateRate>10.0</updateRate> 
            
         <controller:gazebo_ros_laser name="gazebo_ros_base_scan_link_controller" plugin="libgazebo_ros_laser.so"> 
                <gaussianNoise>0.005</gaussianNoise> 
                <alwaysOn>true</alwaysOn> 
                <updateRate>20.0</updateRate> 
                <topicName>base_scan/scan</topicName> 
                <frameName>laser_scan_link</frameName> 
                <interface:laser name="gazebo_ros_base_scan_link_iface"/> 
         </controller:gazebo_ros_laser> 
        </sensor:ray> 
    </gazebo> 


  <gazebo>
   <controller:gazebo_ros_controller_manager name="gazebo_ros_controller_manager" plugin="libgazebo_ros_controller_manager.so">
      <alwaysOn>true</alwaysOn>
      <updateRate>1000.0</updateRate>
      <interface:audio name="gazebo_ros_controller_manager_dummy_iface" />
    </controller:gazebo_ros_controller_manager>
  </gazebo>

Originally posted by Peter Listov with karma: 338 on 2012-09-29

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by Vegeta on 2012-10-18:
@Peter Listov I got interested with this answer, can you give a suggestion into how to add a hokuyo laser to the turtlebot. I am new to ros. Can you tell me where do I have to put the code.

$\endgroup$
0
$\begingroup$

Rosanswers logo

For this you will first need to understand how urdf works and John has written great tutorials for that http://ros.org/wiki/urdf/Tutorials (section 1 and 2). Then you will need to understand the Gazebo extensions for URDF (http://ros.org/wiki/urdf/Tutorials/UnderstandingPR2URDFGazeboExtension) and finally here is also an example of how to add the actual sensor: http://ros.org/wiki/urdf/Tutorials/AddingSensorsToPR2.

For the insertion of the hokuyo specifically you can check how it is being done for turtlebot: Sensor description: https://kforge.ros.org/turtlebot/turtlebot/file/fb8354a98ac5/turtlebot_description/urdf/gazebo.urdf.xacro (turtlebot_sim_laser) Sensor insertion into robot's urdf: https://kforge.ros.org/turtlebot/turtlebot/file/fb8354a98ac5/turtlebot_description/urdf/turtlebot_body.urdf.xacro (laser_joint)

Please also note that this shall probably be asked on http://answers.gazebosim.org/questions/.

D.


Originally posted by dejanpan with karma: 1420 on 2012-09-27

This answer was NOT ACCEPTED on the original site

Post score: 3

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.