< >
Home » ROS与SLAM入门教程 » ROS与SLAM入门教程-激光雷达(EAI F4)自主导航实现

ROS与SLAM入门教程-激光雷达(EAI F4)自主导航实现

ROS与SLAM入门教程-激光雷达(EAI F4)自主导航实现

说明:

  • 介绍利用激光雷达(EAI F4)实现自主导航

步骤:

完整建图:

配置:

  • 完成建图,可到地图比如:flashlidar_gmapping.pgm flashlidar_gmapping.yaml
  • 完整地址:
/home/nc/map/flashlidar_gmapping.yaml
  • 增加flashlidar_amcl_demo.launch
cd ~/catkin_ws/src/turtlebot_apps/turtlebot_navigation/launch
mkdir laser_amcl
cd laser_amcl
touch flashlidar_amcl_demo.launch
vim flashlidar_amcl_demo.launch
  • 代码如下:
<launch>
  <!-- Define laser type-->
  <arg name="laser_type" default="flashlidar" />

  <!-- 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">
    <arg name="custom_param_file" value="$(arg custom_param_file)"/>
  </include>

</launch>
  • 其中$(arg laser_type)_laser.launch$(arg laser_type)_amcl.launch.xml文件代码,查阅参考的文章。
  • 也可以参考github代码

测试:

  • 新终端,启动roscore
$ roscore 
  • 新终端,启动turtlebot
$ roslaunch turtlebot_bringup minimal.launch
  • 新终端,启动雷达
$ roslaunch turtlebot_navigation flashlidar_amcl_demo.launch
  • 新终端,启动导航
$ roslaunch turtlebot_navigation amcl_demo.launch map_file:=/home/nc/map/flashlidar_gmapping.yaml
  • 新终端,启动rviz
$ roslaunch turtlebot_rviz_launchers view_navigation.launch --screen

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: ros与slam入门教程