自主探索SLAM及实现自主探索SLAM
程序员文章站
2022-07-12 09:55:43
...
自主探索SLAM
之前gmapping SLAM 的实现流程五该百纳,将move_base节点添加到SLAM系统中,在gmapping_demo.launch文件中加入move_base节点的设置,并命名一个新的launch文件mrobot_navigation/launch/exploring_slam_demo.launch
<launch>
<include file="$(find mrobot_navigation)/launch/gmapping.launch"/>
<!--运行move_base节点-->
<include file="$(find mrobot_navigation)/launch/move_base.launch"/>
<!--运行rviz-->
<node pkg="rviz" type="rviz" name="rviz" args="-d $(find mrobot_navigation)/rviz/nav.rviz"/>
</launch>
运行命令
$ roscore
$ roslaunch mrobot_gazebo mrobot_laser_nav_gazebo.launch
$ roslaunch mrobot_navigation exploring_slam_demo.launch
通过使用rviz中的2D Nav Goal工具,在地图中随便挑选一个目标进行导航
实现自主探索SLAM
在mrobot_navigation/scripts/exploring_slam.py仅修改random_navigation.py代码中设置的目标点
#设置目标点的位置
#在rviz中点击“2D Nav Goal”按钮,然后单击地图中的一点
#在终端中就会看到该点的坐标信息
locations = dict()
locations[‘1’] = Pose(Point(4.589, -0.376, 0.000), Quaternion(0.000, 0.000, -0.447, 0.894))
locations[‘2’] = Pose(Point(4.231, -6.050, 0.000), Quaternion(0.000, 0.000, -0.847, 0.532))
locations[‘3’] = Pose(Point(-0.674, -5.224, 0.000), Quaternion(0.000, 0.000, 0.000, 1.000))
locations[‘4’] = Pose(Point(-5.543, -4.779, 0.000), Quaternion(0.000, 0.000, 0.645 0.764))
locations[‘5’] = Pose(Point(-4.701, -0.590, 0.000), Quaternion(0.000, 0.000, 0.340, 0.940))
locations[‘6’] = Pose(Point(2.924, 0.018, 0.000), Quaternion(0.000, 0.000, 0.000, 1.000))
程序在后面链接中
首先让exploring_slam.py文件得到运行授权
$ cd ~/catkin_ws/src/mrobot_navigation/scripts
$ chmod +x exploring_slam.py
运行程序
$ roscore
$ roslaunch mrobot_gazebo mrobot_laser_nav_gazebo.launch
$ roslaunch mrobot_navigation exploring_slam_demo.launch
$ rosrun mrobot_navigation exploring_slam.py
链接:https://pan.baidu.com/s/1izEqLVU3I6HxNSTa9jHKxw
提取码:fp7i
推荐阅读