Main MRPT website > C++ reference for MRPT 1.5.6
FrameTransformer_unittest.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
11 #include <mrpt/poses/CPose2D.h>
12 #include <mrpt/poses/CPose3D.h>
13 #include <gtest/gtest.h>
14 
15 template <int DIM>
17 {
18  using namespace mrpt::poses;
19 
21 
22  // Pub:
23  const typename FrameTransformer<DIM>::pose_t real_A2B = typename FrameTransformer<DIM>::pose_t(A2B_);
24  tf.sendTransform("A","B", real_A2B);
25 
26  // Read:
27  {
28  typename FrameTransformer<DIM>::pose_t A2B_looked_up;
29  const auto ret = tf.lookupTransform("B", "A", A2B_looked_up);
30  EXPECT_EQ(ret, mrpt::poses::LKUP_GOOD);
31  EXPECT_NEAR(.0, (real_A2B.getAsVectorVal() - A2B_looked_up.getAsVectorVal()).array().abs().sum(), 1e-6);
32  }
33 
34 }
35 
36 TEST(FrameTransformer,SimplePublishAndLookup)
37 {
38  const mrpt::poses::CPose2D test_A2B(5.0, 2.0, 0.3);
39 
40  run_tf_test1<2>(test_A2B);
41  run_tf_test1<3>(test_A2B);
42 }
SE_traits< DIM >::pose_t pose_t
This will be mapped to CPose2D (DIM=2) or CPose3D (DIM=3)
TEST(FrameTransformer, SimplePublishAndLookup)
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
Definition: CPose2D.h:36
See docs in FrameTransformerInterface.
void run_tf_test1(const mrpt::poses::CPose2D &A2B_)
virtual FrameLookUpStatus lookupTransform(const std::string &target_frame, const std::string &source_frame, typename base_t::lightweight_pose_t &child_wrt_parent, const mrpt::system::TTimeStamp query_time=INVALID_TIMESTAMP, const double timeout_secs=.0) MRPT_OVERRIDE
Queries the current pose of target_frame wrt ("as seen from") source_frame.



Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018