Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "cartographer/cloud/internal/handlers/get_landmark_poses_handler.h"
00018
00019 #include "cartographer/cloud/internal/testing/handler_test.h"
00020 #include "cartographer/cloud/internal/testing/test_helpers.h"
00021 #include "google/protobuf/text_format.h"
00022 #include "gtest/gtest.h"
00023
00024 namespace cartographer {
00025 namespace cloud {
00026 namespace handlers {
00027 namespace {
00028
00029 using ::cartographer::transform::Rigid3d;
00030 using ::testing::_;
00031 using ::testing::Eq;
00032 using ::testing::Pointee;
00033 using ::testing::Truly;
00034
00035 const std::string kMessage = R"(
00036 landmark_poses {
00037 landmark_id: "landmark_1"
00038 global_pose {
00039 translation {
00040 x: 1 y: 2 z: 3
00041 }
00042 rotation {
00043 w: 1 x: 0 y: 0 z: 0
00044 }
00045 }
00046 }
00047 landmark_poses {
00048 landmark_id: "landmark_2"
00049 global_pose {
00050 translation {
00051 x: 3 y: 2 z: 1
00052 }
00053 rotation {
00054 w: 0 x: 1 y: 0 z: 0
00055 }
00056 }
00057 }
00058 )";
00059
00060 using GetLandmarkPosesHandlerTest =
00061 testing::HandlerTest<GetLandmarkPosesSignature, GetLandmarkPosesHandler>;
00062
00063 TEST_F(GetLandmarkPosesHandlerTest, NoLocalSlamUploader) {
00064 std::map<std::string, Rigid3d> landmark_poses{
00065 {"landmark_1", Rigid3d(Eigen::Vector3d(1., 2., 3.),
00066 Eigen::Quaterniond(1., 0., 0., 0.))},
00067 {"landmark_2", Rigid3d(Eigen::Vector3d(3., 2., 1.),
00068 Eigen::Quaterniond(0., 1., 0., 0.))}};
00069 EXPECT_CALL(*mock_pose_graph_, GetLandmarkPoses())
00070 .WillOnce(::testing::Return(landmark_poses));
00071 test_server_->SendWrite(google::protobuf::Empty());
00072
00073 proto::GetLandmarkPosesResponse expected_response;
00074 EXPECT_TRUE(google::protobuf::TextFormat::ParseFromString(
00075 kMessage, &expected_response));
00076 EXPECT_THAT(
00077 test_server_->response(),
00078 ::testing::Truly(testing::BuildProtoPredicateEquals(&expected_response)));
00079 }
00080
00081 }
00082 }
00083 }
00084 }