How the lua configuration file should be set in cartographer ros?

asked 2022-01-24 15:36:08 -0500

sincoy gravatar image

updated 2022-01-24 15:38:10 -0500

Hello ROS developers,

I have a problem with the lua configuration. Could you please help me to solve the issue?

My tree after "rosrun tf2_tools view_frames.py" is like the following: map -> odom -> base_footprint (from gazebo) -> base_link -> ...

But if I am using teleop to map the environment, there is something wrong. I hope that you can help me

include "map_builder.lua"
include "trajectory_builder.lua"

options = {
  map_builder = MAP_BUILDER,
  trajectory_builder = TRAJECTORY_BUILDER,
  map_frame = "map",
  tracking_frame = "base_link", 
  published_frame = "odom",
  odom_frame = "odom",
  provide_odom_frame = false,
  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,
  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.min_range = 0.1
TRAJECTORY_BUILDER_2D.max_range = 20.0
TRAJECTORY_BUILDER_2D.missing_data_ray_length = 3.
TRAJECTORY_BUILDER_2D.use_imu_data = false
TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true
TRAJECTORY_BUILDER_2D.motion_filter.max_angle_radians = math.rad(0.1)

POSE_GRAPH.constraint_builder.min_score = 0.65
POSE_GRAPH.constraint_builder.global_localization_min_score = 0.7

return options

Thank you very much!

edit retag flag offensive close merge delete

Comments

Have you read the cartographer_rosdocumentation? As mentioned there:

If you can’t get Cartographer to work reliably on your data, you can open a GitHub issue asking for help.

Wherever you go for help, please explain what makes you say "there is something wrong." If there are error/warning messages, copy and paste them. If the behavior isn't what you expect, describe what you expect and what is happening, and provide pictures if possible.

tryan gravatar image tryan  ( 2022-01-25 09:21:36 -0500 )edit

Thank you for your reply! I have done an investigation to find out why the problem might be occurring. For this I used gmapping on the one hand and cartographer on the other. I found out that with gmapping the frame "map" is fixed in the world compared to cartographer. The frame "map" moves with the robot in cartographer.

With gmapping the map frame is fixed and nearby is the odom frame. But with cartographer, the map frame moves in the same direction as the robot and the odom frame moves in the opposite direction.

sincoy gravatar image sincoy  ( 2022-01-25 13:49:14 -0500 )edit

Sorry for taking so long to reply. That does sound odd, and I have not had that happen. Can you post the picture of your tf tree? If you're using RViz, make sure the fixed frame is set to map in both cases.

tryan gravatar image tryan  ( 2022-01-31 20:08:57 -0500 )edit