Internal clean up. (#1042)

Add necessary headers to convenient the import to google.
Require holding mutex for some function that access the variables that guard by mutex.
master
jie 2018-04-09 10:18:58 -07:00 committed by Wally B. Feed
parent e89625d36a
commit 74b35caf6e
11 changed files with 19 additions and 9 deletions

View File

@ -680,7 +680,7 @@ void PoseGraph2D::SetInitialTrajectoryPose(const int from_trajectory_id,
transform::Rigid3d PoseGraph2D::GetInterpolatedGlobalTrajectoryPose( transform::Rigid3d PoseGraph2D::GetInterpolatedGlobalTrajectoryPose(
const int trajectory_id, const common::Time time) const { const int trajectory_id, const common::Time time) const {
CHECK(trajectory_nodes_.SizeOfTrajectoryOrZero(trajectory_id) > 0); CHECK_GT(trajectory_nodes_.SizeOfTrajectoryOrZero(trajectory_id), 0);
const auto it = trajectory_nodes_.lower_bound(trajectory_id, time); const auto it = trajectory_nodes_.lower_bound(trajectory_id, time);
if (it == trajectory_nodes_.BeginOfTrajectory(trajectory_id)) { if (it == trajectory_nodes_.BeginOfTrajectory(trajectory_id)) {
return trajectory_nodes_.BeginOfTrajectory(trajectory_id)->data.global_pose; return trajectory_nodes_.BeginOfTrajectory(trajectory_id)->data.global_pose;

View File

@ -93,9 +93,9 @@ class PoseGraph2D : public PoseGraph {
EXCLUDES(mutex_); 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 REQUIRES(mutex_);
void FreezeTrajectory(int trajectory_id) override; void FreezeTrajectory(int trajectory_id) override;
bool IsTrajectoryFrozen(int trajectory_id) override; bool IsTrajectoryFrozen(int trajectory_id) override REQUIRES(mutex_);
void AddSubmapFromProto(const transform::Rigid3d& global_submap_pose, void AddSubmapFromProto(const transform::Rigid3d& global_submap_pose,
const proto::Submap& submap) override; const proto::Submap& submap) override;
void AddNodeFromProto(const transform::Rigid3d& global_pose, void AddNodeFromProto(const transform::Rigid3d& global_pose,
@ -284,7 +284,7 @@ class PoseGraph2D : public PoseGraph {
std::vector<PoseGraphInterface::Constraint> GetConstraints() const override; std::vector<PoseGraphInterface::Constraint> GetConstraints() const override;
void MarkSubmapAsTrimmed(const SubmapId& submap_id) void MarkSubmapAsTrimmed(const SubmapId& submap_id)
REQUIRES(parent_->mutex_) override; REQUIRES(parent_->mutex_) override;
bool IsFinished(int trajectory_id) const override; bool IsFinished(int trajectory_id) const override REQUIRES(parent_->mutex);
private: private:
PoseGraph2D* const parent_; PoseGraph2D* const parent_;

View File

@ -18,6 +18,7 @@
#define CARTOGRAPHER_MAPPING_INTERNAL_2D_SCAN_MATCHING_ROTATION_DELTA_COST_FUNCTOR_2D_H_ #define CARTOGRAPHER_MAPPING_INTERNAL_2D_SCAN_MATCHING_ROTATION_DELTA_COST_FUNCTOR_2D_H_
#include "Eigen/Core" #include "Eigen/Core"
#include "ceres/ceres.h"
namespace cartographer { namespace cartographer {
namespace mapping { namespace mapping {

View File

@ -18,6 +18,7 @@
#define CARTOGRAPHER_MAPPING_INTERNAL_2D_SCAN_MATCHING_TRANSLATION_DELTA_COST_FUNCTOR_2D_H_ #define CARTOGRAPHER_MAPPING_INTERNAL_2D_SCAN_MATCHING_TRANSLATION_DELTA_COST_FUNCTOR_2D_H_
#include "Eigen/Core" #include "Eigen/Core"
#include "ceres/ceres.h"
namespace cartographer { namespace cartographer {
namespace mapping { namespace mapping {

View File

@ -19,6 +19,7 @@
#include "Eigen/Core" #include "Eigen/Core"
#include "Eigen/Geometry" #include "Eigen/Geometry"
#include "ceres/ceres.h"
namespace cartographer { namespace cartographer {
namespace mapping { namespace mapping {

View File

@ -713,7 +713,7 @@ void PoseGraph3D::SetInitialTrajectoryPose(const int from_trajectory_id,
transform::Rigid3d PoseGraph3D::GetInterpolatedGlobalTrajectoryPose( transform::Rigid3d PoseGraph3D::GetInterpolatedGlobalTrajectoryPose(
const int trajectory_id, const common::Time time) const { const int trajectory_id, const common::Time time) const {
CHECK(trajectory_nodes_.SizeOfTrajectoryOrZero(trajectory_id) > 0); CHECK_GT(trajectory_nodes_.SizeOfTrajectoryOrZero(trajectory_id), 0);
const auto it = trajectory_nodes_.lower_bound(trajectory_id, time); const auto it = trajectory_nodes_.lower_bound(trajectory_id, time);
if (it == trajectory_nodes_.BeginOfTrajectory(trajectory_id)) { if (it == trajectory_nodes_.BeginOfTrajectory(trajectory_id)) {
return trajectory_nodes_.BeginOfTrajectory(trajectory_id)->data.global_pose; return trajectory_nodes_.BeginOfTrajectory(trajectory_id)->data.global_pose;

View File

@ -92,9 +92,9 @@ class PoseGraph3D : public PoseGraph {
EXCLUDES(mutex_); 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 REQUIRES(mutex_);
void FreezeTrajectory(int trajectory_id) override; void FreezeTrajectory(int trajectory_id) override;
bool IsTrajectoryFrozen(int trajectory_id) override; bool IsTrajectoryFrozen(int trajectory_id) override REQUIRES(mutex_);
void AddSubmapFromProto(const transform::Rigid3d& global_submap_pose, void AddSubmapFromProto(const transform::Rigid3d& global_submap_pose,
const proto::Submap& submap) override; const proto::Submap& submap) override;
void AddNodeFromProto(const transform::Rigid3d& global_pose, void AddNodeFromProto(const transform::Rigid3d& global_pose,
@ -289,7 +289,7 @@ class PoseGraph3D : public PoseGraph {
std::vector<PoseGraphInterface::Constraint> GetConstraints() const override; std::vector<PoseGraphInterface::Constraint> GetConstraints() const override;
void MarkSubmapAsTrimmed(const SubmapId& submap_id) void MarkSubmapAsTrimmed(const SubmapId& submap_id)
REQUIRES(parent_->mutex_) override; REQUIRES(parent_->mutex_) override;
bool IsFinished(int trajectory_id) const override; bool IsFinished(int trajectory_id) const override REQUIRES(parent_->mutex_);
private: private:
PoseGraph3D* const parent_; PoseGraph3D* const parent_;

View File

@ -19,6 +19,7 @@
#include "Eigen/Core" #include "Eigen/Core"
#include "Eigen/Geometry" #include "Eigen/Geometry"
#include "ceres/ceres.h"
namespace cartographer { namespace cartographer {
namespace mapping { namespace mapping {

View File

@ -18,6 +18,7 @@
#define CARTOGRAPHER_MAPPING_INTERNAL_3D_SCAN_MATCHING_TRANSLATION_DELTA_COST_FUNCTOR_3D_H_ #define CARTOGRAPHER_MAPPING_INTERNAL_3D_SCAN_MATCHING_TRANSLATION_DELTA_COST_FUNCTOR_3D_H_
#include "Eigen/Core" #include "Eigen/Core"
#include "ceres/ceres.h"
namespace cartographer { namespace cartographer {
namespace mapping { namespace mapping {

View File

@ -17,6 +17,10 @@
#ifndef CARTOGRAPHER_MAPPING_INTERNAL_POSE_GRAPH_COST_HELPERS_IMPL_H_ #ifndef CARTOGRAPHER_MAPPING_INTERNAL_POSE_GRAPH_COST_HELPERS_IMPL_H_
#define CARTOGRAPHER_MAPPING_INTERNAL_POSE_GRAPH_COST_HELPERS_IMPL_H_ #define CARTOGRAPHER_MAPPING_INTERNAL_POSE_GRAPH_COST_HELPERS_IMPL_H_
#include "Eigen/Core"
#include "cartographer/transform/rigid_transform.h"
#include "cartographer/transform/transform.h"
namespace cartographer { namespace cartographer {
namespace mapping { namespace mapping {
namespace pose_graph { namespace pose_graph {

View File

@ -43,7 +43,8 @@ PoseGraph::Constraint::Tag FromProto(
case proto::PoseGraph::Constraint::INTER_SUBMAP: case proto::PoseGraph::Constraint::INTER_SUBMAP:
return PoseGraph::Constraint::Tag::INTER_SUBMAP; return PoseGraph::Constraint::Tag::INTER_SUBMAP;
case ::google::protobuf::kint32max: case ::google::protobuf::kint32max:
case ::google::protobuf::kint32min:; case ::google::protobuf::kint32min: {
}
} }
LOG(FATAL) << "Unsupported tag."; LOG(FATAL) << "Unsupported tag.";
} }