1 #define BOOST_TEST_MODULE ArmarX::RobotTrajectoryDesigner::DesignerTrajectory
2 #define ARMARX_BOOST_TEST
4 #include <VirtualRobot/XML/RobotIO.h>
8 #include <RobotComponents/Test.h>
10 #include "../DesignerTrajectory.h"
11 #include "../Util/OrientationConversion.h"
18 equalPose(PoseBasePtr p1, PoseBasePtr p2)
20 QuaternionPtr q1 = QuaternionPtr::dynamicCast(p1->orientation);
21 QuaternionPtr q2 = QuaternionPtr::dynamicCast(p2->orientation);
22 Vector3Ptr pos1 = Vector3Ptr::dynamicCast(p1->position);
23 Vector3Ptr pos2 = Vector3Ptr::dynamicCast(p2->position);
25 if (q1->toEigen() == q2->toEigen() && pos1->toEigen() == pos2->toEigen())
38 return (w1->getIKSelection() == w2->getIKSelection() &&
39 w1->getIsTimeOptimalBreakpoint() == w2->getIsTimeOptimalBreakpoint() &&
40 w1->getJointAngles() == w2->getJointAngles() &&
41 equalPose(w1->getPose(), w2->getPose()) &&
42 w1->getTimeOptimalTimestamp() == w1->getTimeOptimalTimestamp() &&
43 w1->getUserTimestamp() == w2->getUserTimestamp())
54 Vector3BasePtr pos1 = Vector3BasePtr(
new Vector3(1, 2, 3));
56 PoseBasePtr pose1 = PoseBasePtr(
new Pose(pos1, ori1));
58 Vector3BasePtr pos2 = Vector3BasePtr(
new Vector3(4, 5, 6));
60 PoseBasePtr pose2 = PoseBasePtr(
new Pose(pos2, ori2));
62 Vector3BasePtr pos3 = Vector3BasePtr(
new Vector3(7, 8, 9));
64 PoseBasePtr pose3 = PoseBasePtr(
new Pose(pos3, ori3));
66 Vector3BasePtr pos4 = Vector3BasePtr(
new Vector3(10, 11, 12));
68 PoseBasePtr pose4 = PoseBasePtr(
new Pose(pos4, ori4));
71 w1->setJointAngles({1, 2, 3, 4, 5, 6, 7});
77 std::string robotFile =
"/RobotAPI/robots/Armar3/ArmarIII.xml";
82 robot = VirtualRobot::RobotIO::loadRobot(finder.
getDataDir() + robotFile);
85 VirtualRobot::RobotNodeSetPtr rns = robot->getRobotNodeSet(robot->getRobotNodeSetNames()[0]);
87 w1->setUserTimestamp(10);
88 w2->setUserTimestamp(20);
89 w3->setUserTimestamp(30);
97 BOOST_CHECK_THROW(dt1.
getTransition(2), IndexOutOfBoundsException);
115 IndexOutOfBoundsException);
124 Vector3BasePtr pos1 = Vector3BasePtr(
new Vector3(1, 2, 3));
126 PoseBasePtr pose1 = PoseBasePtr(
new Pose(pos1, ori1));
128 w1->setJointAngles({1, 2, 3, 4, 5, 6, 7});
131 std::string robotFile =
"/RobotAPI/robots/Armar3/ArmarIII.xml";
136 robot = VirtualRobot::RobotIO::loadRobot(finder.
getDataDir() + robotFile);
140 robot = VirtualRobot::RobotIO::loadRobot(
141 "../../../../../data/RobotTrajectoryDesigner/Resources/ArmarIII.xml");
143 VirtualRobot::RobotNodeSetPtr rns = robot->getRobotNodeSet(robot->getRobotNodeSetNames()[0]);
147 std::vector<std::vector<double>> data1 = {{1, 2, 3, 4, 5},
154 std::vector<std::vector<double>> data2 = {{5, 6, 7, 8, 9},
161 std::vector<std::vector<double>> data3 = {{9, 10, 11, 12, 13},
167 {9, 10, 11, 12, 13}};
169 Ice::DoubleSeq timestamps1 = {0, 1, 2, 3, 4};
170 Ice::DoubleSeq timestamps2 = {0, 1, 2, 3, 4};
171 Ice::DoubleSeq timestamps3 = {0, 1, 2, 3, 4};
172 Ice::StringSeq dimensionNames = {
"a",
"b",
"c",
"d",
"e",
"f",
"g"};
183 std::vector<std::vector<double>> data4 = {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
184 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
185 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
186 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
187 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
188 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
189 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}};
191 Ice::DoubleSeq timestamps4 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
197 BOOST_CHECK_EQUAL(traj5->getDimensionData(0), traj4->getDimensionData(0));
198 BOOST_CHECK_EQUAL(traj5->getDimensionData(1), traj4->getDimensionData(1));
199 BOOST_CHECK_EQUAL(traj5->getDimensionData(2), traj4->getDimensionData(2));
200 BOOST_CHECK_EQUAL(traj5->getDimensionData(3), traj4->getDimensionData(3));
201 BOOST_CHECK_EQUAL(traj5->getDimensionData(4), traj4->getDimensionData(4));
202 BOOST_CHECK_EQUAL(traj5->getDimensionData(5), traj4->getDimensionData(5));
203 BOOST_CHECK_EQUAL(traj5->getDimensionData(6), traj4->getDimensionData(6));
205 BOOST_CHECK_EQUAL(traj5->getTimestamps(), traj4->getTimestamps());
208 BOOST_CHECK_EQUAL(traj5->getDerivations(1, 0, 2), traj4->getDerivations(1, 0, 2));
209 BOOST_CHECK_EQUAL(traj5->getDerivations(3, 0, 2), traj4->getDerivations(3, 0, 2));
210 BOOST_CHECK_EQUAL(traj5->getDerivations(5, 0, 2), traj4->getDerivations(5, 0, 2));
211 BOOST_CHECK_EQUAL(traj5->getDerivations(7, 0, 2), traj4->getDerivations(7, 0, 2));
212 BOOST_CHECK_EQUAL(traj5->getDerivations(9, 0, 2), traj4->getDerivations(9, 0, 2));
213 BOOST_CHECK_EQUAL(traj5->getDerivations(11, 0, 2), traj4->getDerivations(11, 0, 2));