cartographer-project / cartographer

Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.
Apache License 2.0
7.04k stars 2.24k forks source link

Problem with 2D Mapping #1828

Closed LukasBergs closed 3 years ago

LukasBergs commented 3 years ago

Hello!

At first I want to thank you for this awesome project!

I have a problem setting up the cartographer mapping in 2D mode. You can find the lua file, the launch file, the urdf file, two bagfiles and four videos showing my problem here: https://drive.google.com/drive/folders/115Xx8800KGs150rjlMGAqoAwBY6LZNZz?usp=sharing

The vehicle I use for mapping is a vehicle with the LiDAR/IMU attached to the rear of the vehicle. The LiDAR used has an integrated IMU. The LiDAR and thus the IMU are tilted up in pitch angle by about 20 degrees relative to the ground.
When starting the 2D offline mapping mode, the vehicle rotates around the pitch and roll angle. According to this, ground points are projected incorrectly to the ground plane. With this setup the mapping is almost unusable. I have recorded a video ("vehicle_tilted_imu_true.mp4") showing the described behavior. The bagfile (standstill.bag) was recorded without vehicle movement.
The rotation of the whole TF tree only occurs when the parameter TRAJECTORY_BUILDER_2D.use_imu data is set to true. If I set this parameter to false, there is no rotation in roll and pitch at the start of the bagfile. See the attached video "vehicle_tilted_imu_false.mp4".

Besides the bagfile without vehicle movement, I also uploaded a second bagfile with vehicle movement in google drive (driving.bag). If I do not set the parameter "use_odometry" to true, the map quality is really really bad. You can see this behavior in the video (mapping_2d_movement_odometry_false.mp4). If I set the parameter to true, the mapping process looks better, but since the point cloud is rotated, I am not able to create good maps (see: mapping_2d_movement_odometry_true.mp4).

Cartographer_rosbag_validate shows no issues. I guess that my problem is not a timing or a calibration problem, because the transformation between LiDAR and IMU are given by the manufacturer. Also, both sensors are timestamped identically.

We are planning to use Cartographer for several vehicles and need urgent help to solve this problem. I would be very grateful if you could take a look into the provided data!

Thanks in advance and best regards, Lukas

LukasBergs commented 3 years ago

Update:

I have been able to fix the problem of ground points being incorrectly projected onto the ground plane by inserting a new frame at the position of the IMU, which is rotated so that it is parallel to the ground plane. We have specified this frame as "tracking_frame" in the lua file.

The roll and pitch rotation at the beginning of each mapping ride have been caused by a constant offset in angular_velocity of the IMU. After correcting the IMU data, this error was also eliminated.

Thanks to everyone who looked into my problem. This issue can now be closed.
Lukas