室内导航(ubuntu16.04)
程序员文章站
2022-06-22 19:11:25
首先第一步更改权限:catkin_ws/src/mbot_teleop/scripts/mbot_teleop.py一 传感器仿真1 创建简单小车仿真环境1. 创建只有小车的空环境roslaunch mbot_gazebo view_mbot_gazebo_empty_world.launch2. 小车在复杂环境中仿真roslaunch mbot_gazebo view_mbot_gazebo_play_ground.launch3. 键盘控制roslaunch...
首先第一步更改权限:catkin_ws/src/mbot_teleop/scripts/mbot_teleop.py
一、传感器仿真
1、创建简单小车仿真环境
(1)创建只有小车的空环境
roslaunch mbot_gazebo view_mbot_gazebo_empty_world.launch
(2)小车在复杂环境中仿真
roslaunch mbot_gazebo view_mbot_gazebo_play_ground.launch
(3)键盘控制
roslaunch mbot_teleop mbot_teleop.launch
2 带有摄像头小车的仿真
(1)启动仿真环境
roslaunch mbot_gazebo view_mbot_with_camera_gazebo.launch
(2)查看摄像头仿真图像
rqt_image_view
注意:如果输入rqt_image_view时gazebo命令窗口出现错误,可能是gazebo和rviz版本不一致造成的,输入以下命令更新gazebo即可
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install gazebo7 gazebo7-common
3、带有Kinect双目摄像头小车的仿真
(1)启动仿真环境
roslaunch mbot_gazebo view_mbot_with_kinect_gazebo.launch
(2)用rviz查看点云
rosrun rviz rviz
4、带有雷达小车的仿真
(1)启动仿真环境
roslaunch mbot_gazebo view_mbot_with_laser_gazebo.launch
(2)用rviz查看点云图像
rosrun rviz rviz
二、SLAM建图
首先需要安装gampping环境
sudo apt-get install ros-kinetic-gmapping
1. 激光雷达建图(gmapping)
(1)启动雷达仿真环境
roslaunch mbot_gazebo mbot_laser_nav_gazebo.launch
(2)启动gmapping建图的rviz界面
roslaunch mbot_navigation gmapping_demo.launch
(3)启动键盘控制
roslaunch mbot_teleop mbot_teleop.launch
(4) 保存地图
rosrun map_server map_server -f cloister_gmapping
2. Kinect建图(gmapping)
(1)启动Kinect仿真环境
roslaunch mbot_gazebo mbot_kinect_nav_gazebo.launch
(2)启动gampping的rviz界面
roslaunch mbot_navigation gmapping_demo.launch
(3)启动键盘控制节点
roslaunch mbot_teleop mbot_teleop.launch
三、路径规划
首先安装运行环境
sudo apt-get install ros-kinetic-map-server ros-kinetic-move-base ros-kinetic-amcl
1. 启动环境仿真
roslaunch mbot_gazebo mbot_laser_nav_gazebo.launch
2. 启动导航节点
roslaunch mbot_navigation nav_cloister_demo.launch
可以通过2D Pose Estimate来调整机器人的初识位姿
可以通过2D Nav Goal来选择目标位置
路径规划过程
可以在gazebo的insert中添加新的障碍物来进行实时导航
四、SLAM+路径规划
1. 启动仿真环境
roslaunch mbot_gazebo mbot_laser_nav_gazebo.launch
启动SLAM的探索文件,可以点击2D Nav Goal来边建图边导航
roslaunch mbot_navigation exploring_slam_demo.launch
自动建图
rosrun mbot_navigation exploring_slam.py
注意:运行时需要将catkin_ws/src/mbot_navigation/srcipts里面的exploring_slam.py执行权限进行更改
本文地址:https://blog.csdn.net/qq_40817117/article/details/108572188