MRPT  1.9.9
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-2018, 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 =
24  typename FrameTransformer<DIM>::pose_t(A2B_);
25  tf.sendTransform("A", "B", real_A2B);
26 
27  // Read:
28  {
29  typename FrameTransformer<DIM>::pose_t A2B_looked_up;
30  const auto ret = tf.lookupTransform("B", "A", A2B_looked_up);
31  EXPECT_EQ(ret, mrpt::poses::LKUP_GOOD);
32  EXPECT_NEAR(
33  .0, (real_A2B.getAsVectorVal() - A2B_looked_up.getAsVectorVal())
34  .array()
35  .abs()
36  .sum(),
37  1e-6);
38  }
39 }
40 
41 TEST(FrameTransformer, SimplePublishAndLookup)
42 {
43  const mrpt::poses::CPose2D test_A2B(5.0, 2.0, 0.3);
44 
45  run_tf_test1<2>(test_A2B);
46  run_tf_test1<3>(test_A2B);
47 }
TEST(FrameTransformer, SimplePublishAndLookup)
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) override
Queries the current pose of target_frame wrt ("as seen from") source_frame.
typename SE_traits< DIM >::pose_t pose_t
This will be mapped to CPose2D (DIM=2) or CPose3D (DIM=3)
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
Definition: CPose2D.h:38
See docs in FrameTransformerInterface.
virtual void sendTransform(const std::string &parent_frame, const std::string &child_frame, const typename base_t::pose_t &child_wrt_parent, const mrpt::system::TTimeStamp &timestamp=mrpt::system::now()) override
void run_tf_test1(const mrpt::poses::CPose2D &A2B_)



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020