Slamtec / rplidar_ros

BSD 2-Clause "Simplified" License
497 stars 532 forks source link

[rplidar navigation] /scan topic comes from a camera node rather than the desired LiDAR node #99

Closed LightwishWONG closed 1 year ago

LightwishWONG commented 1 year ago

Hi guys. I'm trying to use a rplidar_a2 to run amcl navigation with my pre-built map on Turtlebot2, ROS Kinetic. Below is my amcl launch file:

<launch>
  <!-- Define laser type-->
  <arg name="laser_sensor" default="$(env TURTLEBOT_LASER_SENSOR)" />
  <!-- <arg name="laser_sensor" default="rplidar" /> -->

  <!-- laser driver -->
  <include file="$(find turtlebot_navigation)/laser/driver/$(arg laser_sensor)_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_sensor)_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_sensor)_costmap_params.yaml"/>
  <include file="$(find turtlebot_navigation)/launch/includes/rplidar_move_base.launch.xml">
    <arg name="custom_param_file" value="$(arg custom_param_file)"/>
  </include>

</launch>

where the "laser_sensor" is rplidar. But the weird thing is that when I ran this launch file, the /scan topic came from a camera node rather than the pre-defined rplidar node. Here is the rqt_graph. However, when I ran cartographer slam, the /scan topic was correctly published by the desired rplidarNode. I have no idea why this went wrong with the navigation. I don't even equip the turtlebot2 with a camera. Could someone explain how to fix it? I really appreciate your help!