[置顶] Ros中2D_Slam说明: turtlebot+kinect改写成turtlebot+laser(hokuyo)

  SLAM_turtlebot   hokuyo 说明:
安装包:turtlebot              turtlebot_apps

        hokuyo_node    kobuki

kinect 2D_Slam 参考链接:  http://wiki.ros.org/turtlebot_navigation/Tutorials/Build%20a%20map%20with%20SLAM

hector_slam   参考连接:  http://my.phirobot.com/blog/2014-06-hector_mapping_example.html

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
改动turtlebot的SLAM例子,已经可以初步跑动起kobuki来用实际机器人做SLAM。
 turtlebot的例子主要是利用kinect的深度信息模拟激光数据进行二维地图的构建。现在只需将传感器节点换成hokuyo
  的节点,并配置好相应的参考系与传感信息发布数据的话题。基本上就可以整体运行起来。
     现在也只是初步的配置。后面要根据实际的机器人物理模型结构,规范好激光与机器人的相对位置。
 1)机器人启动.
   机器人的物理描述文件(urdf文件)配置,关于实际运动的mobile_base相应配置,诊断节点

 2) 传感器运行。
    改动主要集中在hokuyo_node的坐标系与数据节点。

 3)gmapping 制栅格地图

 4)amcl 定位。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. 启动turtlebot.

roslaunch turtlebot_bringup minimal.launch


2.gmapping

roslaunch turtlebot_navigation gmapping_demo.launch

注:。turtlebot的例子主要是利用kinect的深度信息模拟激光数据进行二维地图的构建。现在只需将传感器节点换成hokuyo 的节点,并配置好相应的参考系与传感信息发布数据的话题。基本上就可以整体运行起来。

ps: 这部分需要将启动的传感器3dsenser(kinect)  改成laser. hokuyo

       添加文件hokuyo_2d_sensor.launch



3.显示
roslaunch turtlebot_rviz_launchers view_navigation.launch
××键盘控制:
$ roslaunch kobuki_keyop keyop.launch
$ roslaunch turtlebot_teleop keyboard_teleop.launch
4.保存地图
rosrun map_server map_saver -f /tmp/my_map
5 .导航
 roslaunch turtlebot_navigation amcl_demo.launch map_file:[map file path]
显示:
roslaunch turtlebot_rviz_launchers view_navigation.launch --screen

.yaml格式文件
////////////////查看电量:
 对话框  运动GUI
 
  运行 rosrun rqt_robot_monitor rqt_robot_monitor


 **界面式查kobuki的电量(先运行节点):rosrun rqt_gui rqt_gui

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
说明:bash脚本语言。turtlebot_hokuyo_slam.sh
1. 先要进行ros的环境变量设置。
2. 并行工程中需要等待后台launch文件的启动
 


#!/bin/bash

#source /opt/ros/hydro/setup.bash  
source /opt/ros/hydro/setup.bash
source /home/agv/hydro_ws/devel/setup.bash
ROS_PACKAGE_PATH=~/hydro_ws/src:$ROS_PACKAGE_PATH
ROS_WORKSPACE=~/hydro_ws/src

echo roslaunch turtlebot_bringup
roslaunch turtlebot_bringup minimal.launch &

 sleep 15
 echo turtlebot_navigation
 roslaunch turtlebot_navigation gmapping_demo.launch &

 sleep 15
 echo turtlebot_rviz_launchers  

 roslaunch turtlebot_rviz_launchers view_navigation.launch &
 sleep 5

 roslaunch kobuki_keyop keyop.launch

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


注:  主要更改的配置文件。
  1.文件 src/turtlebot_apps/turtlebot_navigation/launch gmapping_demo.launch
<launch>

 <!--kinect-->
  <!--include file="$(find turtlebot_bringup)/launch/3dsensor.launch"-->
    <!--arg name="rgb_processing" value="false" /-->
    <!--arg name="depth_registration" value="false" /-->
    <!--arg name="depth_processing" value="false" /-->
    
    <!-- We must specify an absolute topic name because if not it will be prefixed by "$(arg camera)".
         Probably is a bug in the nodelet manager: https://github.com/ros/nodelet_core/issues/7 -->
    <!--arg name="scan_topic" value="/scan" /-->
  <!--/include-->

     <!--hokuyo-->
<!--配置了相应的激光数据base  与 topic -->
  <arg name="2dsensor"  default="$(optenv SENSOR_2D hokuyo)"/>
  <!-- rplidar, hokuyo -->
  <!--arg name="use_filter" default="$(optenv USE_FILTER false)"/-->
 
  <include file="$(find turtlebot_bringup)/launch/includes/$(arg 2dsensor)_2d_sensor.launch.xml">
    <arg name="scan_topic" value="/scan" />
    <arg name="laser_frame" value="camera_depth_frame" />
    <!-- if need change port -->
    <!--arg name="laser_port" value="/dev/ttyACM0" /-->
  </include>
 
  <!--include if="$(arg use_filter)" file="$(find exbotxi_bringup)/launch/includes/laser_filter.launch.xml">
    <arg name="scan_in" value="scan_raw"/>
    <arg name="scan_out" value="/scan"/>
  </include-->

 <include file="$(find turtlebot_navigation)/launch/includes/gmapping.launch.xml"/>

  <include file="$(find turtlebot_navigation)/launch/includes/move_base.launch.xml"/>

</launch>



2. 文件 /home/agv/kobuki_ws/src/turtlebot/turtlebot_bringup/launch/2dsensor.launch

<launch>
  <arg name="2dsensor"  default="$(optenv SENSOR_2D hokuyo)"/>
  <!-- rplidar, hokuyo -->
  <arg name="use_filter" default="$(optenv USE_FILTER false)"/>
 
  <include file="$(find exbotxi_bringup)/launch/includes/$(arg 2dsensor)_2d_sensor.launch.xml">
    <arg if="$(arg use_filter)" name="scan_topic" value="scan_raw" />
    <arg name="laser_frame" value="laser_link" />
    <!-- if need change port -->
    <!--arg name="laser_port" value="/dev/ttyUSB1" /-->
  </include>
 
  <include if="$(arg use_filter)" file="$(find exbotxi_bringup)/launch/includes/laser_filter.launch.xml">
    <arg name="scan_in" value="scan_raw"/>
    <arg name="scan_out" value="scan"/>
  </include>
 
</launch>


3. 文件 /home/agv/kobuki_ws/src/turtlebot/turtlebot_bringup/launch/include/hokuyo_2d_sensor.launch.xml

<launch>
  <arg name="scan_topic" default="/scan" />
  <arg name="laser_frame" default="kobuki" />
  <arg name="laser_port" default="/dev/ttyACM0" />
 
  <node name="hokuyo" pkg="hokuyo_node" type="hokuyo_node">
    <param name="port" type="string" value="$(arg laser_port)"/>
    <param name="min_ang" value="-1.7" />
    <param name="max_ang" value="1.7" />
    <param name="min_range" value="0.18" />
    <param name="hokuyo_node/calibrate_time" value="true" />
    <param name="frame_id" value="$(arg laser_frame)" />
    <remap from="scan" to="$(arg scan_topic)"/>
  </node>
</launch>


[置顶] Ros中2D_Slam说明: turtlebot+kinect改写成turtlebot+laser(hokuyo)_第1张图片




补充:  坐标系的问题。

1 turtlebot_world.launch
     <include file="$(find turtlebot_gazebo)/launch/includes/$(arg base).launch.xml">

1.1 kobuki.launch.xml
  <arg name="urdf_file" default="$(find xacro)/xacro.py '$(find turtlebot_description)/robots/$(arg base)_$(arg stacks)_$(arg 3d_sensor).urdf.xacro'" />
  <param name="robot_description" command="$(arg urdf_file)" />
1.1.1 rplidar.urdf.xacro
  <xacro:macro name="sensor_rplidar" params="parent">
    <joint name="laser" type="fixed">
      <origin xyz="0.15 0.0 0.15" rpy="0 0.0 0.0" />
      <parent link="base_link" />
      <child link="base_laser_link" />
    </joint>
熟悉下urdf文件的的相应语法。。
坐标系的相对关系。父子坐标系
        旋转与平移。




你可能感兴趣的:([置顶] Ros中2D_Slam说明: turtlebot+kinect改写成turtlebot+laser(hokuyo))