我是靠谱客的博主 繁荣季节,这篇文章主要介绍Ubuntu16.04+hokuyo(URG)实现amcl导航,现在分享给大家,希望可以做个参考。

turtlebot2基于hokuyo激光的amcl+move_bace导航

1、文件配置

1)打开一个新终端,配置ROS环境变量(每开新的终端都最好配置一次)

复制代码
1
2
$ source ~/catkin_ws/devel/setup.bash

2)修改激光串口权限,注意:每次USB重新插入都需要修改该权限

复制代码
1
2
$ sudo chmod a+rw /dev/ttyACM0

3)手动打开hokuyo_laser.launch(路径:/home/yourname/catkin_ws/src/turtlebot_apps/turtlebot_navigation/laser/driver)并添加tf变换(这里会有两个tf变换才能运行,具体原因不明)

复制代码
1
2
<node pkg="tf" type="static_transform_publisher" name="map_to_odom" args="0.0 0.0 0.17 0 0 0.0 /map /odom 1000"/>

这个launch的完整文件为:

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!-- This launch file shows how to start a hokuyo node. You may have to change the port parameter if your laser is not at /dev/ttyACM0. If you have rviz built, you can uncomment the rviz node to visualize the laser data. Otherwise, you can use rostopic to see the data: rostopic echo /scan --> <launch> <node name="hokuyo" pkg="hokuyo_node" type="hokuyo_node" respawn="false" output="screen"> <!-- Starts up faster, but timestamps will be inaccurate. --> <param name="calibrate_time" type="bool" value="false"/> <!-- Set the port to connect to here --> <param name="port" type="string" value="/dev/hokuyo"/> <param name="frame_id" type="string" value="laser"/> <param name="intensity" type="bool" value="false"/> </node> <node pkg="tf" type="static_transform_publisher" name="base_to_laser" args="0.0 0.0 0.17 0 0.0 0.0 base_link laser 100"/> <node pkg="tf" type="static_transform_publisher" name="map_to_odom" args="0.0 0.0 0.17 0 0 0.0 /map /odom 1000"/> <node name="rviz" pkg="rviz" type="rviz" respawn="false" output="screen" args="-d $(find hokuyo_node)/hokuyo_test.vcg"/> </launch>

4)创建hokuyo_amcl_demo.launch

复制代码
1
2
3
$ roscd turtlebot_navigation $ touch launch/hokuyo_amcl_demo.launch

打开,并添加以下内容:

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<launch> <!-- Define laser type--> <arg name="laser_type" default="hokuyo" /> <!-- laser driver --> <include file="$(find turtlebot_navigation)/laser/driver/$(arg laser_type)_laser.launch"/> <!-- Map server --> <arg name="map_file" default="$(env TURTLEBOT_MAP_FILE)"/> <node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" /> <!-- AMCL --> <arg name="custom_amcl_launch_file" default="$(find turtlebot_navigation)/launch/includes/amcl/$(arg laser_type)_amcl.launch.xml"/> <arg name="initial_pose_x" default="0.0"/> <!-- Use 17.0 for willow's map in simulation --> <arg name="initial_pose_y" default="0.0"/> <!-- Use 17.0 for willow's map in simulation --> <arg name="initial_pose_a" default="0.0"/> <include file="$(arg custom_amcl_launch_file)"> <arg name="initial_pose_x" value="$(arg initial_pose_x)"/> <arg name="initial_pose_y" value="$(arg initial_pose_y)"/> <arg name="initial_pose_a" value="$(arg initial_pose_a)"/> </include> <!-- Move base --> <arg name="custom_param_file" default="$(find turtlebot_navigation)/param/$(arg laser_type)_costmap_params.yaml"/> <include file="$(find turtlebot_navigation)/launch/includes/move_base.launch.xml"> </include> </launch>

此处<arg name="custom_param_file" default="$(find turtlebot_navigation)/param/$(arg laser_type)_costmap_params.yaml"/> 经测试有无均可,原因不明。

2、导航实现

1)上网本新开端口,打开roscore

复制代码
1
2
$ roscore

2)上网本新开端口,启动turtlebot

复制代码
1
2
$ roslaunch turtlebot_bringup minimal.launch

3)主机,新终端执行,启动amcl

复制代码
1
2
$ roslaunch turtlebot_navigation hokuyo_amcl_demo.launch map_file:=/home/yourname/map/hokuyo_map.yaml

这里/home/yourname/map/hokuyo_map.yaml是所建地图的.yaml文件所在的位置,需按个人情况改变

如果你看到 odom received! 说明已经正常运行。
过程中可能出现报错,原因不明,但是不影响正常运行。
在这里插入图片描述

4)新终端,启动rviz

复制代码
1
2
$ roslaunch turtlebot_rviz_launchers view_navigation.launch --screen

效果如下图:
在这里插入图片描述rviz应该公开展示你的地图。turtlebot不能够估计在启动姿态,尽管它可以在你初始化它的姿态。

选择“2D Pose Estimate”在地图上的turtlebot位置点击并按住。当你握着鼠标的时候,一个箭头会出现在鼠标指针的下方,用这个来估计它的方向。
在这里插入图片描述

设置后估计的姿态,选择“2D Nav Goal”,点击你想让turtlebot去的地方。您还可以指定一个目标方向,使用相同的技术如“2D Pose Estimate”。
在这里插入图片描述
urtlebot现在应该朝着你的目录自主前进。尝试指定一个目标,并走在前面,看看它如何反应的动态障碍。
当turtlebot到达指定地点之后,会显示,Goal reached.
在这里插入图片描述
rviz中会有一些错误出现,原因不明。

3、仍存在的问题

1)turtlebot目前在遇到动态障碍时,无法提前避障,需要撞上去,并需要较长的时间来寻找可以走的方向
2)目前turtlebot在导航过程中,rviz界面会出现机器人不断跳出再返回的情况
3)导航过程中出现的报错尚未解决,并不知道其对导航规程的影响
4)hokuyo_laser.launch中<arg name="custom_param_file" default="$(find turtlebot_navigation)/param/$(arg laser_type)_costmap_params.yaml"/> 作用尚不明晰

最后

以上就是繁荣季节最近收集整理的关于Ubuntu16.04+hokuyo(URG)实现amcl导航的全部内容,更多相关Ubuntu16内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(88)

评论列表共有 0 条评论

立即
投稿
返回
顶部