23 #include "cartographer/mapping/proto/trajectory_node_data.pb.h" 25 #include "gtest/gtest.h" 31 TEST(TrajectoryNodeTest, ToAndFromProto) {
32 const TrajectoryNode::Data expected{
34 Eigen::Quaterniond(1., 2., -3., -4.),
35 sensor::CompressedPointCloud({{1.f, 2.f, 0.f}, {0.f, 0.f, 1.f}})
37 sensor::CompressedPointCloud({{2.f, 3.f, 4.f}}).Decompress(),
38 sensor::CompressedPointCloud({{-1.f, 2.f, 0.f}}).Decompress(),
39 Eigen::VectorXf::Unit(20, 4),
41 Eigen::Quaterniond(4., 5., -6., -7.).normalized())};
42 const proto::TrajectoryNodeData proto =
ToProto(expected);
43 const TrajectoryNode::Data actual =
FromProto(proto);
44 EXPECT_EQ(expected.time, actual.time);
45 EXPECT_TRUE(actual.gravity_alignment.isApprox(expected.gravity_alignment));
46 EXPECT_EQ(expected.filtered_gravity_aligned_point_cloud,
47 actual.filtered_gravity_aligned_point_cloud);
48 EXPECT_EQ(expected.high_resolution_point_cloud,
49 actual.high_resolution_point_cloud);
50 EXPECT_EQ(expected.low_resolution_point_cloud,
51 actual.low_resolution_point_cloud);
52 EXPECT_EQ(expected.rotational_scan_matcher_histogram,
53 actual.rotational_scan_matcher_histogram);
54 EXPECT_THAT(actual.local_pose,
55 transform::IsNearly(expected.local_pose, 1e-9));
PoseGraph::Constraint::Tag FromProto(const proto::PoseGraph::Constraint::Tag &proto)
Time FromUniversal(const int64 ticks)
proto::MapLimits ToProto(const MapLimits &map_limits)
TEST(TrajectoryConnectivityStateTest, UnknownTrajectory)