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.12k stars 2.25k forks source link

use_imu_based option not expected in LocalTrajectoryBuilder2D #1932

Open elkuno213 opened 1 year ago

elkuno213 commented 1 year ago

Hello community,

I hope this message finds you well. I'm writing to report a potential issue with the use_imu_based option in LocalTrajectoryBuilder2D::InitializeExtrapolator:

void LocalTrajectoryBuilder2D::InitializeExtrapolator(const common::Time time) {
  if (extrapolator_ != nullptr) {
    return;
  }
  CHECK(!options_.pose_extrapolator_options().use_imu_based());
  // TODO(gaschler): Consider using InitializeWithImu as 3D does.
  extrapolator_ = absl::make_unique<PoseExtrapolator>(
      ::cartographer::common::FromSeconds(options_.pose_extrapolator_options()
                                              .constant_velocity()
                                              .pose_queue_duration()),
      options_.pose_extrapolator_options()
          .constant_velocity()
          .imu_gravity_time_constant());
  extrapolator_->AddPose(time, transform::Rigid3d::Identity());
}

Problem: It seems that the use_imu_based option or ImuBasedPoseExtrapolator is not expected in 2D. When passing this option as true in the configuration, the current codebase returns a false check.

Expected Behavior: When use_imu_based is set to true, a unique pointer of PoseExtrapolatorInterface should be intialized, so that users can choose to extrapolate pose by PoseExtrapolator or ImuBasedExtrapolator in 2D.

I see that there is a TODO for this behavior. If anyone is currently developing this feature or has insights into its progress, I would greatly appreciate any updates.

Thanks in advance.