From ceddabbcbb05d5fcf229ddd24683c703dfd79ea0 Mon Sep 17 00:00:00 2001 From: gaschler Date: Wed, 24 Oct 2018 18:04:55 +0200 Subject: [PATCH] Improve portability (#1452) This change improves the portability of Cartographer. --- .../mapping/2d/probability_grid_range_data_inserter_2d.cc | 3 ++- cartographer/mapping/3d/range_data_inserter_3d.cc | 2 +- .../2d/scan_matching/fast_correlative_scan_matcher_2d.cc | 4 ++-- .../2d/scan_matching/real_time_correlative_scan_matcher_2d.cc | 2 +- .../3d/scan_matching/real_time_correlative_scan_matcher_3d.cc | 2 +- cartographer/mapping/pose_extrapolator_test.cc | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cartographer/mapping/2d/probability_grid_range_data_inserter_2d.cc b/cartographer/mapping/2d/probability_grid_range_data_inserter_2d.cc index 8039158..511cb49 100644 --- a/cartographer/mapping/2d/probability_grid_range_data_inserter_2d.cc +++ b/cartographer/mapping/2d/probability_grid_range_data_inserter_2d.cc @@ -124,10 +124,11 @@ ProbabilityGridRangeDataInserter2D::ProbabilityGridRangeDataInserter2D( void ProbabilityGridRangeDataInserter2D::Insert( const sensor::RangeData& range_data, GridInterface* const grid) const { ProbabilityGrid* const probability_grid = static_cast(grid); + CHECK(probability_grid != nullptr); // 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). CastRays(range_data, hit_table_, miss_table_, options_.insert_free_space(), - CHECK_NOTNULL(probability_grid)); + probability_grid); probability_grid->FinishUpdate(); } diff --git a/cartographer/mapping/3d/range_data_inserter_3d.cc b/cartographer/mapping/3d/range_data_inserter_3d.cc index 2a336a8..104f805 100644 --- a/cartographer/mapping/3d/range_data_inserter_3d.cc +++ b/cartographer/mapping/3d/range_data_inserter_3d.cc @@ -77,7 +77,7 @@ RangeDataInserter3D::RangeDataInserter3D( void RangeDataInserter3D::Insert(const sensor::RangeData& range_data, HybridGrid* hybrid_grid) const { - CHECK_NOTNULL(hybrid_grid); + CHECK(hybrid_grid != nullptr); for (const sensor::RangefinderPoint& hit : range_data.returns) { const Eigen::Array3i hit_cell = hybrid_grid->GetCellIndex(hit.position); diff --git a/cartographer/mapping/internal/2d/scan_matching/fast_correlative_scan_matcher_2d.cc b/cartographer/mapping/internal/2d/scan_matching/fast_correlative_scan_matcher_2d.cc index 726aa0a..4f20363 100644 --- a/cartographer/mapping/internal/2d/scan_matching/fast_correlative_scan_matcher_2d.cc +++ b/cartographer/mapping/internal/2d/scan_matching/fast_correlative_scan_matcher_2d.cc @@ -229,8 +229,8 @@ bool FastCorrelativeScanMatcher2D::MatchWithSearchParameters( const transform::Rigid2d& initial_pose_estimate, const sensor::PointCloud& point_cloud, float min_score, float* score, transform::Rigid2d* pose_estimate) const { - CHECK_NOTNULL(score); - CHECK_NOTNULL(pose_estimate); + CHECK(score != nullptr); + CHECK(pose_estimate != nullptr); const Eigen::Rotation2Dd initial_rotation = initial_pose_estimate.rotation(); const sensor::PointCloud rotated_point_cloud = sensor::TransformPointCloud( diff --git a/cartographer/mapping/internal/2d/scan_matching/real_time_correlative_scan_matcher_2d.cc b/cartographer/mapping/internal/2d/scan_matching/real_time_correlative_scan_matcher_2d.cc index 2464268..1bc75bd 100644 --- a/cartographer/mapping/internal/2d/scan_matching/real_time_correlative_scan_matcher_2d.cc +++ b/cartographer/mapping/internal/2d/scan_matching/real_time_correlative_scan_matcher_2d.cc @@ -118,7 +118,7 @@ double RealTimeCorrelativeScanMatcher2D::Match( const transform::Rigid2d& initial_pose_estimate, const sensor::PointCloud& point_cloud, const Grid2D& grid, transform::Rigid2d* pose_estimate) const { - CHECK_NOTNULL(pose_estimate); + CHECK(pose_estimate != nullptr); const Eigen::Rotation2Dd initial_rotation = initial_pose_estimate.rotation(); const sensor::PointCloud rotated_point_cloud = sensor::TransformPointCloud( diff --git a/cartographer/mapping/internal/3d/scan_matching/real_time_correlative_scan_matcher_3d.cc b/cartographer/mapping/internal/3d/scan_matching/real_time_correlative_scan_matcher_3d.cc index 0426b2d..6ac9e0a 100644 --- a/cartographer/mapping/internal/3d/scan_matching/real_time_correlative_scan_matcher_3d.cc +++ b/cartographer/mapping/internal/3d/scan_matching/real_time_correlative_scan_matcher_3d.cc @@ -35,7 +35,7 @@ float RealTimeCorrelativeScanMatcher3D::Match( const transform::Rigid3d& initial_pose_estimate, const sensor::PointCloud& point_cloud, const HybridGrid& hybrid_grid, transform::Rigid3d* pose_estimate) const { - CHECK_NOTNULL(pose_estimate); + CHECK(pose_estimate != nullptr); float best_score = -1.f; for (const transform::Rigid3f& transform : GenerateExhaustiveSearchTransforms( hybrid_grid.resolution(), point_cloud)) { diff --git a/cartographer/mapping/pose_extrapolator_test.cc b/cartographer/mapping/pose_extrapolator_test.cc index 7aafe29..fe17e1b 100644 --- a/cartographer/mapping/pose_extrapolator_test.cc +++ b/cartographer/mapping/pose_extrapolator_test.cc @@ -18,8 +18,8 @@ #include "Eigen/Geometry" #include "absl/memory/memory.h" +#include "cartographer/transform/rigid_transform_test_helpers.h" #include "gtest/gtest.h" -#include "transform/rigid_transform_test_helpers.h" namespace cartographer { namespace mapping {