-2

result Map

No matter how I move the radar, the position of the radar that rviz shows don't change.

Why is this happening? Do I need to add odom information to it?

I want the radar position on the map to change as the radar position changes

.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_pose_extrapolator = true,
  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.submaps.num_range_data = 30
TRAJECTORY_BUILDER_2D.use_imu_data = false
TRAJECTORY_BUILDER_2D.num_accumulated_range_data = 1
POSE_GRAPH.optimization_problem.huber_scale = 1e2
POSE_GRAPH.constraint_builder.min_score = 0.65

.launch file:

<launch>
<param name="robot_description"
  textfile="$(find cartographer_ros)/urdf/car.urdf" />
<param name="/use_sim_time" value="false" />
<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 myLds.lua"
  output="screen">
<remap from="scan" to="/scangkw" />
</node>
<node name="cartographer_occupancy_grid_node" pkg="cartographer_ros"
  type="cartographer_occupancy_grid_node" args="-resolution 0.05" />
</launch>
  • Can you please fix the formatting of your post? You can see [/help/formatting](/help/formatting) and also [/editing-help](/editing-help) for help on how to do so. – starball Jan 30 '23 at 03:26
  • In addition, remove non-related flag such as C and python please. You should put the lua flag instead. – Ximaz Jan 30 '23 at 09:38

1 Answers1

0

Check the frame that your radar is publishing data on. Is the frame the same as base_link? If not, set the frame name that the radar is providing to be equal to the tracking_frame in the .lua configuration file.

If you do not want to do this and keep the original configuration, provide a static_transform_publisher which provides the transform between the radar frame and the base_link.

What may be happening here is that your radar is providing data on a different frame, while your cartographer is set up to accept data with position at the base_link frame.

A-T
  • 342
  • 2
  • 14
  • Thank you for your answer. I have found the problem. It is my radar data. – Pircaptain Feb 20 '23 at 08:57
  • @Pircaptain I'm glad this was of help. Please mark the answer as Accepted so the question can be marked as Resolved. – A-T Feb 21 '23 at 16:16