[Robot projection]step 1:实现turtlebot的仿真

说明

系统:ubuntu18.04
网站:turtlebot3官方教程
目标:在gazebo上实现机器人的仿真

安装

//创建工作空间
mkdir -p ~/turtlebot_ws/src
cd ~/turtlebot_ws/src
//下载所需代码
git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
git clone https://github.com/ROBOTIS-GIT/turtlebot3.git
git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
cd ..
//基于包目录下xml文件中的依赖安装依赖项
rosdep install --from-paths src -i -y
//初始化工作空间
catkin_init_workspace
//编译
catkin_make
//将新工程的ROS环境设置加入~/.bashrc文件
echo "source ~/catkin_ws/devel/setup.bash " >> ~/.bashrc
source ~/.bashrc
//根据所选用的TB3机器人是Burger还是Waffle,将其作为环境变量加入~/.bashrc文件
echo "export TURTLEBOT3_MODEL=burger" >> ~/.bashrc
source ~/.bashrc

使用

世界

//任意选择一个世界启动
roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch
//这是一个空世界,即gazebo默认的环境
roslaunch turtlebot3_gazebo turtlebot3_world.launch
//这是一个内有简单障碍物的世界,常用来slam和navigation
roslaunch turtlebot3_gazebo turtlebot3_house.launch
//这是一个类似房间的世界,常用来做更复杂的测试

驱动

//键盘控制:w加速,a、d左右旋转,s停止
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
//自动控制
roslaunch turtlebot3_gazebo turtlebot3_simulation.launch

建图

//打开世界
roslaunch turtlebot3_gazebo turtlebot3_world.launch
//gmapping建图
roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=gmapping
//键盘控制
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
//存地图
rosrun map_server map_saver -f ~/map

导航

//打开地图
roslaunch turtlebot3_gazebo turtlebot3_world.launch
//开始导航
roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=$HOME/map.yaml

先用rviz中的2D estimate确定目前机器人的位姿(位置与姿态/方向)
再用2D goal选中目标点,机器人开始自主导航

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值