Skip to content

Commit

Permalink
Use trajectory IDs for global samplers. (cartographer-project#278)
Browse files Browse the repository at this point in the history
Related to cartographer-project#256.

PAIR=SirVer
  • Loading branch information
wohe committed May 11, 2017
1 parent 1a9b18d commit 32583e0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
6 changes: 3 additions & 3 deletions cartographer/mapping_2d/sparse_pose_graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ void SparsePoseGraph::AddScan(
: nullptr;

// Make sure we have a sampler for this trajectory.
if (!global_localization_samplers_[trajectory]) {
global_localization_samplers_[trajectory] =
if (!global_localization_samplers_[trajectory_id]) {
global_localization_samplers_[trajectory_id] =
common::make_unique<common::FixedRatioSampler>(
options_.global_sampling_ratio());
}
Expand Down Expand Up @@ -178,7 +178,7 @@ void SparsePoseGraph::ComputeConstraint(const int scan_index,

// Only globally match against submaps not in this trajectory.
if (scan_trajectory_id != submap_trajectory_id &&
global_localization_samplers_[scan_trajectory]->Pulse()) {
global_localization_samplers_[scan_trajectory_id]->Pulse()) {
constraint_builder_.MaybeAddGlobalConstraint(
submap_id, submap_states_[submap_index].submap, scan_index,
scan_trajectory_id, &trajectory_connectivity_,
Expand Down
3 changes: 1 addition & 2 deletions cartographer/mapping_2d/sparse_pose_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ class SparsePoseGraph : public mapping::SparsePoseGraph {
mapping::TrajectoryConnectivity trajectory_connectivity_ GUARDED_BY(mutex_);

// We globally localize a fraction of the scans from each trajectory.
std::unordered_map<const mapping::Submaps*,
std::unique_ptr<common::FixedRatioSampler>>
std::unordered_map<int, std::unique_ptr<common::FixedRatioSampler>>
global_localization_samplers_ GUARDED_BY(mutex_);

// Number of scans added since last loop closure.
Expand Down
6 changes: 3 additions & 3 deletions cartographer/mapping_3d/sparse_pose_graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ void SparsePoseGraph::AddScan(
insertion_submaps.front()->finished ? insertion_submaps.front() : nullptr;

// Make sure we have a sampler for this trajectory.
if (!global_localization_samplers_[trajectory]) {
global_localization_samplers_[trajectory] =
if (!global_localization_samplers_[trajectory_id]) {
global_localization_samplers_[trajectory_id] =
common::make_unique<common::FixedRatioSampler>(
options_.global_sampling_ratio());
}
Expand Down Expand Up @@ -178,7 +178,7 @@ void SparsePoseGraph::ComputeConstraint(const int scan_index,

// Only globally match against submaps not in this trajectory.
if (scan_trajectory_id != submap_trajectory_id &&
global_localization_samplers_[scan_trajectory]->Pulse()) {
global_localization_samplers_[scan_trajectory_id]->Pulse()) {
constraint_builder_.MaybeAddGlobalConstraint(
submap_id, submap_states_[submap_index].submap, scan_index,
scan_trajectory_id, &trajectory_connectivity_, trajectory_nodes_);
Expand Down
3 changes: 1 addition & 2 deletions cartographer/mapping_3d/sparse_pose_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ class SparsePoseGraph : public mapping::SparsePoseGraph {
mapping::TrajectoryConnectivity trajectory_connectivity_ GUARDED_BY(mutex_);

// We globally localize a fraction of the scans from each trajectory.
std::unordered_map<const mapping::Submaps*,
std::unique_ptr<common::FixedRatioSampler>>
std::unordered_map<int, std::unique_ptr<common::FixedRatioSampler>>
global_localization_samplers_ GUARDED_BY(mutex_);

// Number of scans added since last loop closure.
Expand Down

0 comments on commit 32583e0

Please sign in to comment.