Remove unused code and option for odometry states. (#451)

master
Wolfgang Hess 2017-08-11 17:38:48 +02:00 committed by GitHub
parent e79a918989
commit 11dbdf91b9
11 changed files with 9 additions and 145 deletions

View File

@ -199,10 +199,7 @@ void MapBuilder::LoadMap(io::ProtoStreamReader* const reader) {
unused_options.mutable_trajectory_builder_2d_options() unused_options.mutable_trajectory_builder_2d_options()
->mutable_submaps_options() ->mutable_submaps_options()
->set_resolution(0.05); ->set_resolution(0.05);
unused_options.mutable_trajectory_builder_2d_options() unused_options.mutable_trajectory_builder_3d_options();
->set_num_odometry_states(1);
unused_options.mutable_trajectory_builder_3d_options()
->set_num_odometry_states(1);
const std::unordered_set<string> unused_sensor_ids; const std::unordered_set<string> unused_sensor_ids;
const int map_trajectory_id = const int map_trajectory_id =

View File

@ -1,54 +0,0 @@
/*
* Copyright 2016 The Cartographer Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "cartographer/mapping/odometry_state_tracker.h"
#include "cartographer/transform/rigid_transform.h"
namespace cartographer {
namespace mapping {
OdometryState::OdometryState(const common::Time time,
const transform::Rigid3d& odometer_pose,
const transform::Rigid3d& state_pose)
: time(time), odometer_pose(odometer_pose), state_pose(state_pose) {}
OdometryStateTracker::OdometryStateTracker(const int window_size)
: window_size_(window_size) {
CHECK_GT(window_size, 0);
}
const OdometryStateTracker::OdometryStates&
OdometryStateTracker::odometry_states() const {
return odometry_states_;
}
void OdometryStateTracker::AddOdometryState(
const OdometryState& odometry_state) {
odometry_states_.push_back(odometry_state);
while (odometry_states_.size() > window_size_) {
odometry_states_.pop_front();
}
}
bool OdometryStateTracker::empty() const { return odometry_states_.empty(); }
const OdometryState& OdometryStateTracker::newest() const {
return odometry_states_.back();
}
} // namespace mapping
} // namespace cartographer

View File

@ -1,66 +0,0 @@
/*
* Copyright 2016 The Cartographer Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef CARTOGRAPHER_MAPPING_ODOMETRY_STATE_TRACKER_H_
#define CARTOGRAPHER_MAPPING_ODOMETRY_STATE_TRACKER_H_
#include <deque>
#include "cartographer/common/time.h"
#include "cartographer/transform/rigid_transform.h"
namespace cartographer {
namespace mapping {
struct OdometryState {
OdometryState(common::Time time, const transform::Rigid3d& odometer_pose,
const transform::Rigid3d& state_pose);
OdometryState() {}
common::Time time = common::Time::min();
transform::Rigid3d odometer_pose = transform::Rigid3d::Identity();
transform::Rigid3d state_pose = transform::Rigid3d::Identity();
};
// Keeps track of the odometry states by keeping sliding window over some
// number of them.
class OdometryStateTracker {
public:
using OdometryStates = std::deque<OdometryState>;
explicit OdometryStateTracker(int window_size);
const OdometryStates& odometry_states() const;
// Adds a new 'odometry_state' and makes sure the maximum number of previous
// odometry states is not exceeded.
void AddOdometryState(const OdometryState& odometry_state);
// Returns true if no elements are present in the odometry queue.
bool empty() const;
// Retrieves the most recent OdometryState. Must not be called when empty.
const OdometryState& newest() const;
private:
OdometryStates odometry_states_;
size_t window_size_;
};
} // namespace mapping
} // namespace cartographer
#endif // CARTOGRAPHER_MAPPING_ODOMETRY_STATE_TRACKER_H_

View File

@ -56,9 +56,6 @@ proto::LocalTrajectoryBuilderOptions CreateLocalTrajectoryBuilderOptions(
parameter_dictionary->GetDictionary("motion_filter").get()); parameter_dictionary->GetDictionary("motion_filter").get());
options.set_imu_gravity_time_constant( options.set_imu_gravity_time_constant(
parameter_dictionary->GetDouble("imu_gravity_time_constant")); parameter_dictionary->GetDouble("imu_gravity_time_constant"));
options.set_num_odometry_states(
parameter_dictionary->GetNonNegativeInt("num_odometry_states"));
CHECK_GT(options.num_odometry_states(), 0);
*options.mutable_submaps_options() = CreateSubmapsOptions( *options.mutable_submaps_options() = CreateSubmapsOptions(
parameter_dictionary->GetDictionary("submaps").get()); parameter_dictionary->GetDictionary("submaps").get());
options.set_use_imu_data(parameter_dictionary->GetBool("use_imu_data")); options.set_use_imu_data(parameter_dictionary->GetBool("use_imu_data"));

View File

@ -61,9 +61,6 @@ message LocalTrajectoryBuilderOptions {
// constant is increased) is balanced. // constant is increased) is balanced.
optional double imu_gravity_time_constant = 17; optional double imu_gravity_time_constant = 17;
// Maximum number of previous odometry states to keep.
optional int32 num_odometry_states = 18;
optional mapping_2d.proto.SubmapsOptions submaps_options = 11; optional mapping_2d.proto.SubmapsOptions submaps_options = 11;
// True if IMU data should be expected and used. // True if IMU data should be expected and used.

View File

@ -59,9 +59,6 @@ proto::LocalTrajectoryBuilderOptions CreateLocalTrajectoryBuilderOptions(
parameter_dictionary->GetDictionary("motion_filter").get()); parameter_dictionary->GetDictionary("motion_filter").get());
options.set_imu_gravity_time_constant( options.set_imu_gravity_time_constant(
parameter_dictionary->GetDouble("imu_gravity_time_constant")); parameter_dictionary->GetDouble("imu_gravity_time_constant"));
options.set_num_odometry_states(
parameter_dictionary->GetNonNegativeInt("num_odometry_states"));
CHECK_GT(options.num_odometry_states(), 0);
*options.mutable_submaps_options() = mapping_3d::CreateSubmapsOptions( *options.mutable_submaps_options() = mapping_3d::CreateSubmapsOptions(
parameter_dictionary->GetDictionary("submaps").get()); parameter_dictionary->GetDictionary("submaps").get());
return options; return options;

View File

@ -92,7 +92,6 @@ class LocalTrajectoryBuilderTest : public ::testing::Test {
}, },
imu_gravity_time_constant = 1., imu_gravity_time_constant = 1.,
num_odometry_states = 1,
submaps = { submaps = {
high_resolution = 0.2, high_resolution = 0.2,

View File

@ -22,6 +22,7 @@ import "cartographer/mapping_2d/scan_matching/proto/real_time_correlative_scan_m
import "cartographer/mapping_3d/proto/submaps_options.proto"; import "cartographer/mapping_3d/proto/submaps_options.proto";
import "cartographer/mapping_3d/scan_matching/proto/ceres_scan_matcher_options.proto"; import "cartographer/mapping_3d/scan_matching/proto/ceres_scan_matcher_options.proto";
// NEXT ID: 17
message LocalTrajectoryBuilderOptions { message LocalTrajectoryBuilderOptions {
// Rangefinder points outside these ranges will be dropped. // Rangefinder points outside these ranges will be dropped.
optional float min_range = 1; optional float min_range = 1;
@ -58,8 +59,5 @@ message LocalTrajectoryBuilderOptions {
// constant is increased) is balanced. // constant is increased) is balanced.
optional double imu_gravity_time_constant = 15; optional double imu_gravity_time_constant = 15;
// Maximum number of previous odometry states to keep.
optional int32 num_odometry_states = 16;
optional SubmapsOptions submaps_options = 8; optional SubmapsOptions submaps_options = 8;
} }

View File

@ -54,7 +54,6 @@ TRAJECTORY_BUILDER_2D = {
}, },
imu_gravity_time_constant = 10., imu_gravity_time_constant = 10.,
num_odometry_states = 1000,
submaps = { submaps = {
resolution = 0.05, resolution = 0.05,

View File

@ -60,7 +60,6 @@ TRAJECTORY_BUILDER_3D = {
}, },
imu_gravity_time_constant = 10., imu_gravity_time_constant = 10.,
num_odometry_states = 1,
submaps = { submaps = {
high_resolution = 0.10, high_resolution = 0.10,

View File

@ -88,6 +88,9 @@ cartographer.mapping_2d.proto.LocalTrajectoryBuilderOptions trajectory_builder_2
cartographer.mapping_3d.proto.LocalTrajectoryBuilderOptions trajectory_builder_3d_options cartographer.mapping_3d.proto.LocalTrajectoryBuilderOptions trajectory_builder_3d_options
Not yet documented. Not yet documented.
bool pure_localization
Not yet documented.
cartographer.mapping.sparse_pose_graph.proto.ConstraintBuilderOptions cartographer.mapping.sparse_pose_graph.proto.ConstraintBuilderOptions
===================================================================== =====================================================================
@ -182,6 +185,10 @@ float max_z
float missing_data_ray_length float missing_data_ray_length
Points beyond 'max_range' will be inserted with this length as empty space. Points beyond 'max_range' will be inserted with this length as empty space.
int32 scans_per_accumulation
Number of scans to accumulate into one unwarped, combined scan to use for
scan matching.
float voxel_filter_size float voxel_filter_size
Voxel filter that gets applied to the range data immediately after Voxel filter that gets applied to the range data immediately after
cropping. cropping.
@ -210,9 +217,6 @@ double imu_gravity_time_constant
2. from integration of angular velocities (which gets worse when the 2. from integration of angular velocities (which gets worse when the
constant is increased) is balanced. constant is increased) is balanced.
int32 num_odometry_states
Maximum number of previous odometry states to keep.
cartographer.mapping_2d.proto.SubmapsOptions submaps_options cartographer.mapping_2d.proto.SubmapsOptions submaps_options
Not yet documented. Not yet documented.
@ -345,9 +349,6 @@ double imu_gravity_time_constant
2. from integration of angular velocities (which gets worse when the 2. from integration of angular velocities (which gets worse when the
constant is increased) is balanced. constant is increased) is balanced.
int32 num_odometry_states
Maximum number of previous odometry states to keep.
cartographer.mapping_3d.proto.SubmapsOptions submaps_options cartographer.mapping_3d.proto.SubmapsOptions submaps_options
Not yet documented. Not yet documented.