Improve portability (#1452)

This change improves the portability of Cartographer.
master
gaschler 2018-10-24 18:04:55 +02:00 committed by Wally B. Feed
parent 1905b6bb59
commit ceddabbcbb
6 changed files with 8 additions and 7 deletions

View File

@ -124,10 +124,11 @@ ProbabilityGridRangeDataInserter2D::ProbabilityGridRangeDataInserter2D(
void ProbabilityGridRangeDataInserter2D::Insert( void ProbabilityGridRangeDataInserter2D::Insert(
const sensor::RangeData& range_data, GridInterface* const grid) const { const sensor::RangeData& range_data, GridInterface* const grid) const {
ProbabilityGrid* const probability_grid = static_cast<ProbabilityGrid*>(grid); ProbabilityGrid* const probability_grid = static_cast<ProbabilityGrid*>(grid);
CHECK(probability_grid != nullptr);
// By not finishing the update after hits are inserted, we give hits priority // By not finishing the update after hits are inserted, we give hits priority
// (i.e. no hits will be ignored because of a miss in the same cell). // (i.e. no hits will be ignored because of a miss in the same cell).
CastRays(range_data, hit_table_, miss_table_, options_.insert_free_space(), CastRays(range_data, hit_table_, miss_table_, options_.insert_free_space(),
CHECK_NOTNULL(probability_grid)); probability_grid);
probability_grid->FinishUpdate(); probability_grid->FinishUpdate();
} }

View File

@ -77,7 +77,7 @@ RangeDataInserter3D::RangeDataInserter3D(
void RangeDataInserter3D::Insert(const sensor::RangeData& range_data, void RangeDataInserter3D::Insert(const sensor::RangeData& range_data,
HybridGrid* hybrid_grid) const { HybridGrid* hybrid_grid) const {
CHECK_NOTNULL(hybrid_grid); CHECK(hybrid_grid != nullptr);
for (const sensor::RangefinderPoint& hit : range_data.returns) { for (const sensor::RangefinderPoint& hit : range_data.returns) {
const Eigen::Array3i hit_cell = hybrid_grid->GetCellIndex(hit.position); const Eigen::Array3i hit_cell = hybrid_grid->GetCellIndex(hit.position);

View File

@ -229,8 +229,8 @@ bool FastCorrelativeScanMatcher2D::MatchWithSearchParameters(
const transform::Rigid2d& initial_pose_estimate, const transform::Rigid2d& initial_pose_estimate,
const sensor::PointCloud& point_cloud, float min_score, float* score, const sensor::PointCloud& point_cloud, float min_score, float* score,
transform::Rigid2d* pose_estimate) const { transform::Rigid2d* pose_estimate) const {
CHECK_NOTNULL(score); CHECK(score != nullptr);
CHECK_NOTNULL(pose_estimate); CHECK(pose_estimate != nullptr);
const Eigen::Rotation2Dd initial_rotation = initial_pose_estimate.rotation(); const Eigen::Rotation2Dd initial_rotation = initial_pose_estimate.rotation();
const sensor::PointCloud rotated_point_cloud = sensor::TransformPointCloud( const sensor::PointCloud rotated_point_cloud = sensor::TransformPointCloud(

View File

@ -118,7 +118,7 @@ double RealTimeCorrelativeScanMatcher2D::Match(
const transform::Rigid2d& initial_pose_estimate, const transform::Rigid2d& initial_pose_estimate,
const sensor::PointCloud& point_cloud, const Grid2D& grid, const sensor::PointCloud& point_cloud, const Grid2D& grid,
transform::Rigid2d* pose_estimate) const { transform::Rigid2d* pose_estimate) const {
CHECK_NOTNULL(pose_estimate); CHECK(pose_estimate != nullptr);
const Eigen::Rotation2Dd initial_rotation = initial_pose_estimate.rotation(); const Eigen::Rotation2Dd initial_rotation = initial_pose_estimate.rotation();
const sensor::PointCloud rotated_point_cloud = sensor::TransformPointCloud( const sensor::PointCloud rotated_point_cloud = sensor::TransformPointCloud(

View File

@ -35,7 +35,7 @@ float RealTimeCorrelativeScanMatcher3D::Match(
const transform::Rigid3d& initial_pose_estimate, const transform::Rigid3d& initial_pose_estimate,
const sensor::PointCloud& point_cloud, const HybridGrid& hybrid_grid, const sensor::PointCloud& point_cloud, const HybridGrid& hybrid_grid,
transform::Rigid3d* pose_estimate) const { transform::Rigid3d* pose_estimate) const {
CHECK_NOTNULL(pose_estimate); CHECK(pose_estimate != nullptr);
float best_score = -1.f; float best_score = -1.f;
for (const transform::Rigid3f& transform : GenerateExhaustiveSearchTransforms( for (const transform::Rigid3f& transform : GenerateExhaustiveSearchTransforms(
hybrid_grid.resolution(), point_cloud)) { hybrid_grid.resolution(), point_cloud)) {

View File

@ -18,8 +18,8 @@
#include "Eigen/Geometry" #include "Eigen/Geometry"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "cartographer/transform/rigid_transform_test_helpers.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "transform/rigid_transform_test_helpers.h"
namespace cartographer { namespace cartographer {
namespace mapping { namespace mapping {