set_landmark_pose_handler_test.cc
Go to the documentation of this file.
1 /*
2  * Copyright 2018 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 
21 #include "google/protobuf/text_format.h"
22 #include "gtest/gtest.h"
23 
24 namespace cartographer {
25 namespace cloud {
26 namespace handlers {
27 namespace {
28 
29 const std::string kMessage = R"(
30  landmark_pose {
31  landmark_id: "landmark_1"
32  global_pose {
33  translation {
34  x: 1 y: 2 z: 3
35  }
36  rotation {
37  w: 4 x: 5 y: 6 z: 7
38  }
39  }
40  })";
41 
42 using SetLandmarkPoseHandlerTest =
43  testing::HandlerTest<SetLandmarkPoseSignature, SetLandmarkPoseHandler>;
44 
45 TEST_F(SetLandmarkPoseHandlerTest, SetLandmarkPose) {
46  constexpr double kEps = 1e-10;
47  proto::SetLandmarkPoseRequest request;
48  EXPECT_TRUE(
49  google::protobuf::TextFormat::ParseFromString(kMessage, &request));
50  EXPECT_CALL(
52  SetLandmarkPose("landmark_1",
53  transform::IsNearly(
54  transform::Rigid3d(Eigen::Vector3d(1, 2, 3),
55  Eigen::Quaterniond(4, 5, 6, 7)),
56  kEps)));
57  test_server_->SendWrite(request);
58 }
59 
60 } // namespace
61 } // namespace handlers
62 } // namespace cloud
63 } // namespace cartographer
Rigid3< double > Rigid3d
std::unique_ptr< MockPoseGraph > mock_pose_graph_


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