5 #define TIMEDTRAJECTORY_PROBEFACTOR 100
7 #define TIMEDTRAJECTORY_FPS 100
11 VirtualRobot::TimeOptimalTrajectory& trajectory,
12 std::vector<std::vector<double>>& userPoints,
13 VirtualRobot::RobotNodeSetPtr rns,
22 throw InvalidArgumentException(
"Rns is null");
25 if (rns->getAllRobotNodes().size() == 0)
28 throw InvalidArgumentException(
"Rns is empty");
34 timestep = (timestep > 0) ? timestep : 0.01;
37 if (trajectory.getDuration() < 1)
42 std::vector<double> timestamps;
46 std::vector<std::vector<double>> nodeData;
47 std::vector<std::vector<double>> nodeData2;
50 timestamps.push_back(0);
52 for (
unsigned int i = 0; i < rns->getSize(); i++)
54 nodeData.push_back({trajectory.getPosition(0)[i]});
58 for (
double t = timestep; t < trajectory.getDuration(); t += timestep)
60 Eigen::VectorXd positions = trajectory.getPosition(t);
62 for (
unsigned int i = 0; i < positions.size(); i++)
64 nodeData[i].push_back(positions[i]);
68 timestamps.push_back(t);
71 LimitlessStateSeq state;
72 for (VirtualRobot::RobotNodePtr node : rns->getAllRobotNodes())
74 LimitlessState current;
75 current.enabled = node->isLimitless();
76 current.limitLo = node->getJointLimitLow();
77 current.limitHi = node->getJointLimitHigh();
78 state.push_back(current);
81 Ice::StringSeq dimensionNames = rns->getNodeNames();
87 traj->setLimitless(state);
124 for (pass = 1; pass < 10; pass++)
127 std::vector<double> times;
130 for (
double t = 0; t < trajectory.getDuration();
139 Eigen::VectorXd pointJointAngles = trajectory.getPosition(t);
156 if (i >= userPoints.size())
162 times.push_back(trajectory.getDuration());
170 if (times.size() < userPoints.size())
180 pass == 1 ?
ARMARX_INFO << pass <<
" pass needed to find mapping"
181 :
ARMARX_INFO << pass <<
" passes needed to find mapping";
184 ARMARX_INFO <<
"More than" << pass <<
"passes needed for calculation";
186 throw InvalidArgumentException(
"No TimedTrajectory could be created");