25 namespace mapping_2d {
28 const proto::LocalTrajectoryBuilderOptions& options)
31 motion_filter_(
options_.motion_filter_options()),
33 options_.real_time_correlative_scan_matcher_options()),
35 odometry_state_tracker_(
options_.num_odometry_states()) {}
47 for (
const Eigen::Vector3f&
hit : range_data.
returns) {
48 const float range = (hit - range_data.
origin).norm();
51 returns_and_misses.returns.push_back(hit);
53 returns_and_misses.misses.push_back(
55 (hit - range_data.
origin).normalized());
81 options_.adaptive_voxel_filter_options());
83 adaptive_voxel_filter.
Filter(range_data_in_tracking_2d.
returns);
84 if (
options_.use_online_correlative_scan_matching()) {
86 pose_prediction_2d, filtered_point_cloud_in_tracking_2d,
87 probability_grid, &initial_ceres_pose);
91 ceres::Solver::Summary summary;
93 filtered_point_cloud_in_tracking_2d,
94 probability_grid, &tracking_2d_to_map, &summary);
100 std::unique_ptr<LocalTrajectoryBuilder::InsertionResult>
111 LOG(INFO) <<
"ImuTracker not yet initialized.";
125 Eigen::Quaterniond(Eigen::AngleAxisd(
133 if (range_data_in_tracking_2d.returns.empty()) {
134 LOG(WARNING) <<
"Dropped empty horizontal range data.";
138 ScanMatch(time, pose_prediction, tracking_to_tracking_2d,
171 tracking_2d_to_map.cast<
float>())};
181 std::vector<const mapping::Submap*> insertion_submaps;
183 insertion_submaps.push_back(
submaps_.
Get(insertion_index));
190 time, matching_submap, insertion_submaps, tracking_to_tracking_2d,
191 range_data_in_tracking_2d, pose_estimate_2d});
201 const Eigen::Vector3d& angular_velocity) {
202 CHECK(
options_.use_imu_data()) <<
"An unexpected IMU packet was added.";
206 imu_tracker_->AddImuLinearAccelerationObservation(linear_acceleration);
207 imu_tracker_->AddImuAngularVelocityObservation(angular_velocity);
214 LOG(INFO) <<
"ImuTracker not yet initialized.";
222 previous_odometry_state.odometer_pose.
inverse() * odometer_pose;
224 previous_odometry_state.state_pose * delta;
233 imu_tracker_ = common::make_unique<mapping::ImuTracker>(
240 CHECK_LE(
time_, time);
243 if (
time_ > common::Time::min()) {
246 const Eigen::Vector3d translation =
252 const Eigen::Quaterniond rotation =
255 Eigen::Vector3d::UnitZ()) *
sensor::RangeData TransformAndFilterRangeData(const transform::Rigid3f &tracking_to_tracking_2d, const sensor::RangeData &range_data) const
proto::RangeDataInserterOptions options_
PointCloud TransformPointCloud(const PointCloud &point_cloud, const transform::Rigid3f &transform)
const mapping::GlobalTrajectoryBuilderInterface::PoseEstimate & pose_estimate() const
~LocalTrajectoryBuilder()
std::unique_ptr< RealTimeCorrelativeScanMatcher > real_time_correlative_scan_matcher_
bool IsSimilar(common::Time time, const transform::Rigid3d &pose)
void AddOdometryState(const OdometryState &odometry_state)
void ScanMatch(common::Time time, const transform::Rigid3d &pose_prediction, const transform::Rigid3d &tracking_to_tracking_2d, const sensor::RangeData &range_data_in_tracking_2d, transform::Rigid3d *pose_observation)
scan_matching::CeresScanMatcher ceres_scan_matcher_
PointCloud VoxelFiltered(const PointCloud &point_cloud, const float size)
transform::Rigid3d odometry_correction_
mapping::OdometryStateTracker odometry_state_tracker_
std::vector< int > insertion_indices() const
transform::Rigid3d state_pose
const Submap * Get(int index) const override
UniversalTimeScaleClock::time_point Time
mapping_3d::MotionFilter motion_filter_
mapping::GlobalTrajectoryBuilderInterface::PoseEstimate last_pose_estimate_
const OdometryState & newest() const
RangeData TransformRangeData(const RangeData &range_data, const transform::Rigid3f &transform)
std::unique_ptr< InsertionResult > AddHorizontalRangeData(common::Time, const sensor::RangeData &range_data)
PointCloud Filter(const PointCloud &point_cloud) const
void AddOdometerData(common::Time time, const transform::Rigid3d &pose)
int matching_index() const
scan_matching::RealTimeCorrelativeScanMatcher real_time_correlative_scan_matcher_
std::vector< Eigen::Vector3f > PointCloud
void AddImuData(common::Time time, const Eigen::Vector3d &linear_acceleration, const Eigen::Vector3d &angular_velocity)
transform::Rigid3d odometer_pose
common::Time last_scan_match_time_
void Match(const transform::Rigid2d &previous_pose, const transform::Rigid2d &initial_pose_estimate, const sensor::PointCloud &point_cloud, const ProbabilityGrid &probability_grid, transform::Rigid2d *pose_estimate, ceres::Solver::Summary *summary) const
double ToSeconds(const Duration duration)
double Match(const transform::Rigid2d &initial_pose_estimate, const sensor::PointCloud &point_cloud, const ProbabilityGrid &probability_grid, transform::Rigid2d *pose_estimate) const
LocalTrajectoryBuilder(const proto::LocalTrajectoryBuilderOptions &options)
transform::Rigid3d pose_estimate_
void Predict(common::Time time)
Eigen::Vector2d velocity_estimate_
void InitializeImuTracker(common::Time time)
void InsertRangeData(const sensor::RangeData &range_data)
RangeData CropRangeData(const RangeData &range_data, const float min_z, const float max_z)
std::unique_ptr< mapping::ImuTracker > imu_tracker_
const proto::LocalTrajectoryBuilderOptions options_
std::unique_ptr< Submaps > submaps_
std::unique_ptr< CeresScanMatcher > ceres_scan_matcher_