1 #define BOOST_TEST_MODULE ArmarX::RobotTrajectoryDesigner::DesignerTrajectory
2 #define ARMARX_BOOST_TEST
4 #include <RobotComponents/Test.h>
6 #include "../DesignerTrajectory.h"
7 #include "../Util/OrientationConversion.h"
8 #include <VirtualRobot/XML/RobotIO.h>
15 bool 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() &&
23 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()) ? true : false ;
49 Vector3BasePtr pos1 = Vector3BasePtr(
new Vector3(1, 2, 3));
51 PoseBasePtr pose1 = PoseBasePtr(
new Pose(pos1, ori1));
53 Vector3BasePtr pos2 = Vector3BasePtr(
new Vector3(4, 5, 6));
55 PoseBasePtr pose2 = PoseBasePtr(
new Pose(pos2, ori2));
57 Vector3BasePtr pos3 = Vector3BasePtr(
new Vector3(7, 8, 9));
59 PoseBasePtr pose3 = PoseBasePtr(
new Pose(pos3, ori3));
61 Vector3BasePtr pos4 = Vector3BasePtr(
new Vector3(10, 11, 12));
63 PoseBasePtr pose4 = PoseBasePtr(
new Pose(pos4, ori4));
66 w1->setJointAngles({1, 2, 3, 4, 5, 6, 7});
72 std::string robotFile =
"/RobotAPI/robots/Armar3/ArmarIII.xml";
77 robot = VirtualRobot::RobotIO::loadRobot(finder.
getDataDir() + robotFile);
80 VirtualRobot::RobotNodeSetPtr rns = robot->getRobotNodeSet(robot->getRobotNodeSetNames()[0]);
82 w1->setUserTimestamp(10);
83 w2->setUserTimestamp(20);
84 w3->setUserTimestamp(30);
92 BOOST_CHECK_THROW(dt1.
getTransition(2), IndexOutOfBoundsException);
109 BOOST_CHECK_THROW(dt1.
getTransition(2), IndexOutOfBoundsException);
118 Vector3BasePtr pos1 = Vector3BasePtr(
new Vector3(1, 2, 3));
120 PoseBasePtr pose1 = PoseBasePtr(
new Pose(pos1, ori1));
122 w1->setJointAngles({1, 2, 3, 4, 5, 6, 7});
125 std::string robotFile =
"/RobotAPI/robots/Armar3/ArmarIII.xml";
130 robot = VirtualRobot::RobotIO::loadRobot(finder.
getDataDir() + robotFile);
134 robot = VirtualRobot::RobotIO::loadRobot(
135 "../../../../../data/RobotTrajectoryDesigner/Resources/ArmarIII.xml");
137 VirtualRobot::RobotNodeSetPtr rns = robot->getRobotNodeSet(robot->getRobotNodeSetNames()[0]);
141 std::vector<std::vector<double>> data1 =
151 std::vector<std::vector<double>> data2 =
161 std::vector<std::vector<double>> data3 =
172 Ice::DoubleSeq timestamps1 = {0, 1, 2, 3, 4};
173 Ice::DoubleSeq timestamps2 = {0, 1, 2, 3, 4};
174 Ice::DoubleSeq timestamps3 = {0, 1, 2, 3, 4};
175 Ice::StringSeq dimensionNames = {
"a",
"b",
"c",
"d",
"e",
"f",
"g"};
186 std::vector<std::vector<double>> data4 =
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},
190 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
191 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
192 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
193 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
194 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}
197 Ice::DoubleSeq timestamps4 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
203 BOOST_CHECK_EQUAL(traj5->getDimensionData(0), traj4->getDimensionData(0));
204 BOOST_CHECK_EQUAL(traj5->getDimensionData(1), traj4->getDimensionData(1));
205 BOOST_CHECK_EQUAL(traj5->getDimensionData(2), traj4->getDimensionData(2));
206 BOOST_CHECK_EQUAL(traj5->getDimensionData(3), traj4->getDimensionData(3));
207 BOOST_CHECK_EQUAL(traj5->getDimensionData(4), traj4->getDimensionData(4));
208 BOOST_CHECK_EQUAL(traj5->getDimensionData(5), traj4->getDimensionData(5));
209 BOOST_CHECK_EQUAL(traj5->getDimensionData(6), traj4->getDimensionData(6));
211 BOOST_CHECK_EQUAL(traj5->getTimestamps(), traj4->getTimestamps());
214 BOOST_CHECK_EQUAL(traj5->getDerivations(1, 0, 2), traj4->getDerivations(1, 0, 2));
215 BOOST_CHECK_EQUAL(traj5->getDerivations(3, 0, 2), traj4->getDerivations(3, 0, 2));
216 BOOST_CHECK_EQUAL(traj5->getDerivations(5, 0, 2), traj4->getDerivations(5, 0, 2));
217 BOOST_CHECK_EQUAL(traj5->getDerivations(7, 0, 2), traj4->getDerivations(7, 0, 2));
218 BOOST_CHECK_EQUAL(traj5->getDerivations(9, 0, 2), traj4->getDerivations(9, 0, 2));
219 BOOST_CHECK_EQUAL(traj5->getDerivations(11, 0, 2), traj4->getDerivations(11, 0, 2));