set_landmark_pose_handler_test.cc
Go to the documentation of this file.
00001 /*
00002  * Copyright 2018 The Cartographer Authors
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #include "cartographer/cloud/internal/handlers/set_landmark_pose_handler.h"
00018 
00019 #include "cartographer/cloud/internal/testing/handler_test.h"
00020 #include "cartographer/cloud/internal/testing/test_helpers.h"
00021 #include "cartographer/transform/rigid_transform_test_helpers.h"
00022 #include "google/protobuf/text_format.h"
00023 #include "gtest/gtest.h"
00024 
00025 namespace cartographer {
00026 namespace cloud {
00027 namespace handlers {
00028 namespace {
00029 
00030 const std::string kMessage = R"(
00031   landmark_pose {
00032     landmark_id: "landmark_1"
00033     global_pose {
00034       translation {
00035         x: 1 y: 2 z: 3
00036       }
00037       rotation {
00038         w: 4 x: 5 y: 6 z: 7
00039       }
00040     }
00041   })";
00042 
00043 using SetLandmarkPoseHandlerTest =
00044     testing::HandlerTest<SetLandmarkPoseSignature, SetLandmarkPoseHandler>;
00045 
00046 TEST_F(SetLandmarkPoseHandlerTest, SetLandmarkPose) {
00047   constexpr double kEps = 1e-10;
00048   proto::SetLandmarkPoseRequest request;
00049   EXPECT_TRUE(
00050       google::protobuf::TextFormat::ParseFromString(kMessage, &request));
00051   EXPECT_CALL(
00052       *mock_pose_graph_,
00053       SetLandmarkPose("landmark_1",
00054                       transform::IsNearly(
00055                           transform::Rigid3d(Eigen::Vector3d(1, 2, 3),
00056                                              Eigen::Quaterniond(4, 5, 6, 7)),
00057                           kEps),
00058                       false));
00059   test_server_->SendWrite(request);
00060 }
00061 
00062 }  // namespace
00063 }  // namespace handlers
00064 }  // namespace cloud
00065 }  // namespace cartographer


cartographer
Author(s): The Cartographer Authors
autogenerated on Thu May 9 2019 02:27:36