1 #define BOOST_TEST_MODULE ArmarX::RobotTrajectoryDesigner::DesignerTrajectoryHolder
2 #define ARMARX_BOOST_TEST
4 #include <RobotComponents/Test.h>
7 #include <VirtualRobot/XML/RobotIO.h>
10 #include "../DesignerTrajectoryHolder.h"
19 QuaternionBasePtr
ori;
24 float qw,
float qx,
float qy,
float qz)
27 posePkg.
pos = Vector3BasePtr(
new Vector3(x, y, z));
28 posePkg.
ori = QuaternionBasePtr(
new Quaternion(qw, qx, qy, qz));
29 PoseBasePtr tmp = PoseBasePtr(
new Pose(posePkg.
pos, posePkg.
ori));
38 robot->getRobotNodeSet(rnsName)->getKinematicRoot()->toLocalCoordinateSystem(
39 (
new Pose(pose->position, pose->orientation))->toEigen())));
45 std::string robotFile =
"/RobotAPI/robots/Armar3/ArmarIII.xml";
50 robot = VirtualRobot::RobotIO::loadRobot(finder.
getDataDir() + robotFile);
54 robot = RobotIO::loadRobot(
55 "../../../../../data/RobotTrajectoryDesigner/Resources/ArmarIII.xml");
59 environment->setRobot(robot);
62 VirtualRobot::RobotNodeSetPtr rnsLeftArm = robot->getRobotNodeSets()[10];
65 VirtualRobot::RobotNodeSetPtr rnsRightArm = robot->getRobotNodeSet(
"RightArm");
71 dth->createDesignerTrajectoryManager(rnsLeftArm->getName());
73 BOOST_CHECK(dth->rnsExists(rnsLeftArm->getName()));
74 BOOST_CHECK(!dth->rnsExists(rnsRightArm->getName()));
75 BOOST_CHECK(!dth->rnsIsPartOfExistingRns(rnsRightArm->getName()));
81 std::string robotFile =
"/RobotAPI/robots/Armar3/ArmarIII.xml";
86 robot = VirtualRobot::RobotIO::loadRobot(finder.
getDataDir() + robotFile);
90 robot = RobotIO::loadRobot(
91 "../../../../../data/RobotTrajectoryDesigner/Resources/ArmarIII.xml");
97 environment->setRobot(robot);
100 std::string leftArmName = robot->getRobotNodeSet(
"LeftArm")->getName();
103 std::string leftArmColModelName = robot->getRobotNodeSet(
"LeftArmColModel")->getName();
106 std::vector<std::string> bodyColModelsNames;
107 bodyColModelsNames.push_back(robot->getRobotNodeSet(
"TorsoHeadColModel")->getName());
113 dth->createDesignerTrajectoryManager(leftArmName);
120 std::vector<double> p1ja = { 0.464789, 0.357171, -0.303694, -0.067161, -0.445988, -0.204292, -0.070153};
122 PosePkg pp4 =
createPosePkg(-316.302246093750, 777.949218750, 1194.246459960938, 0.5907033681869507, -0.5503066778182983, 0.4992305040359497, 0.3146440684795380);
123 PosePkg pp2 =
createPosePkg(-182.23925781250, 580.074218750, 1034.98925781250, 0.4338901340961456, -0.4268467724323273, 0.5642792582511902, 0.5577904582023621);
124 PosePkg pp3 =
createPosePkg(-226.792480468750, 580.723144531250, 1186.157348632812, 0.4336481690406799, -0.4273631870746613, 0.5638203620910645, 0.5580471754074097);
125 PosePkg pp5 =
createPosePkg(-348.304718, 580.476440, 712.264465, 0.4453609585762024, -0.4538218379020691, 0.5429607033729553, 0.5485371351242065);
127 PoseBasePtr p1 = kc->doForwardKinematic(robot->getRobotNodeSet(leftArmName), p1ja);
134 dtm->initializeDesignerTrajectory(p1ja);
135 dtm->addWaypoint(p2);
136 dtm->insertWaypoint(1, p3);
137 dtm->insertWaypoint(0, p4);
144 BOOST_CHECK(!dth->isInCollision(leftArmColModelName, bodyColModelsNames, 10));
150 std::string robotFile =
"/RobotAPI/robots/Armar3/ArmarIII.xml";
155 robot = VirtualRobot::RobotIO::loadRobot(finder.
getDataDir() + robotFile);
159 robot = RobotIO::loadRobot(
160 "../../../../../data/RobotTrajectoryDesigner/Resources/ArmarIII.xml");
165 environment->setRobot(robot);
168 std::string leftArmName = robot->getRobotNodeSet(
"LeftArm")->getName();
171 std::string leftArmColModelName = robot->getRobotNodeSet(
"LeftArmColModel")->getName();
174 std::vector<std::string> bodyColModelsNames;
175 bodyColModelsNames.push_back(robot->getRobotNodeSet(
"TorsoHeadColModel")->getName());
181 dth->createDesignerTrajectoryManager(leftArmName);
185 std::vector<double> p1ja = { 0.315176, -0.0275324, 1.00421, 0.0182586, 0.127499, -0.0255035, -0.299747};
186 PosePkg pp1 =
createPosePkg(56.5798, 233.545, 992.508, 0.4453609585762024, -0.4538218379020691, 0.5429607033729553, 0.5485371351242065);
187 PosePkg pp2 =
createPosePkg(-95.4907, 761.478, 1208.03, 0.4338901340961456, -0.4268467724323273, 0.5642792582511902, 0.5577904582023621);
189 PosePkg pp9 =
createPosePkg(-182.23925781250, 580.074218750, 1034.98925781250, 0.4338901340961456, -0.4268467724323273, 0.5642792582511902, 0.5577904582023621);
197 dtm->initializeDesignerTrajectory(p1ja);
198 dtm->addWaypoint(p9);
200 dtm->setTransitionUserDuration(0, 5.0);
207 BOOST_CHECK(dth->isInCollision(leftArmColModelName, bodyColModelsNames, 10));