Main MRPT website > C++ reference for MRPT 1.5.7
CPose2DInterpolator_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/system/datetime.h>
12 #include <gtest/gtest.h>
13 
14 
15 TEST(CPose2DInterpolator,interp)
16 {
17  using namespace mrpt::poses;
18  using mrpt::math::TPose2D;
20 
23 
24  CPose2DInterpolator pose_path;
25 
26  pose_path.insert( t0, TPose2D(1.,2.,DEG2RAD(30.0)) );
27  pose_path.insert( t0+2*dt, TPose2D(1.+3.,2.+4., DEG2RAD(30.0+20.0) ));
28 
29  TPose2D interp;
30  bool valid;
31  pose_path.interpolate(t0+dt,interp,valid);
32 
33  EXPECT_TRUE(valid);
34 
35  const TPose2D interp_good(1.+1.5,2.+2.0,DEG2RAD(30.0+10.0) );
36  for (unsigned int i=0;i<interp_good.size();i++) {
37  EXPECT_NEAR(interp_good[i], interp[i], 1e-4);
38  }
39 }
40 
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:30
This class stores a time-stamped trajectory in SE(2) (mrpt::math::TPose2D poses). ...
double DEG2RAD(const double x)
Degrees to radians.
mrpt::system::TTimeStamp now()
A shortcut for system::getCurrentTime.
Definition: datetime.h:70
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...
void insert(mrpt::system::TTimeStamp t, const pose_t &p)
Inserts a new pose in the sequence.
#define DEG2RAD
TEST(CPose2DInterpolator, interp)
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CPoint.h:17
Lightweight 2D pose.
mrpt::system::TTimeStamp BASE_IMPEXP secondsToTimestamp(const double nSeconds)
Transform a time interval (in seconds) into TTimeStamp (e.g.
Definition: datetime.cpp:219
GLuint interp
Definition: glext.h:6197



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