occupancy_grid_test.cc
Go to the documentation of this file.
1 /*
2  * Copyright 2016 The Cartographer Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #include <memory>
20 
23 #include "gtest/gtest.h"
24 #include "ros/ros.h"
25 
26 namespace cartographer_ros {
27 namespace {
28 
29 TEST(OccupancyGridTest, ComputeMapLimits) {
30  using ::cartographer::mapping::TrajectoryNode;
31  const TrajectoryNode trajectory_node{
32  std::make_shared<TrajectoryNode::Data>(TrajectoryNode::Data{
33  ::cartographer::common::FromUniversal(52),
34  ::cartographer::sensor::RangeData{Eigen::Vector3f::Zero(),
35  {Eigen::Vector3f(-30.f, 1.f, 0.f),
36  Eigen::Vector3f(50.f, -10.f, 0.f)},
37  {}},
38  ::cartographer::sensor::Compress(::cartographer::sensor::RangeData{
39  Eigen::Vector3f::Zero(), {}, {}}),
42  constexpr double kResolution = 0.05;
43  const ::cartographer::mapping_2d::MapLimits limits =
44  ComputeMapLimits(kResolution, {trajectory_node});
45  constexpr float kPaddingAwareTolerance = 5 * kResolution;
46  EXPECT_NEAR(50.f, limits.max().x(), kPaddingAwareTolerance);
47  EXPECT_NEAR(1.f, limits.max().y(), kPaddingAwareTolerance);
48  EXPECT_LT(200, limits.cell_limits().num_x_cells);
49  EXPECT_LT(1600, limits.cell_limits().num_y_cells);
50  EXPECT_GT(400, limits.cell_limits().num_x_cells);
51  EXPECT_GT(2000, limits.cell_limits().num_y_cells);
52 }
53 
54 } // namespace
55 } // namespace cartographer_ros
static Rigid3< double > Identity()
::cartographer::mapping_2d::MapLimits ComputeMapLimits(const double resolution, const std::vector<::cartographer::mapping::TrajectoryNode > &trajectory_nodes)
TEST(ActionClientDestruction, persistent_goal_handles_1)


cartographer_ros
Author(s):
autogenerated on Mon Jun 10 2019 12:59:40