0
$\begingroup$

Rosanswers logo

Hey, I have tried for a while now to get my Lidar setup to work with Cartographer ROS, with mixed results. I am using 2D lidar exclusively (Hokuyo ust-10lx, no imu).

My current launch files:

<launch>
  <param name="/use_sim_time" value="true" />

  <include file="$(find cartographer_ros)/launch/backpack_2d.launch" />

  <node name="rviz" pkg="rviz" type="rviz" required="true"
      args="-d $(find cartographer_ros)/configuration_files/demo_2d.rviz" />
  <node name="playbag" pkg="rosbag" type="play"
      args="--clock $(arg bag_filename)" />
    <param name="frame_id" value="/base_link"/>
</launch>
<launch>
  <param name="robot_description"
    textfile="$(find cartographer_ros)/urdf/backpack_2d.urdf" />

  <node name="robot_state_publisher" pkg="robot_state_publisher"
    type="robot_state_publisher" />

  <node name="cartographer_node" pkg="cartographer_ros"
      type="cartographer_node" args="
          -configuration_directory $(find cartographer_ros)/configuration_files
          -configuration_basename my_robot.lua"
      output="screen">
    <remap from="echoes" to="horizontal_laser_2d" />
  </node>

  <node name="cartographer_occupancy_grid_node" pkg="cartographer_ros"
      type="cartographer_occupancy_grid_node" args="-resolution 0.05" />
</launch>

and my current lua file:

options = {
      map_builder = MAP_BUILDER,
      trajectory_builder = TRAJECTORY_BUILDER,
      map_frame = "map",
      tracking_frame = "base_link",
      published_frame = "base_link",
      odom_frame = "odom",
      provide_odom_frame = true,
      publish_frame_projected_to_2d = false,
      use_odometry = false,
      use_nav_sat = false,
      use_landmarks = false,
      num_laser_scans = 1,
      num_multi_echo_laser_scans = 0,
      num_subdivisions_per_laser_scan = 1, --10
      num_point_clouds = 0,
      lookup_transform_timeout_sec = 0.2,
      submap_publish_period_sec = 0.3,
      pose_publish_period_sec = 5e-3,
      trajectory_publish_period_sec = 30e-3,
      rangefinder_sampling_ratio = 1.,
      odometry_sampling_ratio = 1.,
      fixed_frame_pose_sampling_ratio = 1.,
      imu_sampling_ratio = 1.,
      landmarks_sampling_ratio = 1.,
    }
    
    MAP_BUILDER.use_trajectory_builder_2d = true
    TRAJECTORY_BUILDER_2D.num_accumulated_range_data = 1081
    TRAJECTORY_BUILDER_2D.use_imu_data = false;

The rosbag that I am using is (only contains topic laserScan /scan (fixed_frame = base_link): 1: https://1drv.ms/u/s!AlYv1byT4VoNgySe8gF8ibUl_kam This one gives no visual results at all 2: https://1drv.ms/u/s!AlYv1byT4VoNgyUujvs13GrZW0a5 This one gives the result shown below The only difference between the two bags is that the Lidar moves in the first one but remains at the same position in the second one.

When run, cartographer does not give any errors in the terminal, but both submaps and constraints are missing frame map. Pictures of result, rqt_graph and rqt_tf_tree:

If I change the fixed frame name from base_link to map, both the RobotModel and the global status give errors as they require base_link to be present.

My question: What am I missing in my tf connections/cartographer settings?


Originally posted by D.Schalk on ROS Answers with karma: 3 on 2020-05-12

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Do you have return options at the end of your lua file?

Edit: This seems too high. TRAJECTORY_BUILDER_2D.num_accumulated_range_data = 1081 Set it to e.g. TRAJECTORY_BUILDER_2D.num_accumulated_range_data = 1 and it worked for me in Gazebo. I believe this is the number of messages you want to accumulate for a full "revolution" of the scanner.


Originally posted by bob-ROS with karma: 525 on 2020-05-12

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by D.Schalk on 2020-05-13:
Yes I have

Comment by D.Schalk on 2020-05-29:
I still have not found an answer

Comment by bob-ROS on 2020-05-30:
Updating my answer

Comment by D.Schalk on 2020-06-01:
That was indeed the problem! Both rosbags with scan data from a stationary and moving car create a map. Thank you very much

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.