• 在实现导航功能之前需要对当前环境进行建图,在所下载的HandsFree_ROS包中所包含的地图是我们实验室的地图。所以你需要首先对你所在的环境使用激光雷达构建2维地图。
  • 本节教程运行节点主要包含机器人抽象节点、激光节点、建图节点、遥控节点和可视化工具RVIZ.建议远程设置(如果IP有变化,请及时更改),将工控机作为MASTER,在工控机上运行前三个节点,遥控和可视化部分可以在自己笔记本上运行。

雷达建图

由于工控机不能区分雷达和主控板,开机后,一定要先插主控板(单片机)的USB,再将雷达的USB连接到工控机。

然后在工控机上运行以下节点,如果没有购买显示屏,可以远程登录到工控机再执行以下步骤:

1 机器人抽象节点:

roslaunch handsfree_hw handsfree_hw.launch

2 激光节点

如果使用rplidar

roslaunch rplidar_ros rplidar.launch

若雷达正常,运行结果为:

ROS_MASTER_URI=http://Robot:11311

core service [/rosout] found
process[rplidarNode-1]: started with pid [13154]
RPLIDAR running on ROS package rplidar_ros
SDK Version: 1.5.7
RPLIDAR S/N: E94F9DF1C3E39AC4C3E698F91998340D
Firmware Ver: 1.22
Hardware Rev: 4
RPLidar health status : 0

如果使用hokuyo:

roslaunch handsfree_bringup hokuyo.launch

3 建图节点:

roslaunch handsfree_2dnav move_base_gmapping.launch

此节点最后若显示odom received!,说明成功,结果如下图所示:

ROS_MASTER_URI=http://Robot:11311

core service [/rosout] found
process[slam_gmapping-1]: started with pid [4745]
process[move_base_node-2]: started with pid [4746]
[ INFO] [1517365860.923519401]: Laser is mounted upwards.
 -maxUrange 10 -maxUrange 7.99 -sigma     0.05 -kernelSize 1 -lstep 0.05 -lobsGain 3 -astep 0.05
 -srr 0.01 -srt 0.02 -str 0.01 -stt 0.02
 -linearUpdate 0.5 -angularUpdate 0.436 -resampleThreshold 0.5
 -xmin -10 -xmax 10 -ymin -10 -ymax 10 -delta 0.05 -particles 80
[ INFO] [1517365860.928967235]: Initialization complete
update frame 0
update ld=0 ad=0
Laser Pose= 0.2 0 0.00872684
m_count 0
Registering First Scan
[ INFO] [1517365860.951243104]: Loading from pre-hydro parameter style
[ INFO] [1517365861.066362253]: Using plugin "static_layer"
[ INFO] [1517365861.158384980]: Requesting the map...
[ INFO] [1517365861.369222983]: Resizing costmap to 384 X 384 at 0.050000 m/pix
[ INFO] [1517365861.469104329]: Received a 384 X 384 map at 0.050000 m/pix
[ INFO] [1517365861.480420849]: Using plugin "obstacle_layer"
[ INFO] [1517365861.486781418]:     Subscribed to Topics: scan
[ INFO] [1517365861.584362780]: Using plugin "inflation_layer"
[ INFO] [1517365861.763935771]: Loading from pre-hydro parameter style
[ INFO] [1517365861.865292781]: Using plugin "obstacle_layer"
[ INFO] [1517365861.895325429]:     Subscribed to Topics: scan
[ INFO] [1517365861.992368784]: Using plugin "inflation_layer"
[ INFO] [1517365862.163903294]: Created local_planner base_local_planner/TrajectoryPlannerROS
[ WARN] [1517365862.187241519]: /move_base_node/TrajectoryPlannerROS/acc_lim_th should be acc_lim_theta, this param will be removed in J-turtle
[ INFO] [1517365862.206900175]: Sim period is set to 0.14
[ WARN] [1517365862.233033827]: Trajectory Rollout planner initialized with param meter_scoring not set. Set it to true to make your settins robust against changes of costmap resolution.
[ INFO] [1517365862.927933769]: Recovery behavior will clear layer obstacles
[ INFO] [1517365862.973890805]: Recovery behavior will clear layer obstacles
[ INFO] [1517365863.084552712]: odom received!

4 利用RVIZ可视化建图过程

远程的计算机打开可视化工具RVIZ,直接打开终端输入指令,不需要远程登录操作:

rosrun rviz rviz

打开RVIZ之后,将软件全屏,鼠标移动到顶端左侧,选择file -> open config,手动选择handsfree/handsfree_2dnav/rviz/ HANDSFREE_Robot.rviz文件作为其配置文件。如果正常的话,可以在RVIZ中看到机器人模型及激光雷达扫描到的可视化数据。

picture

5 遥控节点:

启动键盘遥控节点:

roslaunch handsfree_hw keyboard_teleop.launch

利用键盘遥控机器人在准备导航的环境中缓慢移动,使RVIZ中显示的地图逐渐补全,直到将整个环境的地图建好为止。 当地图建好之后就要对地图进行保存。

6 保存地图:

在终端中打开想要保存地图的文件夹(建议保存在handsfree_2dnav/map中)

roscd handsfree_2dnav/map/

运行保存地图的节点:

rosrun map_server map_saver -f my_map

my_map名字可以按照自己的需求更改
此命令将生成将生成.pgm和.yaml两个文件。到此,建图过程完成。最终生成的我们实验室的地图:

Copyright © handsfree.org.cn 2017 all right reserved,powered by Gitbook该文件修订时间: 2018-02-02 07:22:38

results matching ""

    No results matching ""