ROS 学习系列 -- 执行turtlebot navigation的方法

原创 2015年11月19日 10:19:36
我们讲一下如何使用现有的turtlebot launch文件来启动navigation,并在PC上使用rviz指挥。

1. 网络环境布置

turtlebot单片机我们使用的是firefly,rviz运行在PC上,它们使用wifi通讯。master ros运行在firefly上,PC需要指向firefly。在PC修改IP到firefly主机的映射,修改/etc/hosts 文件,如

sudo nano /etc/hosts

打开hosts后,我们从前面几行开始插入firefly单片机的ip地址和hostname,形式如下:

127.0.0.1       localhost
127.0.1.1       pc_hostname
192.168.1.16    firefly

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
完毕后保存并确认可以在PC上ping通firefly名字本身。


在firefly单片机上source下面的脚本内容,设定turtlebot为master ROS节点:

export TURTLEBOT_BASE=roomba
export TURTLEBOT_STACKS=circles
export TURTLEBOT_3D_SENSOR=asus_xtion_pro
export TURTLEBOT_SIMULATION=false
export TURTLEBOT_SERIAL_PORT=/dev/ttyUSB0
export ROS_IP=192.168.1.16
export TURTLEBOT_MAP_FILE=/home/firefly/room323.yaml

在PC上source下面的脚本内容,指向turtlebot为master ROS节点:

export ROS_MASTER_URI=http://firefly:11311
export ROS_HOSTNAME=<span style="font-family:SimSun;">pc_hostname</span>

2. 安装必要软件包 

在firefly单片机上执行下面的脚本安装:

sudo apt-get install ros-indigo-turtlebot ros-indigo-rocon-app-platform ros-indigo-rocon-multimaster ros-indigo-rocon-msgs ros-indigo-rocon-qt-gui ros-indigo-rocon-tools ros-indigo-std-capabilities ros-indigo-rqt-capabilities ros-indigo-rocon-remocon ros-indigo-rocon-apps ros-indigo-turtlebot-rapps

在PC上执行下面的脚本安装:

sudo apt-get install ros-indigo-turtlebot-rviz-launchers
当然RVIZ 是必须已经安装完了


3. 启动turtlebot和rviz 
在firefly单片机上打开一个终端执行下面脚本:

roslaunch turtlebot_bringup minimal.launch


在firefly单片机上打开第二个终端执行下面脚本:

roslaunch  turtlebot_app nav_map.launch

注意这里一定要设置环境变量 TURTLEBOT_MAP_FILE 注明地图yaml文件的位置。这个时候,turtlebot已经可以使用了,准备接受命令移动。


执行下面脚本在PC上执行脚本:

roslaunch turtlebot_rviz_launchers view_navigation.launch --screen
这时候就可以看到rviz上显示如下画面,点击按钮'2D Pose Estimate' '2D Nav Goal'就可以导航了:



4. 简化后的turtlebot启动脚本

在firefly单片机上只执行一个简化后的launch脚本也可以,脚本内容如下:

<!--
  Right now, the android app is hard coded to look for /cmd_vel as the input
  topic.
 -->
<launch>  
  
<!-- Turtlebot -->
  <arg name="base"              default="$(env TURTLEBOT_BASE)"         doc="mobile base type [create, roomba]"/>
  <arg name="battery"           default="$(env TURTLEBOT_BATTERY)"      doc="kernel provided locatio for battery info, use /proc/acpi/battery/BAT0 in 2.6 or earlier kernels." />
  <arg name="stacks"            default="$(env TURTLEBOT_STACKS)"       doc="stack type displayed in visualisation/simulation [circles, hexagons]"/>
  <arg name="3d_sensor"         default="$(env TURTLEBOT_3D_SENSOR)"    doc="3d sensor types [kinect, asux_xtion_pro]"/>
  <arg name="simulation"        default="$(env TURTLEBOT_SIMULATION)"   doc="set flags to indicate this turtle is run in simulation mode."/>
  <arg name="serialport"        default="$(env TURTLEBOT_SERIAL_PORT)"  doc="used by create to configure the port it is connected on [/dev/ttyUSB0, /dev/ttyS0]"/>
  <arg name="robot_name"        default="$(env TURTLEBOT_NAME)"         doc="used as a unique identifier and occasionally to preconfigure root namespaces, gateway/zeroconf ids etc."/>
  <arg name="robot_type"        default="$(env TURTLEBOT_TYPE)"         doc="just in case you are considering a 'variant' and want to make use of this."/>

  <param name="/use_sim_time" value="$(arg simulation)"/>

  <include file="$(find turtlebot_bringup)/launch/includes/robot.launch.xml">
    <arg name="base" value="$(arg base)" />
    <arg name="stacks" value="$(arg stacks)" />
    <arg name="3d_sensor" value="$(arg 3d_sensor)" />
  </include>
  <include file="$(find turtlebot_bringup)/launch/includes/mobile_base.launch.xml">
    <arg name="base" value="$(arg base)" />
    <arg name="serialport" value="$(arg serialport)" />
  </include>  
  
  <arg name="scan_topic"              default="scan"/>
  <arg name="cmd_vel_topic"           default="/teleop/cmd_vel"/>
  <arg name="compressed_image_topic"  default="/teleop/compressed_image"/>
  
  <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" />
  </include>

  <!-- Make a slower camera feed available. -->
  <!-- *********************** Teleoperation ********************** -->
  <param name="camera/rgb/image_color/compressed/jpeg_quality" value="22"/>
  <!-- 
  <node pkg="topic_tools" type="throttle" name="camera_throttle" args="messages camera/rgb/image_rect_color/compressed 5"/>
  -->
  
  <node pkg="nodelet" type="nodelet" name="teleop_velocity_smoother"
        args="load yocs_velocity_smoother/VelocitySmootherNodelet /mobile_base_nodelet_manager">
    <rosparam file="$(find turtlebot_bringup)/param/defaults/smoother.yaml" command="load"/>
    <remap from="teleop_velocity_smoother/raw_cmd_vel" to="$(arg cmd_vel_topic)"/>
    <remap from="teleop_velocity_smoother/smooth_cmd_vel" to="/cmd_vel_mux/input/teleop"/>

    <!-- Robot velocity feedbacks; use the one configured as base default -->
    <remap from="teleop_velocity_smoother/odometry"       to="/odom"/>
    <remap from="teleop_velocity_smoother/robot_cmd_vel"  to="/mobile_base/commands/velocity"/>
  </node>

  <!-- *********************** Optimisation *********************** -->
  <node pkg="tf" type="tf_change_notifier" name="tf_throttle_for_android_gui">
    <param name="polling_frequency"             value="5"/>
    <param name="translational_update_distance" value="-1"/>
    <param name="angular_update_distance"       value="-1"/>
    <rosparam param="frame_pairs">
      - {source_frame: base_footprint, target_frame: map}
      - {source_frame: camera_depth_frame, target_frame: map}
    </rosparam>
  </node>


  <!-- *************************** Navi *************************** -->
  <include file="$(find turtlebot_navigation)/launch/includes/move_base.launch.xml">
    <arg name="odom_topic" value ="/odom" />
  </include>
  <include file="$(find turtlebot_navigation)/launch/includes/amcl.launch.xml">
    <arg name="use_map_topic" value ="true"/>
  </include>
  
  <!--
  <node pkg="topic_tools" type="throttle" name="relay_compressed_throttle_image" args="messages camera/rgb/image_rect_color/compressed_throttle 5 $(arg compressed_image_topic)" required="true">
    <param name="lazy" value="false"/>
  </node>
  -->
  
  <node pkg="topic_tools" type="throttle" name="relay_scan" args="messages scan 5 $(arg scan_topic)" required="true">
    <param name="lazy" value="false"/>
  </node>

  <!-- Maps -->
  <arg name="map_file" default=" $(env TURTLEBOT_MAP_FILE)" />
  <node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" />


<!--  <node pkg="map_store" type="map_manager" name="map_manager" output="screen"/>-->

  <!-- World Canvas -->
  <arg name="debug" default="false"/>
  <node pkg="world_canvas_server" type="world_canvas_server" name="world_canvas_server" args="$(arg debug)" output="screen">
    <param name="start_map_manager" value="true"/>
    <param name="auto_save_map" value="false"/>
  </node> 
</launch>


相关文章推荐

TurtleBot基于已知地图的自主导航

此博文介绍了如何让TurtleBot基于已知的地图进行自主导航。

turtlebot实现在多个目标点之间自主导航

turtlebot实现在几个目标点之间自主导航的任务,关键是指定turtlebot的初始位姿后,设定多个目标点。...

通过TurtleBot学navigation与ROS的笔记

TurtleBot运行的几条关键语句#启动仿真环境 roslaunch turtlebot_gazebo tuetlebot_world.launch #键盘控制 roslaunch turtlebo...

turtlebot(hydro)学习笔记四:turtlebot上hokuyo UTM-30LX激光扫描仪的添加及导航

一、将Hokuyo Laser添加到Turtlebot 1、udev配置 (1)进入/etc/udev/rules.d目录,新建一个50-laser.rules文件,添加以下内容到该文件:KERN...

ROS进阶学习笔记(11)- Turtlebot Navigation and SLAM

(写在前面: 这里参考rbx书中第八章和ROS社区教程进行学习,先看社区教程)   ===  Doing the Turtlebot Navigation   === ref ros wiki: ...
  • sonictl
  • sonictl
  • 2016年02月02日 13:56
  • 2153

ROS 学习系列 -- 使用urdf创建机器人模型在Rviz中3D观察 之一 link使用

 目录(?)[+] 软件环境 小车形状与尺寸创建Ros package 创建lauch文件启动Rviz创建基座base_link创建轮子 使用ROS强大的机器人功能,建立...
  • BBZZ2
  • BBZZ2
  • 2016年05月11日 16:35
  • 5102

ROS(indigo) turtlebot2 + android一些有趣应用

ROS和Android配合使用非常有趣,这里推荐,ROSClinet,使用rosbridge让android和ROS通信:具体参考奥斯卡的个人剧场:http://xxhong.net/turtlebo...

Navigation_ResourceNotFound: turtlebot_rviz_launchers或者[view_navigation.launch] is neither a launch

roslaunch turtlebot_rviz_launchers view_navigation.launch --screen [view_navigation.launch] is neith...

【turtlebot】turtlebot运行报错解决方案

【问题描述】:博主将turtlebot_node.py里的has_gyro值改为False,再用cp命令将之替换掉了/opt/ros/indigo/lib里的turtlebot_node.py,随后不...

yocs_velocity_smoother介绍及参数说明

软件包摘要根据机器人速度和加速度限制绑定传入的速度消息。链接:https://github.com/yujinrobot/yujin_ocs.git(branch:indigo)速度平滑节点速度平滑节...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:ROS 学习系列 -- 执行turtlebot navigation的方法
举报原因:
原因补充:

(最多只允许输入30个字)