Main MRPT website > C++ reference for MRPT 1.5.7
FrameTransformer.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 
10 #include "base-precomp.h" // Precompiled headers
11 
12 #include <mrpt/poses/FrameTransformer.h> // for FrameTransformer, FrameTran...
13 #include <string> // for string
14 #include <mrpt/base/link_pragmas.h> // for BASE_IMPEXP
15 #include <mrpt/system/datetime.h> // for TTimeStamp, INVALID_TIMESTAMP
16 #include <mrpt/utils/mrpt_macros.h> // for ASSERTMSG_
17 
18 using namespace mrpt::poses;
19 
20 // ------- FrameTransformerInterface --------
21 template <int DIM>
23 {
24 }
25 template <int DIM>
27 {
28 }
29 
30 namespace mrpt {
31 namespace poses {
32 // Explicit instantations:
35 }
36 }
37 
38 
39 // ------- FrameTransformer --------
40 template <int DIM>
42 {
43 
44 }
45 template <int DIM>
47 {
48 
49 }
50 
51 template <int DIM>
53  const std::string & parent_frame,
54  const std::string & child_frame,
55  const typename base_t::pose_t & child_wrt_parent,
56  const mrpt::system::TTimeStamp & timestamp)
57 {
58  m_pose_edges_buffer[parent_frame][child_frame] = TF_TreeEdge(child_wrt_parent, timestamp);
59 }
60 
61 // future work: allow graph traversal and do pose chain composition?
62 // We dont need to replicate the full functionality of ROS tf, though... just what we really need.
63 
64 template <int DIM>
66  const std::string & target_frame,
67  const std::string & source_frame,
68  typename base_t::lightweight_pose_t & child_wrt_parent,
69  const mrpt::system::TTimeStamp query_time,
70  const double timeout_secs)
71 {
72  ASSERTMSG_(timeout_secs == .0, "timeout_secs!=0: Blocking calls not supported yet!");
73  ASSERTMSG_(query_time == INVALID_TIMESTAMP, "`query_time` different than 'latest' not supported yet!");
74 
75  const auto &it_src = m_pose_edges_buffer.find(source_frame);
76  if (it_src == m_pose_edges_buffer.end()) {
77  return LKUP_UNKNOWN_FRAME;
78  }
79 
80  const auto &it_dst = it_src->second.find(target_frame);
81  if (it_dst == it_src->second.end()) {
82  return LKUP_NO_CONNECTIVITY;
83  }
84 
85  const TF_TreeEdge & te = it_dst->second;
86  child_wrt_parent = te.pose;
87 
88  return LKUP_GOOD;
89 }
90 
91 namespace mrpt {
92 namespace poses {
93 // Explicit instantations:
96 }
97 }
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:30
SE_traits< DIM >::pose_t pose_t
This will be mapped to CPose2D (DIM=2) or CPose3D (DIM=3)
Virtual base class for interfaces to a ROS tf2-like service capable of "publishing" and "looking-up" ...
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()) MRPT_OVERRIDE
GLsizei const GLchar ** string
Definition: glext.h:3919
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CPoint.h:17
#define INVALID_TIMESTAMP
Represents an invalid timestamp, where applicable.
Definition: datetime.h:17
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define ASSERTMSG_(f, __ERROR_MSG)
SE_traits< DIM >::lightweight_pose_t lightweight_pose_t
This will be mapped to mrpt::math::TPose2D (DIM=2) or mrpt::math::TPose3D (DIM=3) ...
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.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019