From b9f0dd0bf8eb7bec991bebd933a0e4df9161c6c9 Mon Sep 17 00:00:00 2001 From: Mirko Waechter <mirko.waechter@kit.edu> Date: Mon, 4 Jul 2016 20:17:15 +0200 Subject: [PATCH] made trajectory example more clear about the meaning of the dimensions --- .../libraries/core/test/TrajectoryTest.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source/RobotAPI/libraries/core/test/TrajectoryTest.cpp b/source/RobotAPI/libraries/core/test/TrajectoryTest.cpp index 834cec402..db6263acd 100644 --- a/source/RobotAPI/libraries/core/test/TrajectoryTest.cpp +++ b/source/RobotAPI/libraries/core/test/TrajectoryTest.cpp @@ -32,19 +32,21 @@ using namespace armarx; BOOST_AUTO_TEST_CASE(TrajectoryBasicUsage) { //! [TrajectoryDocumentation BasicUsage] - Ice::DoubleSeq myPositionValues {0, 5, 1}; // fill with your values; - Ice::DoubleSeq timestamps = Trajectory::GenerateTimestamps(0, 1, 1.0 / (myPositionValues.size() - 1)); // if you dont have timestamps - TrajectoryPtr trajectory(new Trajectory); - trajectory->addDimension(myPositionValues, timestamps, "Shoulder 1 L"); + Ice::DoubleSeq joint1Values {0, 5, 1}; // fill with your values; + Ice::DoubleSeq joint2Values {1, 3, 1}; // fill with your values; + Ice::DoubleSeq joint3Values {0, 2, 5}; // fill with your values; + Ice::DoubleSeq timestamps = Trajectory::GenerateTimestamps(0, 1, 1.0 / (joint1Values.size() - 1)); // if you dont have timestamps + TrajectoryPtr trajectory(new Trajectory(DoubleSeqSeq {joint1Values, joint2Values}, timestamps, {"Shoulder 0 R", "Shoulder 1 R"})); + trajectory->addDimension(joint3Values, timestamps, "Shoulder 2 R"); double timestamp = 0.1; double dimension = 0; double derivation = 0; - double pos = trajectory->getState(timestamp, dimension, derivation); + double j1posAtT = trajectory->getState(timestamp, dimension, derivation); // or - Ice::DoubleSeq positions = trajectory->getDimensionData(dimension, derivation); + Ice::DoubleSeq j1positions = trajectory->getDimensionData(dimension, derivation); //! [TrajectoryDocumentation BasicUsage] - ARMARX_INFO_S << VAROUT(pos) << VAROUT(positions); + ARMARX_INFO_S << VAROUT(j1posAtT) << VAROUT(j1positions); } BOOST_AUTO_TEST_CASE(TrajectoryIteratorUsage) -- GitLab