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.