From 73c8512756b930133d75327ec539ce7ae72ca84b Mon Sep 17 00:00:00 2001 From: Mirko Waechter <mirko.waechter@kit.edu> Date: Sun, 5 Aug 2018 02:43:06 +0200 Subject: [PATCH] trajectory: added time shift test --- .../RobotAPI/libraries/core/test/TrajectoryTest.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/RobotAPI/libraries/core/test/TrajectoryTest.cpp b/source/RobotAPI/libraries/core/test/TrajectoryTest.cpp index 3eeb0ae51..579c35d22 100644 --- a/source/RobotAPI/libraries/core/test/TrajectoryTest.cpp +++ b/source/RobotAPI/libraries/core/test/TrajectoryTest.cpp @@ -319,4 +319,17 @@ BOOST_AUTO_TEST_CASE(TrajectoryControllerUnfoldingTest) } +BOOST_AUTO_TEST_CASE(TrajectoryShiftTimeTest) +{ + FloatSeqSeq positions {{ 0, 0, 1 }, { 0, 1, 1 }}; + TrajectoryPtr traj = new Trajectory(positions, {}, {"joint1", "joint2"}); + ARMARX_INFO << VAROUT(traj->getDimensionNames()); + auto startTime = traj->begin()->timestamp; + auto shift = 2.0; + traj->shiftTime(shift); + ARMARX_INFO << "pos: " << traj->begin()->getPosition(0); + BOOST_CHECK_LE(std::abs(startTime + shift - traj->begin()->timestamp), 0.0001); + ARMARX_INFO << VAROUT(traj->getDimensionNames()); + BOOST_CHECK_EQUAL(traj->getDimensionNames().at(0), "joint1"); +} -- GitLab