Main MRPT website > C++ reference for 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 }
run_tf_test1
void run_tf_test1(const mrpt::poses::CPose2D &A2B_)
Definition: FrameTransformer_unittest.cpp:16
mrpt::poses::LKUP_GOOD
@ LKUP_GOOD
Definition: FrameTransformer.h:23
mrpt::poses::FrameTransformerInterface::pose_t
typename SE_traits< DIM >::pose_t pose_t
This will be mapped to CPose2D (DIM=2) or CPose3D (DIM=3)
Definition: FrameTransformer.h:56
mrpt::poses
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CHierarchicalMapMHPartition.h:25
CPose2D.h
FrameTransformer.h
mrpt::poses::FrameTransformer::sendTransform
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
Definition: FrameTransformer.cpp:50
mrpt::poses::CPose2D
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
Definition: CPose2D.h:40
mrpt::poses::FrameTransformer
See docs in FrameTransformerInterface.
Definition: FrameTransformer.h:91
CPose3D.h
mrpt::poses::FrameTransformer::lookupTransform
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.
Definition: FrameTransformer.cpp:64
TEST
TEST(FrameTransformer, SimplePublishAndLookup)
Definition: FrameTransformer_unittest.cpp:41



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST