1 #define BOOST_TEST_MODULE ArmarX::RobotTrajectoryDesigner::DesignerTrajectoryHolder
2 #define ARMARX_BOOST_TEST
4 #include "../DesignerTrajectoryHolder.h"
6 #include <VirtualRobot/XML/RobotIO.h>
10 #include <RobotComponents/Test.h>
19 QuaternionBasePtr
ori;
24 createPosePkg(
float x,
float y,
float z,
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 new Pose(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);
118 std::vector<double> p1ja = {
119 0.464789, 0.357171, -0.303694, -0.067161, -0.445988, -0.204292, -0.070153};
150 PoseBasePtr p1 = kc->doForwardKinematic(robot->getRobotNodeSet(leftArmName), p1ja);
157 dtm->initializeDesignerTrajectory(p1ja);
158 dtm->addWaypoint(p2);
159 dtm->insertWaypoint(1, p3);
160 dtm->insertWaypoint(0, p4);
167 BOOST_CHECK(!dth->isInCollision(leftArmColModelName, bodyColModelsNames, 10));
173 std::string robotFile =
"/RobotAPI/robots/Armar3/ArmarIII.xml";
178 robot = VirtualRobot::RobotIO::loadRobot(finder.
getDataDir() + robotFile);
182 robot = RobotIO::loadRobot(
183 "../../../../../data/RobotTrajectoryDesigner/Resources/ArmarIII.xml");
188 environment->setRobot(robot);
191 std::string leftArmName = robot->getRobotNodeSet(
"LeftArm")->getName();
194 std::string leftArmColModelName = robot->getRobotNodeSet(
"LeftArmColModel")->getName();
197 std::vector<std::string> bodyColModelsNames;
198 bodyColModelsNames.push_back(robot->getRobotNodeSet(
"TorsoHeadColModel")->getName());
204 dth->createDesignerTrajectoryManager(leftArmName);
208 std::vector<double> p1ja = {
209 0.315176, -0.0275324, 1.00421, 0.0182586, 0.127499, -0.0255035, -0.299747};
239 dtm->initializeDesignerTrajectory(p1ja);
240 dtm->addWaypoint(p9);
242 dtm->setTransitionUserDuration(0, 5.0);
249 BOOST_CHECK(dth->isInCollision(leftArmColModelName, bodyColModelsNames, 10));