Propagate LandmarksData to the PoseGraph. (#830)

Propagate LandmarkData to the PoseGraph.
master
Alexander Belyaev 2018-01-19 09:41:24 +01:00 committed by GitHub
parent de5937856d
commit 746c9c83c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 48 additions and 1 deletions

View File

@ -106,6 +106,11 @@ class GlobalTrajectoryBuilder : public mapping::TrajectoryBuilderInterface {
pose_graph_->AddFixedFramePoseData(trajectory_id_, fixed_frame_pose); pose_graph_->AddFixedFramePoseData(trajectory_id_, fixed_frame_pose);
} }
void AddSensorData(const std::string& sensor_id,
const sensor::LandmarkData& landmark_data) override {
pose_graph_->AddLandmarkData(trajectory_id_, landmark_data);
}
void AddLocalSlamResultData(std::unique_ptr<mapping::LocalSlamResultData> void AddLocalSlamResultData(std::unique_ptr<mapping::LocalSlamResultData>
local_slam_result_data) override { local_slam_result_data) override {
CHECK(!local_trajectory_builder_) << "Can't add LocalSlamResultData with " CHECK(!local_trajectory_builder_) << "Can't add LocalSlamResultData with "

View File

@ -69,6 +69,12 @@ class CollatedTrajectoryBuilder : public TrajectoryBuilderInterface {
const sensor::FixedFramePoseData& fixed_frame_pose_data) override { const sensor::FixedFramePoseData& fixed_frame_pose_data) override {
AddData(sensor::MakeDispatchable(sensor_id, fixed_frame_pose_data)); AddData(sensor::MakeDispatchable(sensor_id, fixed_frame_pose_data));
} }
void AddSensorData(const std::string& sensor_id,
const sensor::LandmarkData& landmark_data) override {
AddData(sensor::MakeDispatchable(sensor_id, landmark_data));
}
void AddLocalSlamResultData(std::unique_ptr<mapping::LocalSlamResultData> void AddLocalSlamResultData(std::unique_ptr<mapping::LocalSlamResultData>
local_slam_result_data) override { local_slam_result_data) override {
AddData(std::move(local_slam_result_data)); AddData(std::move(local_slam_result_data));

View File

@ -34,6 +34,7 @@
#include "cartographer/mapping/trajectory_node.h" #include "cartographer/mapping/trajectory_node.h"
#include "cartographer/sensor/fixed_frame_pose_data.h" #include "cartographer/sensor/fixed_frame_pose_data.h"
#include "cartographer/sensor/imu_data.h" #include "cartographer/sensor/imu_data.h"
#include "cartographer/sensor/landmark_data.h"
#include "cartographer/sensor/map_by_time.h" #include "cartographer/sensor/map_by_time.h"
#include "cartographer/sensor/odometry_data.h" #include "cartographer/sensor/odometry_data.h"
#include "cartographer/transform/rigid_transform.h" #include "cartographer/transform/rigid_transform.h"
@ -71,6 +72,10 @@ class PoseGraph : public PoseGraphInterface {
int trajectory_id, int trajectory_id,
const sensor::FixedFramePoseData& fixed_frame_pose_data) = 0; const sensor::FixedFramePoseData& fixed_frame_pose_data) = 0;
// Inserts landmarks observations.
virtual void AddLandmarkData(int trajectory_id,
const sensor::LandmarkData& landmark_data) = 0;
// Finishes the given trajectory. // Finishes the given trajectory.
virtual void FinishTrajectory(int trajectory_id) = 0; virtual void FinishTrajectory(int trajectory_id) = 0;

View File

@ -29,6 +29,7 @@
#include "cartographer/mapping/submaps.h" #include "cartographer/mapping/submaps.h"
#include "cartographer/sensor/fixed_frame_pose_data.h" #include "cartographer/sensor/fixed_frame_pose_data.h"
#include "cartographer/sensor/imu_data.h" #include "cartographer/sensor/imu_data.h"
#include "cartographer/sensor/landmark_data.h"
#include "cartographer/sensor/odometry_data.h" #include "cartographer/sensor/odometry_data.h"
#include "cartographer/sensor/timed_point_cloud_data.h" #include "cartographer/sensor/timed_point_cloud_data.h"
@ -78,7 +79,8 @@ class TrajectoryBuilderInterface {
virtual void AddSensorData( virtual void AddSensorData(
const std::string& sensor_id, const std::string& sensor_id,
const sensor::FixedFramePoseData& fixed_frame_pose) = 0; const sensor::FixedFramePoseData& fixed_frame_pose) = 0;
virtual void AddSensorData(const std::string& sensor_id,
const sensor::LandmarkData& landmark_data) = 0;
// Allows to directly add local SLAM results to the 'PoseGraph'. Note that it // Allows to directly add local SLAM results to the 'PoseGraph'. Note that it
// is invalid to add local SLAM results for a trajectory that has a // is invalid to add local SLAM results for a trajectory that has a
// 'LocalTrajectoryBuilder'. // 'LocalTrajectoryBuilder'.

View File

@ -172,6 +172,12 @@ void PoseGraph::AddFixedFramePoseData(
LOG(FATAL) << "Not yet implemented for 2D."; LOG(FATAL) << "Not yet implemented for 2D.";
} }
void PoseGraph::AddLandmarkData(int trajectory_id,
const sensor::LandmarkData& landmark_data)
EXCLUDES(mutex_) {
LOG(FATAL) << "Not yet implemented.";
}
void PoseGraph::ComputeConstraint(const mapping::NodeId& node_id, void PoseGraph::ComputeConstraint(const mapping::NodeId& node_id,
const mapping::SubmapId& submap_id) { const mapping::SubmapId& submap_id) {
CHECK(submap_data_.at(submap_id).state == SubmapState::kFinished); CHECK(submap_data_.at(submap_id).state == SubmapState::kFinished);

View File

@ -85,6 +85,9 @@ class PoseGraph : public mapping::PoseGraph {
int trajectory_id, int trajectory_id,
const sensor::FixedFramePoseData& fixed_frame_pose_data) override const sensor::FixedFramePoseData& fixed_frame_pose_data) override
EXCLUDES(mutex_); EXCLUDES(mutex_);
void AddLandmarkData(int trajectory_id,
const sensor::LandmarkData& landmark_data) override
EXCLUDES(mutex_);
void FinishTrajectory(int trajectory_id) override; void FinishTrajectory(int trajectory_id) override;
bool IsTrajectoryFinished(int trajectory_id) override; bool IsTrajectoryFinished(int trajectory_id) override;

View File

@ -174,6 +174,12 @@ void PoseGraph::AddFixedFramePoseData(
}); });
} }
void PoseGraph::AddLandmarkData(int trajectory_id,
const sensor::LandmarkData& landmark_data)
EXCLUDES(mutex_) {
LOG(FATAL) << "Not yet implemented.";
}
void PoseGraph::ComputeConstraint(const mapping::NodeId& node_id, void PoseGraph::ComputeConstraint(const mapping::NodeId& node_id,
const mapping::SubmapId& submap_id) { const mapping::SubmapId& submap_id) {
CHECK(submap_data_.at(submap_id).state == SubmapState::kFinished); CHECK(submap_data_.at(submap_id).state == SubmapState::kFinished);

View File

@ -85,6 +85,9 @@ class PoseGraph : public mapping::PoseGraph {
int trajectory_id, int trajectory_id,
const sensor::FixedFramePoseData& fixed_frame_pose_data) override const sensor::FixedFramePoseData& fixed_frame_pose_data) override
EXCLUDES(mutex_); EXCLUDES(mutex_);
void AddLandmarkData(int trajectory_id,
const sensor::LandmarkData& landmark_data) override
EXCLUDES(mutex_);
void FinishTrajectory(int trajectory_id) override; void FinishTrajectory(int trajectory_id) override;
bool IsTrajectoryFinished(int trajectory_id) override; bool IsTrajectoryFinished(int trajectory_id) override;

View File

@ -78,6 +78,8 @@ class MockTrajectoryBuilder
MOCK_METHOD2(AddSensorData, MOCK_METHOD2(AddSensorData,
void(const std::string&, void(const std::string&,
const cartographer::sensor::FixedFramePoseData&)); const cartographer::sensor::FixedFramePoseData&));
MOCK_METHOD2(AddSensorData, void(const std::string&,
const cartographer::sensor::LandmarkData&));
// Some of the platforms we run on may ship with a version of gmock which does // Some of the platforms we run on may ship with a version of gmock which does
// not yet support move-only types. // not yet support move-only types.

View File

@ -127,6 +127,12 @@ void TrajectoryBuilderStub::AddSensorData(
fixed_frame_writer_.client_writer->Write(request); fixed_frame_writer_.client_writer->Write(request);
} }
void TrajectoryBuilderStub::AddSensorData(
const std::string& sensor_id,
const cartographer::sensor::LandmarkData& landmark_data) {
LOG(FATAL) << "Not implemented";
}
void TrajectoryBuilderStub::AddLocalSlamResultData( void TrajectoryBuilderStub::AddLocalSlamResultData(
std::unique_ptr<cartographer::mapping::LocalSlamResultData> std::unique_ptr<cartographer::mapping::LocalSlamResultData>
local_slam_result_data) { local_slam_result_data) {

View File

@ -49,6 +49,9 @@ class TrajectoryBuilderStub
void AddSensorData(const std::string& sensor_id, void AddSensorData(const std::string& sensor_id,
const cartographer::sensor::FixedFramePoseData& const cartographer::sensor::FixedFramePoseData&
fixed_frame_pose) override; fixed_frame_pose) override;
void AddSensorData(
const std::string& sensor_id,
const cartographer::sensor::LandmarkData& landmark_data) override;
void AddLocalSlamResultData( void AddLocalSlamResultData(
std::unique_ptr<cartographer::mapping::LocalSlamResultData> std::unique_ptr<cartographer::mapping::LocalSlamResultData>
local_slam_result_data) override; local_slam_result_data) override;