当先锋百科网

首页 1 2 3 4 5 6 7

[toc]首先云盘资源包在这里 密码: g6vc

0.准备工作:

编译:catkin_make
添加环境变量:(我这里添加了就不再添加)gedit ~/.bashrc

1.gmapping

下载gmapping:

sudo apt-get install ros-melodic-gmapping

启动gmapping演示:

roslaunch mbot_gazebo  mbot_laser_nav_gazebo.launch
roslaunch mbot_navigation gmapping_demo.launch

开启键盘控制:

roslaunch mbot_teleop mbot_teleop.launch 

控制小车行走,q可以加速,得到最后的地图:

保存地图:

rosrun map_server map_saver -f cloister_gmapping

2.hector-slam

下载hector-slam:

sudo apt-get install ros-melodic-hector-slam

启动hector-slam演示 :

roslaunch mbot_gazebo mbot_laser_nav_gazebo.launch
roslaunch mbot_navigation  hector_demo.launch

开启键盘控制:

roslaunch mbot_teleop mbot_teleop.launch 

同样进行控制小车:
打滑了!!

保存地图:

rosrun map_server map_saver -f cloister_gmapping1

3.导航框架–move-base

如果提示错误请下载navigation:

sudo apt-get install ros-melodic-navigation

配置amcl节点:catkin_ws/src/mbot_navigation/launch

导航仿真:

roslaunch mbot_gazebo  mbot_laser_nav_gazebo.launch 
roslaunch mbot_navigation nav_cloister_demo.launch 

点击2D Nav Goal设置终点:

效果:

4.自主探索slam仿真:

roslaunch mbot_gazebo mbot_laser_nav_gazebo.launch 
roslaunch mbot_navigation exploring_slam_demo.launch

开启自主导航:

rosrun mbot_navigation exploring_slam.py

结果其实大都一样,我就图片比较少了,稍后等bilibili视频审核过后,我会挂在这里!

5.自己搭建的虚拟环境

进行手动(键盘控制),自动的导航:
打开gazebo,ctrl+b,开始构建环境
保存自己的模型:

使用自己的环境开始扫描环境:

更改配置文件:

我这里最开始是自动导航,最后,由于小车的速度慢,我改为手动了: