Using cartographer with merged scan from ira_laser_tools

asked 2021-01-18 09:58:40 -0500

Jose Susa gravatar image

I am trying to use cartographer with one merged laser from ira_laser_tools using the laserscan_multi_merger. Melodic distribution.

Cartographer works fine when I use one of my scan topics (e.g. f_scan), I can create a map, when I move the robot in gazebo, it moves in rviz and the map updates correctly on rviz. However, when I try to use the merged scan topic coming from laserscan-multi_merger, then the robot moves in gazebo but it doesnt move in rviz. I select map as the fix frame, and the laser scan points moves in rviz but the model does not.

This is my setup:

<node pkg="ira_laser_tools" name="laserscan_multi_merger" type="laserscan_multi_merger" output="screen">
<param name="destination_frame" value="base_link"/>
<param name="cloud_destination_topic" value="/merged_cloud"/>
<param name="scan_destination_topic" value="/scan_multi"/>
<param name="laserscan_topics" value =" /f_scan /b_scan /cloud_to_scan" /> 
<param name="angle_min" value="-1"/>
<param name="angle_max" value="1"/>
<param name="angle_increment" value="0.00872662942857"/>
<param name="scan_time" value="0.0"/>
<param name="range_min" value="0.0500000007451"/>
<param name="range_max" value="20.0"/>


For cartographer:

options = {

map_builder = MAP_BUILDER,
  trajectory_builder = TRAJECTORY_BUILDER,
  map_frame = "map",
  tracking_frame = "imu_frame",
  published_frame = "base_footprint",
  odom_frame = "odom_carto",
  provide_odom_frame = false,
  publish_frame_projected_to_2d = false,
  use_odometry = false,
  use_nav_sat = false,
  use_landmarks = false,
  publish_frame_projected_to_2d = false,
  num_laser_scans = 1,
  num_multi_echo_laser_scans = 0,
  lookup_transform_timeout_sec = 0.2,
  submap_publish_period_sec = 0.3,
  pose_publish_period_sec = 5e-3,
  num_subdivisions_per_laser_scan = 1,
  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 = 2

TRAJECTORY_BUILDER_2D.min_range = 0.3
TRAJECTORY_BUILDER_2D.missing_data_ray_length = 2.
TRAJECTORY_BUILDER_2D.use_imu_data = true
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.translation_weight = 10
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.rotation_weight = 15

POSE_GRAPH.constraint_builder.fast_correlative_scan_matcher.angular_search_window = math.rad(15.)
POSE_GRAPH.constraint_builder.fast_correlative_scan_matcher.linear_search_window = 3.

POSE_GRAPH.optimization_problem.huber_scale = 1e2

-----------------TUNE THESE PARAMETERS FOR LOW LATENCY-------------------------------

------------Global SLAM------------
POSE_GRAPH.optimize_every_n_nodes = 100 -- Decrease
POSE_GRAPH.global_sampling_ratio = 0.003 -- Decrease
POSE_GRAPH.constraint_builder.sampling_ratio = 0.4 -- Decrease
POSE_GRAPH.constraint_builder.min_score = 0.85 -- Increase
POSE_GRAPH.global_constraint_search_after_n_seconds = 30 -- Increase

---------Global/Local SLAM---------
TRAJECTORY_BUILDER_2D.submaps.num_range_data = 100 -- Decrease
TRAJECTORY_BUILDER_2D.max_range = 10. -- Decrease

and I run it like this:

<node name="cartographer_node" pkg="cartographer_ros"
      type="cartographer_node" args="
              $(find adir_gazebo)/config
          -configuration_basename mir.lua"
    <remap from="imu" to="imu_data" />
    <!--<remap from="odom" to="odom/filtered" /> -->
    <remap from="scan" to="scan_multi" />

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

 <node pkg="rviz" type="rviz" name="rviz" args="-d $(find adir_gazebo)/rviz/load_maps_lasers.rviz"></node>

Something that I don't understand is why the same configuration works when using the laser mounted on the robot, the robot moves in gazebo and moves in rviz. But as soon as I use the input laser scan for cartographer to the merged laser then the odometry, and baselink, and other model's TFs are stuck with the Map TF, so that is why even when the robot is moving in gazebo the robot does not move in rviz.

I read somewhere that there is a package called ros_blessed to check the TF communication but ... (more)

edit retag flag offensive close merge delete