Turtlebot3与仿真-仿真环境搭建(indigo版)
说明
- 介绍如何在ubuntu14.04下的indigo(ROS版本)下搭建turtlebot3仿真环境
TurtleBot3配置
测试环境:
- 安装64位的Ubuntu 14.04
- 安装ROS Indigo (ros-indigo-desktop-full版)
- 安装Gazebo 2.2
建立工作空间
$ mkdir -p ~/tb3_ws/src
$ cd ~/tb3_ws/src
$ catkin_init_workspace
- 编译
$ cd ..
$ catkin_make
$ source devel/setup.bash
或者source哪行,增加到~/.bashrc里,这样每次打开终端会自动执行。
安装依赖包:
$ sudo apt-get install ros-indigo-navigation
$ sudo apt-get install ros-indigo-gmapping
$ sudo apt-get install ros-indigo-hector-mapping
- 下载软件包
$ cd ~/tb3_ws/src
$ git clone https://github.com/ROBOTIS-GIT/turtlebot3.git
$ git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
$ git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
$ git clone https://github.com/ros-teleop/teleop_twist_keyboard.git
- 编译
$ cd ..
$ catkin_make
- 修改两个文件
~/tb3_ws/src/turtlebot3/turtlebot3_description/urdf/turtlebot3_burger.gazebo.xacro
~/tb3_ws/src/turtlebot3/turtlebot3_description/urdf/turtlebot3_waffle.gazebo.xacro
- 搜索含
的行,如下:
<visualize>$(arg imu_visual)</visualize>
- 修改为:
<!--visualize>$(arg imu_visual)</visualize-->
- 因为indigo版本不知道怎么处理 $(arg var) 输入,替换为${var}
- 再打开turtlebot3_waffle.gazebo.xacro,找到119行,
<pose>$(arg r200_cam_rgb_px) $(arg r200_cam_rgb_py) $(arg r200_cam_rgb_pz) 0 0 0</pose>
- 修改为:
<pose>${r200_cam_rgb_px} ${r200_cam_rgb_py} ${r200_cam_rgb_pz} 0 0 0</pose>
- 找到136行:
<pose>$(arg r200_cam_depth_offset) 0 0 0 0 0</pose>
- 修改为:
<pose>${r200_cam_depth_offset} 0 0 0 0 0</pose>
gazebo配置
- 复制turtlebot3模型到gazebo模型文件夹
$ cp -r $HOME/tb3_ws/src/turtlebot3_simulations/turtlebot3_gazebo/worlds/turtlebot3 $HOME/.gazebo/models/
- 指定机器人模型,可以是burger或waffle
$ export TURTLEBOT3_MODEL={type}
- {type}为burger或waffle,如:
$ export TURTLEBOT3_MODEL="burger"
- 启动gazebo
$ roslaunch turtlebot3_gazebo turtlebot3_world.launch
- 启动rviz,进行可视化
$ roslaunch turtlebot3_gazebo turtlebot3_gazebo_rviz.launch
- 效果:
- 启动键盘操作
$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py
- 效果:
参考:
- Navigation stack: http://wiki.ros.org/navigation
- Gmapping SLAM: http://wiki.ros.org/gmapping
- Hector SLAM: http://wiki.ros.org/hector_mapping?distro=indigo
- http://spectrum.ieee.org/automaton/robotics/robotics-hardware/review-robotis-turtlebot-3
- http://turtlebot3.robotis.com/en/latest/simulation.html
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号