Main MRPT website > C++ reference for MRPT 1.9.9
CPose3DInterpolator_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 
10 #include <mrpt/poses/CPose3D.h>
12 #include <mrpt/system/datetime.h>
13 #include <CTraitsTest.h>
14 #include <gtest/gtest.h>
15 
16 template class mrpt::CTraitsTest<mrpt::poses::CPose3DInterpolator>;
17 
18 TEST(CPose3DInterpolator, interp)
19 {
20  using namespace mrpt::poses;
21  using mrpt::math::TPose3D;
23  using mrpt::DEG2RAD;
24 
27 
28  CPose3DInterpolator pose_path;
29 
30  pose_path.insert(
31  t0, TPose3D(1., 2., 3., DEG2RAD(30.0), DEG2RAD(.0), DEG2RAD(.0)));
32  pose_path.insert(
33  t0 + 2 * dt, TPose3D(
34  1. + 3., 2. + 4., 3. + 5., DEG2RAD(30.0 + 20.0),
35  DEG2RAD(.0), DEG2RAD(.0)));
36 
37  TPose3D interp;
38  bool valid;
39  pose_path.interpolate(t0 + dt, interp, valid);
40 
41  EXPECT_TRUE(valid);
42  const TPose3D interp_good(
43  1. + 1.5, 2. + 2.0, 3. + 2.5, DEG2RAD(30.0 + 10.0), DEG2RAD(.0),
44  DEG2RAD(.0));
45  EXPECT_NEAR(
46  .0, (CPose3D(interp_good).getHomogeneousMatrixVal<CMatrixDouble44>() -
47  CPose3D(interp).getHomogeneousMatrixVal<CMatrixDouble44>())
48  .array()
49  .abs()
50  .sum(),
51  1e-4);
52 }
mrpt::math::sum
CONTAINER::Scalar sum(const CONTAINER &v)
Computes the sum of all the elements.
Definition: ops_containers.h:211
mrpt::system::secondsToTimestamp
mrpt::system::TTimeStamp secondsToTimestamp(const double nSeconds)
Transform a time interval (in seconds) into TTimeStamp (e.g.
Definition: datetime.cpp:224
mrpt::system::now
mrpt::system::TTimeStamp now()
A shortcut for system::getCurrentTime.
Definition: datetime.h:75
mrpt::poses::CPoseInterpolatorBase::interpolate
pose_t & interpolate(mrpt::system::TTimeStamp t, pose_t &out_interp, bool &out_valid_interp) const
Returns the pose at a given time, or interpolates using splines if there is not an exact match.
Definition: CPoseInterpolatorBase.hpp:59
interp
GLuint interp
Definition: glext.h:7133
mrpt::poses
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CHierarchicalMapMHPartition.h:25
CPose3DInterpolator.h
mrpt::poses::CPose3DInterpolator
This class stores a time-stamped trajectory in SE(3) (CPose3D poses).
Definition: CPose3DInterpolator.h:49
mrpt::system::TTimeStamp
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1,...
Definition: datetime.h:31
mrpt::poses::CPoseInterpolatorBase::insert
void insert(mrpt::system::TTimeStamp t, const pose_t &p)
Inserts a new pose in the sequence.
Definition: CPoseInterpolatorBase.hpp:41
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::math::TPose3D
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
Definition: lightweight_geom_data.h:603
CPose3D.h
mrpt::math::CMatrixDouble44
CMatrixFixedNumeric< double, 4, 4 > CMatrixDouble44
Definition: eigen_frwds.h:58
TEST
TEST(CPose3DInterpolator, interp)
Definition: CPose3DInterpolator_unittest.cpp:18
datetime.h
mrpt::DEG2RAD
double DEG2RAD(const double x)
Degrees to radians.
Definition: core/include/mrpt/core/bits_math.h:42



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