ROS_增加感測器_Hokuyo[4]:修改模擬中Turtlebot[2]

修改模擬中Turtlebot[2]
4. 設定模擬環境中Hokuyo的「取樣點數」、
   「可偵測之最大、最小範圍」及「最大、最小角度」。
   在turtlebot_gazebo.urdf.xacro中最下方加入:
   (位於turtlebot_description/urdf 資料夾中)


<xacro:macro name="turtlebot_sim_2dsensor">
  <gazebo reference="hokuyo_link">
        <sensor type="ray" name="head_hokuyo_sensor">
          <pose>0 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-->
                <min_angle>-2.355</min_angle>
                <!--max_angle>1.570796</max_angle-->
                <max_angle>2.355</max_angle>
              </horizontal>
     </scan>
            <range>
              <min>0.10</min>
              <max>30.0</max>
              <resolution>0.01</resolution>
            </range>
            <noise>
              <type>gaussian</type>

               <mean>0.0</mean>
              <stddev>0.01</stddev>
            </noise>
          </ray>
            <plugin name="gazebo_ros_head_hokuyo_controller" filename="libgazebo_ros_laser.so">
            <!--topicName>/turtlebot/laser/scan</topicName-->
            <topicName>scan</topicName>
            <frameName>hokuyo_link</frameName>
        </plugin>
        </sensor>
      </gazebo>
  </xacro:macro>


5. 呼叫、啟動前面設定好的Hokuyo描述。
   建立kobuki_hexagons_hokuyo.urdf.xacro
   (位於turtlebot_description/robots資料夾中)

<?xml version="1.0"?>
<!--
    - Base      : create
    - Stacks    : circles
    - 3d Sensor : hokuyo
-->    
<robot name="turtlebot" xmlns:xacro="http://ros.org/wiki/xacro">

  <xacro:include filename="$(find turtlebot_description)/urdf/turtlebot_library.urdf.xacro" />
  <xacro:include filename="$(find kobuki_description)/urdf/kobuki.urdf.xacro" />
  <xacro:include filename="$(find turtlebot_description)/urdf/stacks/hexagons.urdf.xacro"/>
  <xacro:include filename="$(find turtlebot_description)/urdf/sensors/hokuyo.urdf.xacro" />

  <create/>
  <stack_circles parent="base_link"/>
  <sensor_hokuyo  parent="base_link"/>
</robot>


在 ~/.bashrc中加入
   (位於turtlebot_description/robots資料夾中)

export TURTLEBOT_3D_SENSOR=hokuyo

改變成果
更改前

更改後


參考來源
Adding Hokuyo Laser Finder to Turtlebot in Gazebo Simulation
Blog: 在ros-kinetic與gazebo仿真環境下给turtlebot配置hokuyo激光雷達

留言

這個網誌中的熱門文章

ROS_建地圖_Octomap[1]:安裝及測試

C#_練習_[3]:對發票程式