From 01a3067682d5876ad175215143bb894dd938b79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Or=C5=A1uli=C4=87?= Date: Thu, 17 Jan 2019 20:21:23 +0100 Subject: [PATCH 1/3] Save map builder options in options proto. Rename it to BuilderOptions. --- cartographer/cloud/client/map_builder_stub.cc | 9 ++-- cartographer/cloud/client/map_builder_stub.h | 2 +- .../cloud/internal/client_server_test.cc | 49 +++++++++---------- .../internal/mapping_state_serialization.cc | 31 ++++++------ .../io/internal/mapping_state_serialization.h | 3 +- cartographer/io/internal/pbstream_info.cc | 8 ++- cartographer/io/proto_stream_deserializer.cc | 14 +++--- cartographer/io/proto_stream_deserializer.h | 7 ++- .../io/proto_stream_deserializer_test.cc | 14 +++--- .../io/serialization_format_migration.cc | 10 ++-- .../io/serialization_format_migration.h | 2 +- .../io/serialization_format_migration_test.cc | 8 +-- .../internal/testing/mock_map_builder.h | 29 ++++++----- cartographer/mapping/map_builder.cc | 41 +++++++++------- cartographer/mapping/map_builder.h | 36 +++++++------- cartographer/mapping/map_builder_interface.h | 2 +- .../mapping/proto/serialization.proto | 9 +++- .../proto/trajectory_builder_options.proto | 4 -- 18 files changed, 142 insertions(+), 136 deletions(-) diff --git a/cartographer/cloud/client/map_builder_stub.cc b/cartographer/cloud/client/map_builder_stub.cc index 6ff455045f..8015557b90 100644 --- a/cartographer/cloud/client/map_builder_stub.cc +++ b/cartographer/cloud/client/map_builder_stub.cc @@ -88,7 +88,7 @@ int MapBuilderStub::AddTrajectoryBuilder( int MapBuilderStub::AddTrajectoryForDeserialization( const mapping::proto::TrajectoryBuilderOptionsWithSensorIds& - options_with_sensor_ids_proto) { + trajectory_builder_options_with_sensor_ids_proto) { LOG(FATAL) << "Not implemented"; } @@ -197,12 +197,11 @@ std::map MapBuilderStub::LoadState( request.set_load_frozen_state(load_frozen_state); CHECK(client.Write(request)); } - // Request with an AllTrajectoryBuilderOptions should be third. + // Request with BuilderOptions should be third. { proto::LoadStateRequest request; - *request.mutable_serialized_data() - ->mutable_all_trajectory_builder_options() = - deserializer.all_trajectory_builder_options(); + *request.mutable_serialized_data()->mutable_builder_options() = + deserializer.builder_options(); request.set_load_frozen_state(load_frozen_state); CHECK(client.Write(request)); } diff --git a/cartographer/cloud/client/map_builder_stub.h b/cartographer/cloud/client/map_builder_stub.h index 5ccfb3a88c..57f11df182 100644 --- a/cartographer/cloud/client/map_builder_stub.h +++ b/cartographer/cloud/client/map_builder_stub.h @@ -41,7 +41,7 @@ class MapBuilderStub : public mapping::MapBuilderInterface { LocalSlamResultCallback local_slam_result_callback) override; int AddTrajectoryForDeserialization( const mapping::proto::TrajectoryBuilderOptionsWithSensorIds& - options_with_sensor_ids_proto) override; + trajectory_builder_options_with_sensor_ids_proto) override; mapping::TrajectoryBuilderInterface* GetTrajectoryBuilder( int trajectory_id) const override; void FinishTrajectory(int trajectory_id) override; diff --git a/cartographer/cloud/internal/client_server_test.cc b/cartographer/cloud/internal/client_server_test.cc index 90c2dd7f46..d2f5b391f4 100644 --- a/cartographer/cloud/internal/client_server_test.cc +++ b/cartographer/cloud/internal/client_server_test.cc @@ -63,9 +63,10 @@ constexpr char kPoseGraphProtoString[] = R"(pose_graph { submap: {} } })"; -constexpr char kAllTrajectoryBuilderOptionsProtoString[] = - R"(all_trajectory_builder_options { - options_with_sensor_ids: {} +constexpr char kBuilderOptionsProtoString[] = + R"(builder_options { + trajectory_builder_options_with_sensor_ids: {} + map_builder_options: {} })"; constexpr char kSubmapProtoString[] = "submap {}"; constexpr char kNodeProtoString[] = "node {}"; @@ -637,17 +638,16 @@ TEST_P(ClientServerTestByGridType, LoadStateAndDelete) { InitializeStub(); // Load text proto into in_memory_reader. - auto reader = - ProtoReaderFromStrings(kSerializationHeaderProtoString, - { - kPoseGraphProtoString, - kAllTrajectoryBuilderOptionsProtoString, - kSubmapProtoString, - kNodeProtoString, - kImuDataProtoString, - kOdometryDataProtoString, - kLandmarkDataProtoString, - }); + auto reader = ProtoReaderFromStrings(kSerializationHeaderProtoString, + { + kPoseGraphProtoString, + kBuilderOptionsProtoString, + kSubmapProtoString, + kNodeProtoString, + kImuDataProtoString, + kOdometryDataProtoString, + kLandmarkDataProtoString, + }); auto trajectory_remapping = stub_->LoadState(reader.get(), true); int expected_trajectory_id = 0; @@ -676,17 +676,16 @@ TEST_P(ClientServerTestByGridType, LoadUnfrozenStateAndDelete) { InitializeStub(); // Load text proto into in_memory_reader. - auto reader = - ProtoReaderFromStrings(kSerializationHeaderProtoString, - { - kPoseGraphProtoString, - kAllTrajectoryBuilderOptionsProtoString, - kSubmapProtoString, - kNodeProtoString, - kImuDataProtoString, - kOdometryDataProtoString, - kLandmarkDataProtoString, - }); + auto reader = ProtoReaderFromStrings(kSerializationHeaderProtoString, + { + kPoseGraphProtoString, + kBuilderOptionsProtoString, + kSubmapProtoString, + kNodeProtoString, + kImuDataProtoString, + kOdometryDataProtoString, + kLandmarkDataProtoString, + }); auto trajectory_remapping = stub_->LoadState(reader.get(), false /* load_frozen_state */); diff --git a/cartographer/io/internal/mapping_state_serialization.cc b/cartographer/io/internal/mapping_state_serialization.cc index a34c8678a9..b41e790fde 100644 --- a/cartographer/io/internal/mapping_state_serialization.cc +++ b/cartographer/io/internal/mapping_state_serialization.cc @@ -28,17 +28,18 @@ using mapping::SubmapId; using mapping::TrajectoryNode; using mapping::proto::SerializedData; -mapping::proto::AllTrajectoryBuilderOptions -CreateAllTrajectoryBuilderOptionsProto( +mapping::proto::BuilderOptions CreateBuilderOptionsProto( const std::vector& - all_options_with_sensor_ids, + all_trajectory_builder_options_with_sensor_ids, + const mapping::proto::MapBuilderOptions& map_builder_options, const std::vector& trajectory_ids_to_serialize) { - mapping::proto::AllTrajectoryBuilderOptions all_options_proto; + mapping::proto::BuilderOptions builder_options_proto; for (auto id : trajectory_ids_to_serialize) { - *all_options_proto.add_options_with_sensor_ids() = - all_options_with_sensor_ids[id]; + *builder_options_proto.add_trajectory_builder_options_with_sensor_ids() = + all_trajectory_builder_options_with_sensor_ids[id]; } - return all_options_proto; + *builder_options_proto.mutable_map_builder_options() = map_builder_options; + return builder_options_proto; } // Will return all trajectory ids, that have `state != DELETED`. @@ -67,14 +68,15 @@ SerializedData SerializePoseGraph(const mapping::PoseGraph& pose_graph, return proto; } -SerializedData SerializeTrajectoryBuilderOptions( +SerializedData SerializeBuilderOptions( const std::vector& trajectory_builder_options, + const mapping::proto::MapBuilderOptions& map_builder_options, const std::vector& trajectory_ids_to_serialize) { SerializedData proto; - *proto.mutable_all_trajectory_builder_options() = - CreateAllTrajectoryBuilderOptionsProto(trajectory_builder_options, - trajectory_ids_to_serialize); + *proto.mutable_builder_options() = + CreateBuilderOptionsProto(trajectory_builder_options, map_builder_options, + trajectory_ids_to_serialize); return proto; } @@ -213,13 +215,14 @@ void SerializeLandmarkNodes( void WritePbStream( const mapping::PoseGraph& pose_graph, const std::vector& - trajectory_builder_options, + all_trajectory_builder_options, + const mapping::proto::MapBuilderOptions& map_builder_options, ProtoStreamWriterInterface* const writer, bool include_unfinished_submaps) { writer->WriteProto(CreateHeader()); writer->WriteProto( SerializePoseGraph(pose_graph, include_unfinished_submaps)); - writer->WriteProto(SerializeTrajectoryBuilderOptions( - trajectory_builder_options, + writer->WriteProto(SerializeBuilderOptions( + all_trajectory_builder_options, map_builder_options, GetValidTrajectoryIds(pose_graph.GetTrajectoryStates()))); SerializeSubmaps(pose_graph.GetAllSubmapData(), include_unfinished_submaps, diff --git a/cartographer/io/internal/mapping_state_serialization.h b/cartographer/io/internal/mapping_state_serialization.h index ac8bdd97a7..5d24ac7b7d 100644 --- a/cartographer/io/internal/mapping_state_serialization.h +++ b/cartographer/io/internal/mapping_state_serialization.h @@ -32,7 +32,8 @@ static constexpr int kFormatVersionWithoutSubmapHistograms = 1; void WritePbStream( const mapping::PoseGraph& pose_graph, const std::vector& - builder_options, + all_trajectory_builder_options, + const mapping::proto::MapBuilderOptions& map_builder_options, ProtoStreamWriterInterface* const writer, bool include_unfinished_submaps); } // namespace io diff --git a/cartographer/io/internal/pbstream_info.cc b/cartographer/io/internal/pbstream_info.cc index 194d9d1ed8..a26d8ccd54 100644 --- a/cartographer/io/internal/pbstream_info.cc +++ b/cartographer/io/internal/pbstream_info.cc @@ -41,10 +41,14 @@ void Run(const std::string& pbstream_filename, bool all_debug_strings) { const auto header = deserializer.header(); LOG(INFO) << "Header: " << header.DebugString(); for (const mapping::proto::TrajectoryBuilderOptionsWithSensorIds& - trajectory_options : deserializer.all_trajectory_builder_options() - .options_with_sensor_ids()) { + trajectory_options : + deserializer.builder_options() + .trajectory_builder_options_with_sensor_ids()) { LOG(INFO) << "Trajectory options: " << trajectory_options.DebugString(); } + LOG(INFO) + << "Map builder options: " + << deserializer.builder_options().map_builder_options().DebugString(); const mapping::proto::PoseGraph pose_graph = deserializer.pose_graph(); for (const mapping::proto::Trajectory& trajectory : pose_graph.trajectory()) { LOG(INFO) << "Trajectory id: " << trajectory.trajectory_id() diff --git a/cartographer/io/proto_stream_deserializer.cc b/cartographer/io/proto_stream_deserializer.cc index fef04489ba..d702e5c9df 100644 --- a/cartographer/io/proto_stream_deserializer.cc +++ b/cartographer/io/proto_stream_deserializer.cc @@ -57,17 +57,17 @@ ProtoStreamDeserializer::ProtoStreamDeserializer( "`SerializationHeader`, but got field tag " << pose_graph_.data_case(); - CHECK(ReadNextSerializedData(&all_trajectory_builder_options_)) - << "Serialized stream misses `AllTrajectoryBuilderOptions`."; - CHECK(all_trajectory_builder_options_.has_all_trajectory_builder_options()) + CHECK(ReadNextSerializedData(&builder_options_)) + << "Serialized stream misses `BuilderOptions`."; + CHECK(builder_options_.has_builder_options()) << "Serialized stream order corrupt. Expecting " - "`AllTrajectoryBuilderOptions` after " + "`BuilderOptions` after " "PoseGraph, got field tag " - << all_trajectory_builder_options_.data_case(); + << builder_options_.data_case(); CHECK_EQ(pose_graph_.pose_graph().trajectory_size(), - all_trajectory_builder_options_.all_trajectory_builder_options() - .options_with_sensor_ids_size()); + builder_options_.builder_options() + .trajectory_builder_options_with_sensor_ids_size()); } bool ProtoStreamDeserializer::ReadNextSerializedData( diff --git a/cartographer/io/proto_stream_deserializer.h b/cartographer/io/proto_stream_deserializer.h index ee0dfd957f..0aa196070d 100644 --- a/cartographer/io/proto_stream_deserializer.h +++ b/cartographer/io/proto_stream_deserializer.h @@ -48,9 +48,8 @@ class ProtoStreamDeserializer { return pose_graph_.pose_graph(); } - const mapping::proto::AllTrajectoryBuilderOptions& - all_trajectory_builder_options() { - return all_trajectory_builder_options_.all_trajectory_builder_options(); + const mapping::proto::BuilderOptions& builder_options() { + return builder_options_.builder_options(); } // Reads the next `SerializedData` message of the ProtoStream into `data`. @@ -63,7 +62,7 @@ class ProtoStreamDeserializer { mapping::proto::SerializationHeader header_; mapping::proto::SerializedData pose_graph_; - mapping::proto::SerializedData all_trajectory_builder_options_; + mapping::proto::SerializedData builder_options_; }; } // namespace io diff --git a/cartographer/io/proto_stream_deserializer_test.cc b/cartographer/io/proto_stream_deserializer_test.cc index 44e5a0b6e6..44a1c95dd8 100644 --- a/cartographer/io/proto_stream_deserializer_test.cc +++ b/cartographer/io/proto_stream_deserializer_test.cc @@ -42,8 +42,7 @@ constexpr char kSerializationHeaderProtoString[] = "format_version: 1"; constexpr char kUnsupportedSerializationHeaderProtoString[] = "format_version: 123"; constexpr char kPoseGraphProtoString[] = "pose_graph {}"; -constexpr char kAllTrajectoryBuilderOptionsProtoString[] = - "all_trajectory_builder_options {}"; +constexpr char kBuilderOptionsProtoString[] = "builder_options {}"; constexpr char kSubmapProtoString[] = "submap {}"; constexpr char kNodeProtoString[] = "node {}"; constexpr char kTrajectoryDataProtoString[] = "trajectory_data {}"; @@ -63,7 +62,7 @@ TEST_F(ProtoStreamDeserializerTest, WorksOnGoldenTextStream) { reader_ = ProtoReaderFromStrings(kSerializationHeaderProtoString, { kPoseGraphProtoString, - kAllTrajectoryBuilderOptionsProtoString, + kBuilderOptionsProtoString, kSubmapProtoString, kNodeProtoString, kTrajectoryDataProtoString, @@ -84,11 +83,10 @@ TEST_F(ProtoStreamDeserializerTest, WorksOnGoldenTextStream) { ProtoFromStringOrDie(kPoseGraphProtoString) .pose_graph())); - EXPECT_TRUE( - MessageDifferencer::Equals(deserializer.all_trajectory_builder_options(), - ProtoFromStringOrDie( - kAllTrajectoryBuilderOptionsProtoString) - .all_trajectory_builder_options())); + EXPECT_TRUE(MessageDifferencer::Equals( + deserializer.builder_options(), + ProtoFromStringOrDie(kBuilderOptionsProtoString) + .builder_options())); SerializedData serialized_data; EXPECT_TRUE(deserializer.ReadNextSerializedData(&serialized_data)); diff --git a/cartographer/io/serialization_format_migration.cc b/cartographer/io/serialization_format_migration.cc index 186fb92aea..6bcc6877d6 100644 --- a/cartographer/io/serialization_format_migration.cc +++ b/cartographer/io/serialization_format_migration.cc @@ -44,11 +44,9 @@ bool ReadPoseGraph(cartographer::io::ProtoStreamReaderInterface* const input, bool ReadBuilderOptions( cartographer::io::ProtoStreamReaderInterface* const input, ProtoMap* proto_map) { - auto& options_vec = - (*proto_map)[SerializedData::kAllTrajectoryBuilderOptions]; + auto& options_vec = (*proto_map)[SerializedData::kBuilderOptions]; options_vec.emplace_back(); - return input->ReadProto( - options_vec.back().mutable_all_trajectory_builder_options()); + return input->ReadProto(options_vec.back().mutable_builder_options()); } mapping::proto::Submap MigrateLegacySubmap2d( @@ -246,7 +244,7 @@ ProtoMap ParseLegacyData( CHECK(ReadBuilderOptions(input, &proto_map)) << "Input stream seems to differ from original stream format. Could " "not " - "read AllTrajectoryBuilderOptions as second message."; + "read BuilderOptions as second message."; if (migrate_grid_format) { do { } while (DeserializeNextAndMigrateGridFormat(input, &proto_map)); @@ -269,7 +267,7 @@ void SerializeToVersion1Format( cartographer::io::ProtoStreamWriterInterface* const output) { const std::vector kFieldSerializationOrder = { SerializedData::kPoseGraphFieldNumber, - SerializedData::kAllTrajectoryBuilderOptionsFieldNumber, + SerializedData::kBuilderOptionsFieldNumber, SerializedData::kSubmapFieldNumber, SerializedData::kNodeFieldNumber, SerializedData::kTrajectoryDataFieldNumber, diff --git a/cartographer/io/serialization_format_migration.h b/cartographer/io/serialization_format_migration.h index 3570a8ac0f..cca44f32f0 100644 --- a/cartographer/io/serialization_format_migration.h +++ b/cartographer/io/serialization_format_migration.h @@ -25,7 +25,7 @@ namespace cartographer { namespace io { // This helper function, migrates the input stream, which is supposed to match -// to the "old" stream format order (PoseGraph, AllTrajectoryBuilderOptions, +// to the "old" stream format order (PoseGraph, BuilderOptions, // SerializedData*) to the version 1 stream format (SerializationHeader, // SerializedData*). void MigrateStreamFormatToVersion1( diff --git a/cartographer/io/serialization_format_migration_test.cc b/cartographer/io/serialization_format_migration_test.cc index 24904ca63a..e7117e87bf 100644 --- a/cartographer/io/serialization_format_migration_test.cc +++ b/cartographer/io/serialization_format_migration_test.cc @@ -44,7 +44,7 @@ class MigrationTest : public ::testing::Test { template void AddLegacyDataToReader(InMemoryProtoStreamReader& reader) { mapping::proto::PoseGraph pose_graph; - mapping::proto::AllTrajectoryBuilderOptions all_options; + mapping::proto::BuilderOptions builder_options; LegacySerializedDataType submap; submap.mutable_submap(); LegacySerializedDataType node; @@ -61,7 +61,7 @@ class MigrationTest : public ::testing::Test { landmark_data.mutable_landmark_data(); reader.AddProto(pose_graph); - reader.AddProto(all_options); + reader.AddProto(builder_options); reader.AddProto(submap); reader.AddProto(node); reader.AddProto(imu_data); @@ -181,7 +181,7 @@ TEST_F(MigrationTest, SerializedDataOrderIsCorrect) { } EXPECT_TRUE(serialized[0].has_pose_graph()); - EXPECT_TRUE(serialized[1].has_all_trajectory_builder_options()); + EXPECT_TRUE(serialized[1].has_builder_options()); EXPECT_TRUE(serialized[2].has_submap()); EXPECT_TRUE(serialized[3].has_node()); EXPECT_TRUE(serialized[4].has_trajectory_data()); @@ -206,7 +206,7 @@ TEST_F(MigrationTest, SerializedDataOrderAfterGridMigrationIsCorrect) { } EXPECT_TRUE(serialized[0].has_pose_graph()); - EXPECT_TRUE(serialized[1].has_all_trajectory_builder_options()); + EXPECT_TRUE(serialized[1].has_builder_options()); EXPECT_TRUE(serialized[2].has_submap()); EXPECT_TRUE(serialized[3].has_node()); EXPECT_TRUE(serialized[4].has_trajectory_data()); diff --git a/cartographer/mapping/internal/testing/mock_map_builder.h b/cartographer/mapping/internal/testing/mock_map_builder.h index a61319a5f9..d2f3198143 100644 --- a/cartographer/mapping/internal/testing/mock_map_builder.h +++ b/cartographer/mapping/internal/testing/mock_map_builder.h @@ -34,31 +34,30 @@ class MockMapBuilder : public mapping::MapBuilderInterface { public: MOCK_METHOD3( AddTrajectoryBuilder, - int(const std::set &expected_sensor_ids, - const mapping::proto::TrajectoryBuilderOptions &trajectory_options, + int(const std::set& expected_sensor_ids, + const mapping::proto::TrajectoryBuilderOptions& trajectory_options, mapping::MapBuilderInterface::LocalSlamResultCallback local_slam_result_callback)); MOCK_METHOD1(AddTrajectoryForDeserialization, - int(const mapping::proto::TrajectoryBuilderOptionsWithSensorIds - &options_with_sensor_ids_proto)); + int(const mapping::proto::TrajectoryBuilderOptionsWithSensorIds& + trajectory_builder_options_with_sensor_ids_proto)); MOCK_CONST_METHOD1(GetTrajectoryBuilder, - mapping::TrajectoryBuilderInterface *(int trajectory_id)); + mapping::TrajectoryBuilderInterface*(int trajectory_id)); MOCK_METHOD1(FinishTrajectory, void(int trajectory_id)); MOCK_METHOD2(SubmapToProto, - std::string(const mapping::SubmapId &, - mapping::proto::SubmapQuery::Response *)); - MOCK_METHOD2(SerializeState, void(bool, io::ProtoStreamWriterInterface *)); - MOCK_METHOD2(SerializeStateToFile, bool(bool, const std::string &)); + std::string(const mapping::SubmapId&, + mapping::proto::SubmapQuery::Response*)); + MOCK_METHOD2(SerializeState, void(bool, io::ProtoStreamWriterInterface*)); + MOCK_METHOD2(SerializeStateToFile, bool(bool, const std::string&)); MOCK_METHOD2(LoadState, - std::map(io::ProtoStreamReaderInterface *, bool)); - MOCK_METHOD2(LoadStateFromFile, - std::map(const std::string &, bool)); + std::map(io::ProtoStreamReaderInterface*, bool)); + MOCK_METHOD2(LoadStateFromFile, std::map(const std::string&, bool)); MOCK_CONST_METHOD0(num_trajectory_builders, int()); - MOCK_METHOD0(pose_graph, mapping::PoseGraphInterface *()); + MOCK_METHOD0(pose_graph, mapping::PoseGraphInterface*()); MOCK_CONST_METHOD0( GetAllTrajectoryBuilderOptions, - const std::vector - &()); + const std::vector< + mapping::proto::TrajectoryBuilderOptionsWithSensorIds>&()); }; } // namespace testing diff --git a/cartographer/mapping/map_builder.cc b/cartographer/mapping/map_builder.cc index 895b45339f..223e21d05a 100644 --- a/cartographer/mapping/map_builder.cc +++ b/cartographer/mapping/map_builder.cc @@ -161,23 +161,27 @@ int MapBuilder::AddTrajectoryBuilder( transform::ToRigid3(initial_trajectory_pose.relative_pose()), common::FromUniversal(initial_trajectory_pose.timestamp())); } - proto::TrajectoryBuilderOptionsWithSensorIds options_with_sensor_ids_proto; + proto::TrajectoryBuilderOptionsWithSensorIds + trajectory_builder_options_with_sensor_ids_proto; for (const auto& sensor_id : expected_sensor_ids) { - *options_with_sensor_ids_proto.add_sensor_id() = ToProto(sensor_id); + *trajectory_builder_options_with_sensor_ids_proto.add_sensor_id() = + ToProto(sensor_id); } - *options_with_sensor_ids_proto.mutable_trajectory_builder_options() = - trajectory_options; - all_trajectory_builder_options_.push_back(options_with_sensor_ids_proto); + *trajectory_builder_options_with_sensor_ids_proto + .mutable_trajectory_builder_options() = trajectory_options; + all_trajectory_builder_options_.push_back( + trajectory_builder_options_with_sensor_ids_proto); CHECK_EQ(trajectory_builders_.size(), all_trajectory_builder_options_.size()); return trajectory_id; } int MapBuilder::AddTrajectoryForDeserialization( const proto::TrajectoryBuilderOptionsWithSensorIds& - options_with_sensor_ids_proto) { + trajectory_builder_options_with_sensor_ids_proto) { const int trajectory_id = trajectory_builders_.size(); trajectory_builders_.emplace_back(); - all_trajectory_builder_options_.push_back(options_with_sensor_ids_proto); + all_trajectory_builder_options_.push_back( + trajectory_builder_options_with_sensor_ids_proto); CHECK_EQ(trajectory_builders_.size(), all_trajectory_builder_options_.size()); return trajectory_id; } @@ -208,15 +212,15 @@ std::string MapBuilder::SubmapToProto( void MapBuilder::SerializeState(bool include_unfinished_submaps, io::ProtoStreamWriterInterface* const writer) { - io::WritePbStream(*pose_graph_, all_trajectory_builder_options_, writer, - include_unfinished_submaps); + io::WritePbStream(*pose_graph_, all_trajectory_builder_options_, options_, + writer, include_unfinished_submaps); } bool MapBuilder::SerializeStateToFile(bool include_unfinished_submaps, const std::string& filename) { io::ProtoStreamWriter writer(filename); - io::WritePbStream(*pose_graph_, all_trajectory_builder_options_, &writer, - include_unfinished_submaps); + io::WritePbStream(*pose_graph_, all_trajectory_builder_options_, options_, + &writer, include_unfinished_submaps); return (writer.Close()); } @@ -227,16 +231,15 @@ std::map MapBuilder::LoadState( // Create a copy of the pose_graph_proto, such that we can re-write the // trajectory ids. proto::PoseGraph pose_graph_proto = deserializer.pose_graph(); - const auto& all_builder_options_proto = - deserializer.all_trajectory_builder_options(); + const auto& builder_options_proto = deserializer.builder_options(); std::map trajectory_remapping; for (int i = 0; i < pose_graph_proto.trajectory_size(); ++i) { auto& trajectory_proto = *pose_graph_proto.mutable_trajectory(i); - const auto& options_with_sensor_ids_proto = - all_builder_options_proto.options_with_sensor_ids(i); - const int new_trajectory_id = - AddTrajectoryForDeserialization(options_with_sensor_ids_proto); + const auto& trajectory_builder_options_with_sensor_ids_proto = + builder_options_proto.trajectory_builder_options_with_sensor_ids(i); + const int new_trajectory_id = AddTrajectoryForDeserialization( + trajectory_builder_options_with_sensor_ids_proto); CHECK(trajectory_remapping .emplace(trajectory_proto.trajectory_id(), new_trajectory_id) .second) @@ -292,9 +295,9 @@ std::map MapBuilder::LoadState( LOG(ERROR) << "Found multiple serialized `PoseGraph`. Serialized " "stream likely corrupt!."; break; - case SerializedData::kAllTrajectoryBuilderOptions: + case SerializedData::kBuilderOptions: LOG(ERROR) << "Found multiple serialized " - "`AllTrajectoryBuilderOptions`. Serialized stream likely " + "`BuilderOptions`. Serialized stream likely " "corrupt!."; break; case SerializedData::kSubmap: { diff --git a/cartographer/mapping/map_builder.h b/cartographer/mapping/map_builder.h index 72a8e267ff..4f95a61fc6 100644 --- a/cartographer/mapping/map_builder.h +++ b/cartographer/mapping/map_builder.h @@ -30,45 +30,45 @@ namespace cartographer { namespace mapping { proto::MapBuilderOptions CreateMapBuilderOptions( - common::LuaParameterDictionary *const parameter_dictionary); + common::LuaParameterDictionary* const parameter_dictionary); // Wires up the complete SLAM stack with TrajectoryBuilders (for local submaps) // and a PoseGraph for loop closure. class MapBuilder : public MapBuilderInterface { public: - explicit MapBuilder(const proto::MapBuilderOptions &options); + explicit MapBuilder(const proto::MapBuilderOptions& options); ~MapBuilder() override {} - MapBuilder(const MapBuilder &) = delete; - MapBuilder &operator=(const MapBuilder &) = delete; + MapBuilder(const MapBuilder&) = delete; + MapBuilder& operator=(const MapBuilder&) = delete; int AddTrajectoryBuilder( - const std::set &expected_sensor_ids, - const proto::TrajectoryBuilderOptions &trajectory_options, + const std::set& expected_sensor_ids, + const proto::TrajectoryBuilderOptions& trajectory_options, LocalSlamResultCallback local_slam_result_callback) override; int AddTrajectoryForDeserialization( - const proto::TrajectoryBuilderOptionsWithSensorIds - &options_with_sensor_ids_proto) override; + const proto::TrajectoryBuilderOptionsWithSensorIds& + trajectory_builder_options_with_sensor_ids_proto) override; void FinishTrajectory(int trajectory_id) override; - std::string SubmapToProto(const SubmapId &submap_id, - proto::SubmapQuery::Response *response) override; + std::string SubmapToProto(const SubmapId& submap_id, + proto::SubmapQuery::Response* response) override; void SerializeState(bool include_unfinished_submaps, - io::ProtoStreamWriterInterface *writer) override; + io::ProtoStreamWriterInterface* writer) override; bool SerializeStateToFile(bool include_unfinished_submaps, - const std::string &filename) override; + const std::string& filename) override; - std::map LoadState(io::ProtoStreamReaderInterface *reader, + std::map LoadState(io::ProtoStreamReaderInterface* reader, bool load_frozen_state) override; - std::map LoadStateFromFile(const std::string &filename, + std::map LoadStateFromFile(const std::string& filename, const bool load_frozen_state) override; - mapping::PoseGraphInterface *pose_graph() override { + mapping::PoseGraphInterface* pose_graph() override { return pose_graph_.get(); } @@ -76,13 +76,13 @@ class MapBuilder : public MapBuilderInterface { return trajectory_builders_.size(); } - mapping::TrajectoryBuilderInterface *GetTrajectoryBuilder( + mapping::TrajectoryBuilderInterface* GetTrajectoryBuilder( int trajectory_id) const override { return trajectory_builders_.at(trajectory_id).get(); } - const std::vector - &GetAllTrajectoryBuilderOptions() const override { + const std::vector& + GetAllTrajectoryBuilderOptions() const override { return all_trajectory_builder_options_; } diff --git a/cartographer/mapping/map_builder_interface.h b/cartographer/mapping/map_builder_interface.h index 8c1cfb144b..105919ccb8 100644 --- a/cartographer/mapping/map_builder_interface.h +++ b/cartographer/mapping/map_builder_interface.h @@ -60,7 +60,7 @@ class MapBuilderInterface { // builder for it will return 'nullptr'. virtual int AddTrajectoryForDeserialization( const proto::TrajectoryBuilderOptionsWithSensorIds& - options_with_sensor_ids_proto) = 0; + trajectory_builder_options_with_sensor_ids_proto) = 0; // Returns the 'TrajectoryBuilderInterface' corresponding to the specified // 'trajectory_id' or 'nullptr' if the trajectory has no corresponding diff --git a/cartographer/mapping/proto/serialization.proto b/cartographer/mapping/proto/serialization.proto index aea7a0ed6f..b291499574 100644 --- a/cartographer/mapping/proto/serialization.proto +++ b/cartographer/mapping/proto/serialization.proto @@ -20,6 +20,7 @@ import "cartographer/mapping/proto/pose_graph.proto"; import "cartographer/mapping/proto/submap.proto"; import "cartographer/mapping/proto/trajectory_node_data.proto"; import "cartographer/sensor/proto/sensor.proto"; +import "cartographer/mapping/proto/map_builder_options.proto"; import "cartographer/mapping/proto/trajectory_builder_options.proto"; import "cartographer/transform/proto/transform.proto"; @@ -67,6 +68,12 @@ message LocalSlamResultData { repeated Submap submaps = 3; } +message BuilderOptions { + repeated TrajectoryBuilderOptionsWithSensorIds + trajectory_builder_options_with_sensor_ids = 1; + MapBuilderOptions map_builder_options = 2; +} + // Header of the serialization format. At the moment it only contains the // version of the format. message SerializationHeader { @@ -76,7 +83,7 @@ message SerializationHeader { message SerializedData { oneof data { PoseGraph pose_graph = 1; - AllTrajectoryBuilderOptions all_trajectory_builder_options = 2; + BuilderOptions builder_options = 2; Submap submap = 3; Node node = 4; TrajectoryData trajectory_data = 5; diff --git a/cartographer/mapping/proto/trajectory_builder_options.proto b/cartographer/mapping/proto/trajectory_builder_options.proto index d6d9c2f8dc..6664077707 100644 --- a/cartographer/mapping/proto/trajectory_builder_options.proto +++ b/cartographer/mapping/proto/trajectory_builder_options.proto @@ -61,7 +61,3 @@ message TrajectoryBuilderOptionsWithSensorIds { repeated SensorId sensor_id = 1; TrajectoryBuilderOptions trajectory_builder_options = 2; } - -message AllTrajectoryBuilderOptions { - repeated TrajectoryBuilderOptionsWithSensorIds options_with_sensor_ids = 1; -} From 7f3b27db845c9b054de29c472bd01663d5b0229e Mon Sep 17 00:00:00 2001 From: Alexander Belyaev Date: Tue, 12 Feb 2019 12:57:37 +0100 Subject: [PATCH 2/3] Ran clang-format. --- cartographer/sensor/compressed_point_cloud.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cartographer/sensor/compressed_point_cloud.cc b/cartographer/sensor/compressed_point_cloud.cc index d840e4702c..f5337e57d2 100644 --- a/cartographer/sensor/compressed_point_cloud.cc +++ b/cartographer/sensor/compressed_point_cloud.cc @@ -61,8 +61,8 @@ RangefinderPoint CompressedPointCloud::ConstIterator::operator*() const { return {current_point_}; } -CompressedPointCloud::ConstIterator& CompressedPointCloud::ConstIterator:: -operator++() { +CompressedPointCloud::ConstIterator& +CompressedPointCloud::ConstIterator::operator++() { --remaining_points_; if (remaining_points_ > 0) { ReadNextPoint(); From 7bdb980464ddd11a3a88ab4b2692f288611a6333 Mon Sep 17 00:00:00 2001 From: Alexander Belyaev Date: Mon, 8 Apr 2019 16:00:19 +0200 Subject: [PATCH 3/3] Ran clang-format. --- cartographer/cloud/internal/client/pose_graph_stub.cc | 1 + .../handlers/add_fixed_frame_pose_data_handler_test.cc | 1 + .../cloud/internal/handlers/add_imu_data_handler_test.cc | 1 + .../internal/handlers/add_landmark_data_handler_test.cc | 1 + .../internal/handlers/add_odometry_data_handler_test.cc | 1 + .../internal/handlers/add_rangefinder_data_handler_test.cc | 1 + .../cloud/internal/handlers/add_trajectory_handler_test.cc | 1 + .../internal/handlers/get_landmark_poses_handler_test.cc | 1 + .../internal/handlers/set_landmark_pose_handler_test.cc | 1 + cartographer/cloud/internal/map_builder_context_impl.cc | 2 -- cartographer/common/lockless_queue_test.cc | 1 + cartographer/common/port.h | 7 +++---- cartographer/common/time.cc | 1 + cartographer/io/fake_file_writer_test.cc | 3 ++- cartographer/io/internal/in_memory_proto_stream_test.cc | 2 +- cartographer/io/internal/mapping_state_serialization.cc | 1 + cartographer/io/probability_grid_points_processor_test.cc | 1 + cartographer/io/proto_stream.cc | 1 + cartographer/io/proto_stream_deserializer_test.cc | 3 ++- cartographer/io/testing/test_helpers.cc | 1 + cartographer/mapping/2d/range_data_inserter_2d_test.cc | 3 +-- cartographer/mapping/2d/submap_2d_test.cc | 2 +- cartographer/mapping/detect_floors.h | 3 +-- cartographer/mapping/internal/2d/local_slam_result_2d.cc | 1 + cartographer/mapping/internal/2d/normal_estimation_2d.h | 1 + .../2d/scan_matching/correlative_scan_matcher_test.cc | 1 - .../2d/scan_matching/occupied_space_cost_function_2d.cc | 1 + .../scan_matching/occupied_space_cost_function_2d_test.cc | 1 - .../2d/scan_matching/tsdf_match_cost_function_2d_test.cc | 1 - cartographer/mapping/internal/3d/local_slam_result_3d.cc | 1 + .../internal/constraints/constraint_builder_2d_test.cc | 2 +- cartographer/mapping/map_builder.h | 3 +-- cartographer/mapping/range_data_inserter_interface.cc | 1 + cartographer/pose_graph/constraint/constraint.h | 4 ++-- .../pose_graph/constraint/rotation_constraint_3d.cc | 3 +-- cartographer/pose_graph/node/imu_calibration.h | 3 +-- cartographer/pose_graph/node/node.h | 4 ++-- cartographer/pose_graph/node/nodes.h | 4 ++-- cartographer/pose_graph/node/pose_2d.h | 3 +-- cartographer/pose_graph/node/pose_3d.h | 3 +-- cartographer/sensor/point_cloud_test.cc | 2 +- 41 files changed, 44 insertions(+), 35 deletions(-) diff --git a/cartographer/cloud/internal/client/pose_graph_stub.cc b/cartographer/cloud/internal/client/pose_graph_stub.cc index 76f1c88d38..f7ff9ad14d 100644 --- a/cartographer/cloud/internal/client/pose_graph_stub.cc +++ b/cartographer/cloud/internal/client/pose_graph_stub.cc @@ -15,6 +15,7 @@ */ #include "cartographer/cloud/internal/client/pose_graph_stub.h" + #include "async_grpc/client.h" #include "cartographer/cloud/internal/handlers/delete_trajectory_handler.h" #include "cartographer/cloud/internal/handlers/get_all_submap_poses.h" diff --git a/cartographer/cloud/internal/handlers/add_fixed_frame_pose_data_handler_test.cc b/cartographer/cloud/internal/handlers/add_fixed_frame_pose_data_handler_test.cc index f92d2c7608..33c0dbf0cf 100644 --- a/cartographer/cloud/internal/handlers/add_fixed_frame_pose_data_handler_test.cc +++ b/cartographer/cloud/internal/handlers/add_fixed_frame_pose_data_handler_test.cc @@ -15,6 +15,7 @@ */ #include "cartographer/cloud/internal/handlers/add_fixed_frame_pose_data_handler.h" + #include "cartographer/cloud/internal/testing/handler_test.h" #include "cartographer/cloud/internal/testing/test_helpers.h" #include "google/protobuf/text_format.h" diff --git a/cartographer/cloud/internal/handlers/add_imu_data_handler_test.cc b/cartographer/cloud/internal/handlers/add_imu_data_handler_test.cc index 679f206860..4052a86331 100644 --- a/cartographer/cloud/internal/handlers/add_imu_data_handler_test.cc +++ b/cartographer/cloud/internal/handlers/add_imu_data_handler_test.cc @@ -15,6 +15,7 @@ */ #include "cartographer/cloud/internal/handlers/add_imu_data_handler.h" + #include "cartographer/cloud/internal/testing/handler_test.h" #include "cartographer/cloud/internal/testing/test_helpers.h" #include "google/protobuf/text_format.h" diff --git a/cartographer/cloud/internal/handlers/add_landmark_data_handler_test.cc b/cartographer/cloud/internal/handlers/add_landmark_data_handler_test.cc index 0b72934692..5f772cd64a 100644 --- a/cartographer/cloud/internal/handlers/add_landmark_data_handler_test.cc +++ b/cartographer/cloud/internal/handlers/add_landmark_data_handler_test.cc @@ -15,6 +15,7 @@ */ #include "cartographer/cloud/internal/handlers/add_landmark_data_handler.h" + #include "cartographer/cloud/internal/testing/handler_test.h" #include "cartographer/cloud/internal/testing/test_helpers.h" #include "google/protobuf/text_format.h" diff --git a/cartographer/cloud/internal/handlers/add_odometry_data_handler_test.cc b/cartographer/cloud/internal/handlers/add_odometry_data_handler_test.cc index 6187e8ac52..e0571a8b4f 100644 --- a/cartographer/cloud/internal/handlers/add_odometry_data_handler_test.cc +++ b/cartographer/cloud/internal/handlers/add_odometry_data_handler_test.cc @@ -15,6 +15,7 @@ */ #include "cartographer/cloud/internal/handlers/add_odometry_data_handler.h" + #include "cartographer/cloud/internal/testing/handler_test.h" #include "cartographer/cloud/internal/testing/test_helpers.h" #include "google/protobuf/text_format.h" diff --git a/cartographer/cloud/internal/handlers/add_rangefinder_data_handler_test.cc b/cartographer/cloud/internal/handlers/add_rangefinder_data_handler_test.cc index a7af01e089..63b0642a3b 100644 --- a/cartographer/cloud/internal/handlers/add_rangefinder_data_handler_test.cc +++ b/cartographer/cloud/internal/handlers/add_rangefinder_data_handler_test.cc @@ -15,6 +15,7 @@ */ #include "cartographer/cloud/internal/handlers/add_rangefinder_data_handler.h" + #include "cartographer/cloud/internal/testing/handler_test.h" #include "cartographer/cloud/internal/testing/test_helpers.h" #include "google/protobuf/text_format.h" diff --git a/cartographer/cloud/internal/handlers/add_trajectory_handler_test.cc b/cartographer/cloud/internal/handlers/add_trajectory_handler_test.cc index d05ec5d600..4bbb209662 100644 --- a/cartographer/cloud/internal/handlers/add_trajectory_handler_test.cc +++ b/cartographer/cloud/internal/handlers/add_trajectory_handler_test.cc @@ -15,6 +15,7 @@ */ #include "cartographer/cloud/internal/handlers/add_trajectory_handler.h" + #include "cartographer/cloud/internal/sensor/serialization.h" #include "cartographer/cloud/internal/testing/handler_test.h" #include "cartographer/cloud/internal/testing/test_helpers.h" diff --git a/cartographer/cloud/internal/handlers/get_landmark_poses_handler_test.cc b/cartographer/cloud/internal/handlers/get_landmark_poses_handler_test.cc index 20067fae95..be45875afa 100644 --- a/cartographer/cloud/internal/handlers/get_landmark_poses_handler_test.cc +++ b/cartographer/cloud/internal/handlers/get_landmark_poses_handler_test.cc @@ -15,6 +15,7 @@ */ #include "cartographer/cloud/internal/handlers/get_landmark_poses_handler.h" + #include "cartographer/cloud/internal/testing/handler_test.h" #include "cartographer/cloud/internal/testing/test_helpers.h" #include "google/protobuf/text_format.h" diff --git a/cartographer/cloud/internal/handlers/set_landmark_pose_handler_test.cc b/cartographer/cloud/internal/handlers/set_landmark_pose_handler_test.cc index 015b5171d1..485c594331 100644 --- a/cartographer/cloud/internal/handlers/set_landmark_pose_handler_test.cc +++ b/cartographer/cloud/internal/handlers/set_landmark_pose_handler_test.cc @@ -15,6 +15,7 @@ */ #include "cartographer/cloud/internal/handlers/set_landmark_pose_handler.h" + #include "cartographer/cloud/internal/testing/handler_test.h" #include "cartographer/cloud/internal/testing/test_helpers.h" #include "cartographer/transform/rigid_transform_test_helpers.h" diff --git a/cartographer/cloud/internal/map_builder_context_impl.cc b/cartographer/cloud/internal/map_builder_context_impl.cc index 4606046f12..3f3c46212c 100644 --- a/cartographer/cloud/internal/map_builder_context_impl.cc +++ b/cartographer/cloud/internal/map_builder_context_impl.cc @@ -14,8 +14,6 @@ * limitations under the License. */ -#include "cartographer/cloud/internal/map_builder_server.h" - #include "cartographer/cloud/internal/map_builder_server.h" #include "cartographer/mapping/internal/2d/local_slam_result_2d.h" #include "cartographer/mapping/internal/3d/local_slam_result_3d.h" diff --git a/cartographer/common/lockless_queue_test.cc b/cartographer/common/lockless_queue_test.cc index f1f247c4ff..5553c35ebf 100644 --- a/cartographer/common/lockless_queue_test.cc +++ b/cartographer/common/lockless_queue_test.cc @@ -1,4 +1,5 @@ #include "cartographer/common/lockless_queue.h" + #include "gtest/gtest.h" namespace cartographer { diff --git a/cartographer/common/port.h b/cartographer/common/port.h index 338861f318..eec84697b8 100644 --- a/cartographer/common/port.h +++ b/cartographer/common/port.h @@ -17,13 +17,12 @@ #ifndef CARTOGRAPHER_COMMON_PORT_H_ #define CARTOGRAPHER_COMMON_PORT_H_ -#include -#include -#include - #include #include #include +#include +#include +#include namespace cartographer { diff --git a/cartographer/common/time.cc b/cartographer/common/time.cc index a2c90d227c..e74eead417 100644 --- a/cartographer/common/time.cc +++ b/cartographer/common/time.cc @@ -17,6 +17,7 @@ #include "cartographer/common/time.h" #include + #include #include #include diff --git a/cartographer/io/fake_file_writer_test.cc b/cartographer/io/fake_file_writer_test.cc index 6189b92135..711e9164c2 100644 --- a/cartographer/io/fake_file_writer_test.cc +++ b/cartographer/io/fake_file_writer_test.cc @@ -14,9 +14,10 @@ * limitations under the License. */ +#include "cartographer/io/fake_file_writer.h" + #include -#include "cartographer/io/fake_file_writer.h" #include "glog/logging.h" #include "gtest/gtest.h" diff --git a/cartographer/io/internal/in_memory_proto_stream_test.cc b/cartographer/io/internal/in_memory_proto_stream_test.cc index 9dd3a1e83c..e274472aaf 100644 --- a/cartographer/io/internal/in_memory_proto_stream_test.cc +++ b/cartographer/io/internal/in_memory_proto_stream_test.cc @@ -15,9 +15,9 @@ */ #include "cartographer/io/internal/in_memory_proto_stream.h" + #include "cartographer/mapping/proto/pose_graph.pb.h" #include "cartographer/mapping/proto/serialization.pb.h" - #include "gtest/gtest.h" namespace cartographer { diff --git a/cartographer/io/internal/mapping_state_serialization.cc b/cartographer/io/internal/mapping_state_serialization.cc index b41e790fde..e340212977 100644 --- a/cartographer/io/internal/mapping_state_serialization.cc +++ b/cartographer/io/internal/mapping_state_serialization.cc @@ -15,6 +15,7 @@ */ #include "cartographer/io/internal/mapping_state_serialization.h" + #include "cartographer/mapping/proto/serialization.pb.h" #include "cartographer/transform/transform.h" diff --git a/cartographer/io/probability_grid_points_processor_test.cc b/cartographer/io/probability_grid_points_processor_test.cc index b3fc73f2c2..99753bb5be 100644 --- a/cartographer/io/probability_grid_points_processor_test.cc +++ b/cartographer/io/probability_grid_points_processor_test.cc @@ -17,6 +17,7 @@ #include "cartographer/io/probability_grid_points_processor.h" #include + #include "cartographer/common/lua_parameter_dictionary.h" #include "cartographer/common/lua_parameter_dictionary_test_helpers.h" #include "cartographer/common/port.h" diff --git a/cartographer/io/proto_stream.cc b/cartographer/io/proto_stream.cc index f55a3a6ebc..60ea02191b 100644 --- a/cartographer/io/proto_stream.cc +++ b/cartographer/io/proto_stream.cc @@ -15,6 +15,7 @@ */ #include "cartographer/io/proto_stream.h" + #include "glog/logging.h" namespace cartographer { diff --git a/cartographer/io/proto_stream_deserializer_test.cc b/cartographer/io/proto_stream_deserializer_test.cc index 44a1c95dd8..d0024d7228 100644 --- a/cartographer/io/proto_stream_deserializer_test.cc +++ b/cartographer/io/proto_stream_deserializer_test.cc @@ -14,10 +14,11 @@ * limitations under the License. */ +#include "cartographer/io/proto_stream_deserializer.h" + #include #include "cartographer/io/internal/in_memory_proto_stream.h" -#include "cartographer/io/proto_stream_deserializer.h" #include "cartographer/io/testing/test_helpers.h" #include "glog/logging.h" #include "gmock/gmock.h" diff --git a/cartographer/io/testing/test_helpers.cc b/cartographer/io/testing/test_helpers.cc index 1e9fbab911..00fcf57931 100644 --- a/cartographer/io/testing/test_helpers.cc +++ b/cartographer/io/testing/test_helpers.cc @@ -15,6 +15,7 @@ */ #include "cartographer/io/testing/test_helpers.h" + #include "cartographer/mapping/proto/serialization.pb.h" namespace cartographer { diff --git a/cartographer/mapping/2d/range_data_inserter_2d_test.cc b/cartographer/mapping/2d/range_data_inserter_2d_test.cc index 587573dbe4..1725334163 100644 --- a/cartographer/mapping/2d/range_data_inserter_2d_test.cc +++ b/cartographer/mapping/2d/range_data_inserter_2d_test.cc @@ -14,14 +14,13 @@ * limitations under the License. */ -#include "cartographer/mapping/2d/probability_grid_range_data_inserter_2d.h" - #include #include "absl/memory/memory.h" #include "cartographer/common/lua_parameter_dictionary.h" #include "cartographer/common/lua_parameter_dictionary_test_helpers.h" #include "cartographer/mapping/2d/probability_grid.h" +#include "cartographer/mapping/2d/probability_grid_range_data_inserter_2d.h" #include "cartographer/mapping/probability_values.h" #include "gmock/gmock.h" diff --git a/cartographer/mapping/2d/submap_2d_test.cc b/cartographer/mapping/2d/submap_2d_test.cc index 3b9d41aa37..6b32b8abc4 100644 --- a/cartographer/mapping/2d/submap_2d_test.cc +++ b/cartographer/mapping/2d/submap_2d_test.cc @@ -15,7 +15,6 @@ */ #include "cartographer/mapping/2d/submap_2d.h" -#include "cartographer/mapping/2d/probability_grid.h" #include #include @@ -25,6 +24,7 @@ #include "cartographer/common/lua_parameter_dictionary.h" #include "cartographer/common/lua_parameter_dictionary_test_helpers.h" #include "cartographer/common/port.h" +#include "cartographer/mapping/2d/probability_grid.h" #include "cartographer/transform/transform.h" #include "gmock/gmock.h" diff --git a/cartographer/mapping/detect_floors.h b/cartographer/mapping/detect_floors.h index 189086f92c..b5acde8019 100644 --- a/cartographer/mapping/detect_floors.h +++ b/cartographer/mapping/detect_floors.h @@ -17,9 +17,8 @@ #ifndef CARTOGRAPHER_MAPPING_DETECT_FLOORS_H_ #define CARTOGRAPHER_MAPPING_DETECT_FLOORS_H_ -#include "cartographer/mapping/proto/trajectory.pb.h" - #include "cartographer/common/time.h" +#include "cartographer/mapping/proto/trajectory.pb.h" namespace cartographer { namespace mapping { diff --git a/cartographer/mapping/internal/2d/local_slam_result_2d.cc b/cartographer/mapping/internal/2d/local_slam_result_2d.cc index 05b078c954..d068d01456 100644 --- a/cartographer/mapping/internal/2d/local_slam_result_2d.cc +++ b/cartographer/mapping/internal/2d/local_slam_result_2d.cc @@ -15,6 +15,7 @@ */ #include "cartographer/mapping/internal/2d/local_slam_result_2d.h" + #include "cartographer/mapping/internal/2d/pose_graph_2d.h" namespace cartographer { diff --git a/cartographer/mapping/internal/2d/normal_estimation_2d.h b/cartographer/mapping/internal/2d/normal_estimation_2d.h index f3d937de72..61e0a2f092 100644 --- a/cartographer/mapping/internal/2d/normal_estimation_2d.h +++ b/cartographer/mapping/internal/2d/normal_estimation_2d.h @@ -18,6 +18,7 @@ #define CARTOGRAPHER_MAPPING_INTERNAL_NORMAL_ESTIMATION_2D_H_ #include + #include "cartographer/mapping/proto/2d/normal_estimation_options_2d.pb.h" #include "cartographer/sensor/point_cloud.h" #include "cartographer/sensor/range_data.h" diff --git a/cartographer/mapping/internal/2d/scan_matching/correlative_scan_matcher_test.cc b/cartographer/mapping/internal/2d/scan_matching/correlative_scan_matcher_test.cc index 29a076bc42..ce513a9c61 100644 --- a/cartographer/mapping/internal/2d/scan_matching/correlative_scan_matcher_test.cc +++ b/cartographer/mapping/internal/2d/scan_matching/correlative_scan_matcher_test.cc @@ -15,7 +15,6 @@ */ #include "cartographer/mapping/internal/2d/scan_matching/correlative_scan_matcher_2d.h" - #include "cartographer/sensor/point_cloud.h" #include "gtest/gtest.h" diff --git a/cartographer/mapping/internal/2d/scan_matching/occupied_space_cost_function_2d.cc b/cartographer/mapping/internal/2d/scan_matching/occupied_space_cost_function_2d.cc index 3cf182aa21..0c4422ee30 100644 --- a/cartographer/mapping/internal/2d/scan_matching/occupied_space_cost_function_2d.cc +++ b/cartographer/mapping/internal/2d/scan_matching/occupied_space_cost_function_2d.cc @@ -15,6 +15,7 @@ */ #include "cartographer/mapping/internal/2d/scan_matching/occupied_space_cost_function_2d.h" + #include "cartographer/mapping/probability_values.h" #include "ceres/cubic_interpolation.h" diff --git a/cartographer/mapping/internal/2d/scan_matching/occupied_space_cost_function_2d_test.cc b/cartographer/mapping/internal/2d/scan_matching/occupied_space_cost_function_2d_test.cc index 240e1c85c6..4cc82e266d 100644 --- a/cartographer/mapping/internal/2d/scan_matching/occupied_space_cost_function_2d_test.cc +++ b/cartographer/mapping/internal/2d/scan_matching/occupied_space_cost_function_2d_test.cc @@ -18,7 +18,6 @@ #include "cartographer/mapping/2d/probability_grid.h" #include "cartographer/mapping/probability_values.h" - #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/cartographer/mapping/internal/2d/scan_matching/tsdf_match_cost_function_2d_test.cc b/cartographer/mapping/internal/2d/scan_matching/tsdf_match_cost_function_2d_test.cc index 821654cb75..6f735339fd 100644 --- a/cartographer/mapping/internal/2d/scan_matching/tsdf_match_cost_function_2d_test.cc +++ b/cartographer/mapping/internal/2d/scan_matching/tsdf_match_cost_function_2d_test.cc @@ -20,7 +20,6 @@ #include "cartographer/common/lua_parameter_dictionary_test_helpers.h" #include "cartographer/mapping/2d/tsdf_2d.h" #include "cartographer/mapping/2d/tsdf_range_data_inserter_2d.h" - #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/cartographer/mapping/internal/3d/local_slam_result_3d.cc b/cartographer/mapping/internal/3d/local_slam_result_3d.cc index 614300852f..6f8e703def 100644 --- a/cartographer/mapping/internal/3d/local_slam_result_3d.cc +++ b/cartographer/mapping/internal/3d/local_slam_result_3d.cc @@ -15,6 +15,7 @@ */ #include "cartographer/mapping/internal/3d/local_slam_result_3d.h" + #include "cartographer/mapping/internal/3d/pose_graph_3d.h" namespace cartographer { diff --git a/cartographer/mapping/internal/constraints/constraint_builder_2d_test.cc b/cartographer/mapping/internal/constraints/constraint_builder_2d_test.cc index 066bb8c65e..f80fad9858 100644 --- a/cartographer/mapping/internal/constraints/constraint_builder_2d_test.cc +++ b/cartographer/mapping/internal/constraints/constraint_builder_2d_test.cc @@ -15,11 +15,11 @@ */ #include "cartographer/mapping/internal/constraints/constraint_builder_2d.h" -#include "cartographer/mapping/2d/probability_grid.h" #include #include "cartographer/common/internal/testing/thread_pool_for_testing.h" +#include "cartographer/mapping/2d/probability_grid.h" #include "cartographer/mapping/2d/submap_2d.h" #include "cartographer/mapping/internal/constraints/constraint_builder.h" #include "cartographer/mapping/internal/testing/test_helpers.h" diff --git a/cartographer/mapping/map_builder.h b/cartographer/mapping/map_builder.h index 4f95a61fc6..6a934b54d8 100644 --- a/cartographer/mapping/map_builder.h +++ b/cartographer/mapping/map_builder.h @@ -17,11 +17,10 @@ #ifndef CARTOGRAPHER_MAPPING_MAP_BUILDER_H_ #define CARTOGRAPHER_MAPPING_MAP_BUILDER_H_ -#include "cartographer/mapping/map_builder_interface.h" - #include #include "cartographer/common/thread_pool.h" +#include "cartographer/mapping/map_builder_interface.h" #include "cartographer/mapping/pose_graph.h" #include "cartographer/mapping/proto/map_builder_options.pb.h" #include "cartographer/sensor/collator_interface.h" diff --git a/cartographer/mapping/range_data_inserter_interface.cc b/cartographer/mapping/range_data_inserter_interface.cc index cf01396753..79d8c8d1bd 100644 --- a/cartographer/mapping/range_data_inserter_interface.cc +++ b/cartographer/mapping/range_data_inserter_interface.cc @@ -15,6 +15,7 @@ */ #include "cartographer/mapping/range_data_inserter_interface.h" + #include "cartographer/mapping/2d/probability_grid_range_data_inserter_2d.h" #include "cartographer/mapping/2d/tsdf_range_data_inserter_2d.h" diff --git a/cartographer/pose_graph/constraint/constraint.h b/cartographer/pose_graph/constraint/constraint.h index 0fcda85dcd..39f5d43844 100644 --- a/cartographer/pose_graph/constraint/constraint.h +++ b/cartographer/pose_graph/constraint/constraint.h @@ -17,13 +17,13 @@ #ifndef CARTOGRAPHER_POSE_GRAPH_CONSTRAINT_CONSTRAINT_H_ #define CARTOGRAPHER_POSE_GRAPH_CONSTRAINT_CONSTRAINT_H_ +#include + #include "cartographer/pose_graph/constraint/loss_function/loss_function.h" #include "cartographer/pose_graph/node/nodes.h" #include "cartographer/pose_graph/proto/constraint.pb.h" #include "ceres/problem.h" -#include - namespace cartographer { namespace pose_graph { diff --git a/cartographer/pose_graph/constraint/rotation_constraint_3d.cc b/cartographer/pose_graph/constraint/rotation_constraint_3d.cc index b9bf6ee909..ca14ef0b2d 100644 --- a/cartographer/pose_graph/constraint/rotation_constraint_3d.cc +++ b/cartographer/pose_graph/constraint/rotation_constraint_3d.cc @@ -17,9 +17,8 @@ #include "cartographer/pose_graph/constraint/rotation_constraint_3d.h" #include "absl/memory/memory.h" -#include "cartographer/pose_graph/constraint/constraint_utils.h" - #include "cartographer/common/utils.h" +#include "cartographer/pose_graph/constraint/constraint_utils.h" namespace cartographer { namespace pose_graph { diff --git a/cartographer/pose_graph/node/imu_calibration.h b/cartographer/pose_graph/node/imu_calibration.h index 6febd5b959..95a934b25b 100644 --- a/cartographer/pose_graph/node/imu_calibration.h +++ b/cartographer/pose_graph/node/imu_calibration.h @@ -17,10 +17,9 @@ #ifndef CARTOGRAPHER_POSE_GRAPH_NODE_IMU_CALIBRATION_H_ #define CARTOGRAPHER_POSE_GRAPH_NODE_IMU_CALIBRATION_H_ -#include "cartographer/pose_graph/node/node.h" - #include +#include "cartographer/pose_graph/node/node.h" #include "cartographer/pose_graph/node/parameterization/parameterization.h" #include "cartographer/transform/transform.h" diff --git a/cartographer/pose_graph/node/node.h b/cartographer/pose_graph/node/node.h index 8e29ea6a42..a2b832135f 100644 --- a/cartographer/pose_graph/node/node.h +++ b/cartographer/pose_graph/node/node.h @@ -17,11 +17,11 @@ #ifndef CARTOGRAPHER_POSE_GRAPH_NODE_NODE_H_ #define CARTOGRAPHER_POSE_GRAPH_NODE_NODE_H_ +#include + #include "cartographer/pose_graph/node/node_id.h" #include "cartographer/pose_graph/proto/node.pb.h" -#include - namespace cartographer { namespace pose_graph { diff --git a/cartographer/pose_graph/node/nodes.h b/cartographer/pose_graph/node/nodes.h index 21f98602be..0e6121b318 100644 --- a/cartographer/pose_graph/node/nodes.h +++ b/cartographer/pose_graph/node/nodes.h @@ -17,12 +17,12 @@ #ifndef CARTOGRAPHER_POSE_GRAPH_NODE_NODES_H_ #define CARTOGRAPHER_POSE_GRAPH_NODE_NODES_H_ +#include + #include "cartographer/pose_graph/node/imu_calibration.h" #include "cartographer/pose_graph/node/pose_2d.h" #include "cartographer/pose_graph/node/pose_3d.h" -#include - namespace cartographer { namespace pose_graph { diff --git a/cartographer/pose_graph/node/pose_2d.h b/cartographer/pose_graph/node/pose_2d.h index 5b94bb3e58..9ce98be74f 100644 --- a/cartographer/pose_graph/node/pose_2d.h +++ b/cartographer/pose_graph/node/pose_2d.h @@ -17,11 +17,10 @@ #ifndef CARTOGRAPHER_POSE_GRAPH_NODE_POSE_2D_H_ #define CARTOGRAPHER_POSE_GRAPH_NODE_POSE_2D_H_ -#include "cartographer/pose_graph/node/node.h" - #include #include "Eigen/Core" +#include "cartographer/pose_graph/node/node.h" namespace cartographer { namespace pose_graph { diff --git a/cartographer/pose_graph/node/pose_3d.h b/cartographer/pose_graph/node/pose_3d.h index 1b09781bc8..1c997c8c6b 100644 --- a/cartographer/pose_graph/node/pose_3d.h +++ b/cartographer/pose_graph/node/pose_3d.h @@ -17,10 +17,9 @@ #ifndef CARTOGRAPHER_POSE_GRAPH_NODE_POSE_3D_H_ #define CARTOGRAPHER_POSE_GRAPH_NODE_POSE_3D_H_ -#include "cartographer/pose_graph/node/node.h" - #include +#include "cartographer/pose_graph/node/node.h" #include "cartographer/pose_graph/node/parameterization/parameterization.h" #include "cartographer/transform/transform.h" diff --git a/cartographer/sensor/point_cloud_test.cc b/cartographer/sensor/point_cloud_test.cc index 0a6d9dfd48..4f547feb43 100644 --- a/cartographer/sensor/point_cloud_test.cc +++ b/cartographer/sensor/point_cloud_test.cc @@ -15,10 +15,10 @@ */ #include "cartographer/sensor/point_cloud.h" -#include "cartographer/transform/transform.h" #include +#include "cartographer/transform/transform.h" #include "gtest/gtest.h" namespace cartographer {