1 #define BOOST_TEST_MODULE ArmarX::RobotTrajectoryDesigner::DesignerTrajectory
2 #define ARMARX_BOOST_TEST
4 #include "../../../../../build/testing/RobotTrajectoryDesigner/Test.h"
5 #include "../DesignerTrajectory.h"
6 #include "../Util/OrientationConversion.h"
7 #include <VirtualRobot/XML/RobotIO.h>
13 bool equalPose(PoseBasePtr p1, PoseBasePtr p2)
15 QuaternionPtr q1 = QuaternionPtr::dynamicCast(p1->orientation);
16 QuaternionPtr q2 = QuaternionPtr::dynamicCast(p2->orientation);
17 Vector3Ptr pos1 = Vector3Ptr::dynamicCast(p1->position);
18 Vector3Ptr pos2 = Vector3Ptr::dynamicCast(p2->position);
20 if (q1->toEigen() == q2->toEigen() &&
21 pos1->toEigen() == pos2->toEigen())
33 return (w1->getIKSelection() == w2->getIKSelection() &&
34 w1->getIsTimeOptimalBreakpoint() == w2->getIsTimeOptimalBreakpoint() &&
35 w1->getJointAngles() == w2->getJointAngles() &&
36 equalPose(w1->getPose(), w2->getPose()) &&
37 w1->getTimeOptimalTimestamp() == w1->getTimeOptimalTimestamp() &&
38 w1->getUserTimestamp() == w2->getUserTimestamp()) ? true : false ;
47 Vector3BasePtr pos1 = Vector3BasePtr(
new Vector3(1, 2, 3));
49 PoseBasePtr pose1 = PoseBasePtr(
new Pose(pos1, ori1));
51 Vector3BasePtr pos2 = Vector3BasePtr(
new Vector3(4, 5, 6));
53 PoseBasePtr pose2 = PoseBasePtr(
new Pose(pos2, ori2));
55 Vector3BasePtr pos3 = Vector3BasePtr(
new Vector3(7, 8, 9));
57 PoseBasePtr pose3 = PoseBasePtr(
new Pose(pos3, ori3));
59 Vector3BasePtr pos4 = Vector3BasePtr(
new Vector3(10, 11, 12));
61 PoseBasePtr pose4 = PoseBasePtr(
new Pose(pos4, ori4));
64 w1->setJointAngles({1, 2, 3, 4, 5, 6, 7});
70 "../../../../../data/RobotTrajectoryDesigner/Resources/ArmarIII.xml");
72 VirtualRobot::RobotNodeSetPtr rns = robot->getRobotNodeSet(robot->getRobotNodeSetNames()[0]);
74 w1->setUserTimestamp(10);
75 w2->setUserTimestamp(20);
76 w3->setUserTimestamp(30);
84 BOOST_CHECK_THROW(dt1.
getTransition(2), IndexOutOfBoundsException);
101 BOOST_CHECK_THROW(dt1.
getTransition(2), IndexOutOfBoundsException);
110 Vector3BasePtr pos1 = Vector3BasePtr(
new Vector3(1, 2, 3));
112 PoseBasePtr pose1 = PoseBasePtr(
new Pose(pos1, ori1));
115 "../../../../../data/RobotTrajectoryDesigner/Resources/ArmarIII.xml");
116 VirtualRobot::RobotNodeSetPtr rns = robot->getRobotNodeSet(robot->getRobotNodeSetNames()[0]);
120 std::vector<std::vector<double>> data1 =
130 std::vector<std::vector<double>> data2 =
140 std::vector<std::vector<double>> data3 =
151 Ice::DoubleSeq timestamps1 = {0, 1, 2, 3, 4};
152 Ice::DoubleSeq timestamps2 = {0, 1, 2, 3, 4};
153 Ice::DoubleSeq timestamps3 = {0, 1, 2, 3, 4};
154 Ice::StringSeq dimensionNames = {
"a",
"b",
"c",
"d",
"e",
"f",
"g"};
165 std::vector<std::vector<double>> data4 =
167 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
168 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
169 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
170 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
171 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
172 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
173 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}
176 Ice::DoubleSeq timestamps4 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
182 BOOST_CHECK_EQUAL(traj5->getDimensionData(0), traj4->getDimensionData(0));
183 BOOST_CHECK_EQUAL(traj5->getDimensionData(1), traj4->getDimensionData(1));
184 BOOST_CHECK_EQUAL(traj5->getDimensionData(2), traj4->getDimensionData(2));
185 BOOST_CHECK_EQUAL(traj5->getDimensionData(3), traj4->getDimensionData(3));
186 BOOST_CHECK_EQUAL(traj5->getDimensionData(4), traj4->getDimensionData(4));
187 BOOST_CHECK_EQUAL(traj5->getDimensionData(5), traj4->getDimensionData(5));
188 BOOST_CHECK_EQUAL(traj5->getDimensionData(6), traj4->getDimensionData(6));
190 BOOST_CHECK_EQUAL(traj5->getTimestamps(), traj4->getTimestamps());
193 BOOST_CHECK_EQUAL(traj5->getDerivations(1, 0, 2), traj4->getDerivations(1, 0, 2));
194 BOOST_CHECK_EQUAL(traj5->getDerivations(3, 0, 2), traj4->getDerivations(3, 0, 2));
195 BOOST_CHECK_EQUAL(traj5->getDerivations(5, 0, 2), traj4->getDerivations(5, 0, 2));
196 BOOST_CHECK_EQUAL(traj5->getDerivations(7, 0, 2), traj4->getDerivations(7, 0, 2));
197 BOOST_CHECK_EQUAL(traj5->getDerivations(9, 0, 2), traj4->getDerivations(9, 0, 2));
198 BOOST_CHECK_EQUAL(traj5->getDerivations(11, 0, 2), traj4->getDerivations(11, 0, 2));