submap_3d_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 
20 #include "gmock/gmock.h"
21 
22 namespace cartographer {
23 namespace mapping {
24 namespace {
25 
26 TEST(SubmapsTest, ToFromProto) {
27  const Submap3D expected(
28  0.05, 0.25,
29  transform::Rigid3d(Eigen::Vector3d(1., 2., 0.),
30  Eigen::Quaterniond(0., 0., 0., 1.)));
31  proto::Submap proto;
32  expected.ToProto(&proto, true /* include_probability_grid_data */);
33  EXPECT_FALSE(proto.has_submap_2d());
34  EXPECT_TRUE(proto.has_submap_3d());
35  const auto actual = Submap3D(proto.submap_3d());
36  EXPECT_TRUE(expected.local_pose().translation().isApprox(
37  actual.local_pose().translation(), 1e-6));
38  EXPECT_TRUE(expected.local_pose().rotation().isApprox(
39  actual.local_pose().rotation(), 1e-6));
40  EXPECT_EQ(expected.num_range_data(), actual.num_range_data());
41  EXPECT_EQ(expected.finished(), actual.finished());
42  EXPECT_NEAR(expected.high_resolution_hybrid_grid().resolution(), 0.05, 1e-6);
43  EXPECT_NEAR(expected.low_resolution_hybrid_grid().resolution(), 0.25, 1e-6);
44 }
45 
46 } // namespace
47 } // namespace mapping
48 } // namespace cartographer
Rigid3< double > Rigid3d
TEST(TrajectoryConnectivityStateTest, UnknownTrajectory)


cartographer
Author(s): The Cartographer Authors
autogenerated on Mon Feb 28 2022 22:00:58