1 #define BOOST_TEST_MODULE ArmarX::RobotTrajectoryDesigner::DesignerTrajectory
2 #define ARMARX_BOOST_TEST
4 #include <VirtualRobot/XML/RobotIO.h>
6 #include "../../../../../build/testing/RobotTrajectoryDesigner/Test.h"
7 #include "../DesignerTrajectory.h"
8 #include "../Util/OrientationConversion.h"
15 equalPose(PoseBasePtr p1, PoseBasePtr p2)
17 QuaternionPtr q1 = QuaternionPtr::dynamicCast(p1->orientation);
18 QuaternionPtr q2 = QuaternionPtr::dynamicCast(p2->orientation);
19 Vector3Ptr pos1 = Vector3Ptr::dynamicCast(p1->position);
20 Vector3Ptr pos2 = Vector3Ptr::dynamicCast(p2->position);
22 if (q1->toEigen() == q2->toEigen() && pos1->toEigen() == pos2->toEigen())
35 return (w1->getIKSelection() == w2->getIKSelection() &&
36 w1->getIsTimeOptimalBreakpoint() == w2->getIsTimeOptimalBreakpoint() &&
37 w1->getJointAngles() == w2->getJointAngles() &&
38 equalPose(w1->getPose(), w2->getPose()) &&
39 w1->getTimeOptimalTimestamp() == w1->getTimeOptimalTimestamp() &&
40 w1->getUserTimestamp() == w2->getUserTimestamp())
51 Vector3BasePtr pos1 = Vector3BasePtr(
new Vector3(1, 2, 3));
53 PoseBasePtr pose1 = PoseBasePtr(
new Pose(pos1, ori1));
55 Vector3BasePtr pos2 = Vector3BasePtr(
new Vector3(4, 5, 6));
57 PoseBasePtr pose2 = PoseBasePtr(
new Pose(pos2, ori2));
59 Vector3BasePtr pos3 = Vector3BasePtr(
new Vector3(7, 8, 9));
61 PoseBasePtr pose3 = PoseBasePtr(
new Pose(pos3, ori3));
63 Vector3BasePtr pos4 = Vector3BasePtr(
new Vector3(10, 11, 12));
65 PoseBasePtr pose4 = PoseBasePtr(
new Pose(pos4, ori4));
68 w1->setJointAngles({1, 2, 3, 4, 5, 6, 7});
74 "../../../../../data/RobotTrajectoryDesigner/Resources/ArmarIII.xml");
76 VirtualRobot::RobotNodeSetPtr rns = robot->getRobotNodeSet(robot->getRobotNodeSetNames()[0]);
78 w1->setUserTimestamp(10);
79 w2->setUserTimestamp(20);
80 w3->setUserTimestamp(30);
88 BOOST_CHECK_THROW(dt1.
getTransition(2), IndexOutOfBoundsException);
106 IndexOutOfBoundsException);
115 Vector3BasePtr pos1 = Vector3BasePtr(
new Vector3(1, 2, 3));
117 PoseBasePtr pose1 = PoseBasePtr(
new Pose(pos1, ori1));
120 "../../../../../data/RobotTrajectoryDesigner/Resources/ArmarIII.xml");
121 VirtualRobot::RobotNodeSetPtr rns = robot->getRobotNodeSet(robot->getRobotNodeSetNames()[0]);
125 std::vector<std::vector<double>> data1 = {{1, 2, 3, 4, 5},
132 std::vector<std::vector<double>> data2 = {{5, 6, 7, 8, 9},
139 std::vector<std::vector<double>> data3 = {{9, 10, 11, 12, 13},
145 {9, 10, 11, 12, 13}};
147 Ice::DoubleSeq timestamps1 = {0, 1, 2, 3, 4};
148 Ice::DoubleSeq timestamps2 = {0, 1, 2, 3, 4};
149 Ice::DoubleSeq timestamps3 = {0, 1, 2, 3, 4};
150 Ice::StringSeq dimensionNames = {
"a",
"b",
"c",
"d",
"e",
"f",
"g"};
161 std::vector<std::vector<double>> data4 = {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
162 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
163 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
164 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
165 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
166 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
167 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}};
169 Ice::DoubleSeq timestamps4 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
175 BOOST_CHECK_EQUAL(traj5->getDimensionData(0), traj4->getDimensionData(0));
176 BOOST_CHECK_EQUAL(traj5->getDimensionData(1), traj4->getDimensionData(1));
177 BOOST_CHECK_EQUAL(traj5->getDimensionData(2), traj4->getDimensionData(2));
178 BOOST_CHECK_EQUAL(traj5->getDimensionData(3), traj4->getDimensionData(3));
179 BOOST_CHECK_EQUAL(traj5->getDimensionData(4), traj4->getDimensionData(4));
180 BOOST_CHECK_EQUAL(traj5->getDimensionData(5), traj4->getDimensionData(5));
181 BOOST_CHECK_EQUAL(traj5->getDimensionData(6), traj4->getDimensionData(6));
183 BOOST_CHECK_EQUAL(traj5->getTimestamps(), traj4->getTimestamps());
186 BOOST_CHECK_EQUAL(traj5->getDerivations(1, 0, 2), traj4->getDerivations(1, 0, 2));
187 BOOST_CHECK_EQUAL(traj5->getDerivations(3, 0, 2), traj4->getDerivations(3, 0, 2));
188 BOOST_CHECK_EQUAL(traj5->getDerivations(5, 0, 2), traj4->getDerivations(5, 0, 2));
189 BOOST_CHECK_EQUAL(traj5->getDerivations(7, 0, 2), traj4->getDerivations(7, 0, 2));
190 BOOST_CHECK_EQUAL(traj5->getDerivations(9, 0, 2), traj4->getDerivations(9, 0, 2));
191 BOOST_CHECK_EQUAL(traj5->getDerivations(11, 0, 2), traj4->getDerivations(11, 0, 2));