TrajectoryPlayer.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package RobotComponents::ArmarXObjects::TrajectoryPlayer
17  * @author zhou ( derekyou dot zhou at gmail dot com )
18  * @date 2016
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #include "TrajectoryPlayer.h"
26 #include <SimoxUtility/math/convert.h>
27 
28 
29 using namespace armarx;
30 
31 #define STATE_POSITION 0
32 #define STATE_VELOCITY 1
33 #define STATE_ACCELERATION 2
34 
35 bool TrajectoryPlayer::startTrajectoryPlayer(const Ice::Current&)
36 {
37  direction = 1;
38  timeOffset = 0;
39 
40 
41  if (isPreview)
42  {
43  ARMARX_INFO << "robot file name : " << kinematicUnit->getRobotFilename();
44  debugDrawer->setRobotVisu("Preview", "previewRobot", kinematicUnit->getRobotFilename(), armarxProject, armarx::CollisionModel);
45  debugDrawer->updateRobotColor("Preview", "previewRobot", DrawColor {0, 1, 0, 0.5});
46  }
47 
48 
49  try
50  {
51  task = new PeriodicTask<TrajectoryPlayer>(this, &TrajectoryPlayer::run, 10, false, "TrajectoryPlayerTask", false);
52  paused = false;
53  firstRound = true;
54  currentTime = 0;
55  runningTime = 0;
57 
58  task->start();
59  return task->isRunning();
60  }
61  catch (...)
62  {
63  ARMARX_WARNING << "Failed to start MMMPLayer task";
64  return false;
65  }
66 
67 
68 }
69 
70 bool TrajectoryPlayer::pauseTrajectoryPlayer(const Ice::Current&)
71 {
72  std::unique_lock lock(motionMutex);
73 
74  if (!paused)
75  {
76  paused = true;
78  firstRound = true;
79  kinematicUnit->setJointVelocities(nullVelocities);
80  }
81  else
82  {
83  paused = false;
84  }
85 
86  return paused;
87 }
88 
89 bool TrajectoryPlayer::stopTrajectoryPlayer(const Ice::Current&)
90 {
91  std::unique_lock lock(motionMutex);
92  paused = true;
93 
94 
95  if (isPreview)
96  {
97  debugDrawer->clearLayer("Preview");
98  }
99 
100  try
101  {
102  if (task)
103  {
104  task->stop();
105  }
106  if (task->isRunning())
107  {
108  ARMARX_WARNING << "Failed to stop MMMPlayer";
109  }
110  else
111  {
112  ARMARX_INFO << "stopped MMMPlayer task from GUI";
113  }
114  kinematicUnit->setJointVelocities(nullVelocities);
115  return !(task->isRunning());
116  }
117  catch (...)
118  {
119  ARMARX_WARNING << "Failed to stop MMMPlayer";
120  }
121 
122  return false;
123 }
124 
126 {
127  StringVariantBaseMap debugTargetValues;
128  StringVariantBaseMap debugVelocityValues;
129 
130  {
131  std::unique_lock lock(motionMutex);
132  targetPositionValues.clear();
133  targetVelocityValues.clear();
134 
135  int maxDerivative = 1;
136  // ARMARX_INFO << deactivateSpam(1) << VAROUT(currentTime);
137  std::vector<Ice::DoubleSeq > states = jointTraj->getAllStates(currentTime, maxDerivative);
138 
139  for (size_t i = 0; i < jointNames.size(); ++i)
140  {
141  const auto& jointName = jointNames.at(i);
142 
143  if (jointNamesUsed[jointName])
144  {
145  // update targetPositionValues
146  auto& targetPosValue = targetPositionValues[jointName] = states[i][STATE_POSITION];
147  auto it = jointOffets.find(jointName);
148  if (it != jointOffets.end())
149  {
150  targetPosValue += it->second;
151  }
152  assert(targetPosValue == targetPositionValues[jointName]);
153  debugTargetValues[jointName] = new Variant(targetPosValue);
154 
155  // update targetVelocityValues
156 
157  // float& targetVel = targetVelocityValues[jointName] = 0;
158  // if (frozenTime != currentTime)
159  // {
160  // targetVel = (states[i][STATE_POSITION] - lastStates[i][STATE_POSITION]) / (currentTime - frozenTime);
161  // }
162 
163  // ARMARX_INFO << "jointName: " << jointName << " targetVel: " << targetVel;
164  float& targetVel = targetVelocityValues[jointName] = states[i][STATE_VELOCITY];
165  if (isVelocityControl)
166  {
167 
168  auto pid = PIDs.find(jointName);
169 
170  if (pid != PIDs.end())
171  {
172 
173  auto cv = pid->second->getControlValue();
174  //ARMARX_INFO << "*" << (jointName) << ": targetPosValue: " << targetPosValue << ", targetVel:" << (targetVel) << ", pid-cv:" << cv << ", result vel:" << (cv + targetVel);
175  targetVel += cv;
176  }
177 
178  }
179  targetVel = std::min<double>(maxVel / 180.0 * M_PI, targetVel);
180  targetVel = std::max<double>(-1 * maxVel / 180.0 * M_PI, targetVel);
181  debugVelocityValues[jointName] = new Variant(targetVel);
182  }
183  else
184  {
185  targetVelocityValues[jointName] = 0;
186  }
187  }
188 
189 
191  {
192  std::vector<Ice::DoubleSeq > pose = basePoseTraj->getAllStates(currentTime, 0);
193 
194  Eigen::Vector3f position(pose[0][0], pose[1][0], pose[2][0]);
195  Eigen::Quaternionf orientation(pose[3][0], pose[4][0], pose[5][0], pose[6][0]);
196  Eigen::Matrix4f p = offset * simox::math::pos_quat_to_mat4f(position, orientation);
197  if (customRootNode)
198  {
199  localModel->setJointValues(targetPositionValues);
200  localModel->setGlobalPoseForRobotNode(customRootNode, p);
201  targetRobotPose = new Pose(localModel->getGlobalPose());
202  }
203  else
204  {
205  targetRobotPose = new Pose(p);
206  }
207  }
208  }
209 
210  debugObserver->setDebugChannel("targetJointAngles", debugTargetValues);
211  debugObserver->setDebugChannel("targetVelocity", debugVelocityValues);
212 
213 
214 
215 }
216 
217 
218 
219 bool TrajectoryPlayer::resetTrajectoryPlayer(bool moveToFrameZeroPose, const Ice::Current&)
220 {
221  std::unique_lock lock(motionMutex);
222  currentTime = 0;
223  runningTime = 0;
224  if (moveToFrameZeroPose)
225  {
226  this->setIsVelocityControl(false);
228  kinematicUnit->setJointAngles(targetPositionValues);
229  }
230  return true;
231 }
232 
233 bool TrajectoryPlayer::setJointsInUse(const std::string& jointName, bool inUse, const Ice::Current&)
234 {
235  jointNamesUsed[jointName] = inUse;
236  return jointNamesUsed[jointName];
237 }
238 
239 
240 
241 void TrajectoryPlayer::loadJointTraj(const TrajectoryBasePtr& trajs, const Ice::Current&)
242 {
243  std::unique_lock lock(motionMutex);
244  // get model filename
245  if (!armarxProject.empty())
246  {
247  std::vector<std::string> proj = armarx::Split(armarxProject, ",;", true, true);
248 
249  for (std::string& p : proj)
250  {
251  ARMARX_INFO << "Adding to datapaths of " << p;
252  armarx::CMakePackageFinder finder(p);
253 
254  if (!finder.packageFound())
255  {
256  ARMARX_WARNING << "ArmarX Package " << p << " has not been found!";
257  }
258  else
259  {
260  ARMARX_INFO << "Adding to datapaths: " << finder.getDataDir();
262  }
263  }
264  }
265 
267  localModel = VirtualRobot::RobotIO::loadRobot(modelFileName, VirtualRobot::RobotIO::RobotDescription::eStructure);
268  if (getProperty<std::string>("CustomRootNode").isSet() && !getProperty<std::string>("CustomRootNode").getValue().empty())
269  {
270  customRootNode = localModel->getRobotNode(getProperty<std::string>("CustomRootNode").getValue());
271  }
272  else
273  {
274  customRootNode.reset();
275  }
276 
277 
278  // load trajectory
279  jointTraj = TrajectoryPtr::dynamicCast(trajs);
280 
281 
282  if (!jointTraj)
283  {
284  ARMARX_ERROR << "Error when loading TrajectoryPlayer: cannot load jointTraj !!!";
285  return;
286  }
287 
288  endTime = *jointTraj->getTimestamps().rbegin() - *jointTraj->getTimestamps().begin();
289 
290  jointTraj = jointTraj->normalize(0, endTime);
291  trajEndTime = endTime;
292  jointNames = jointTraj->getDimensionNames();
294 
295  if (jointNames.size() != jointTraj->dim())
296  {
297  ARMARX_ERROR << "Not all trajectory dimensions are named !!! (would cause problems when using kinematicUnit)";
298  return;
299  }
300 
301  NameControlModeMap modes;
302  LimitlessStateSeq limitlessStates;
303 
304  for (size_t i = 0; i < jointNames.size(); ++i)
305  {
306  const auto& jointName = jointNames.at(i);
307 
308  if (isVelocityControl)
309  {
310  modes[jointName] = eVelocityControl;
311  }
312  else
313  {
314  modes[jointName] = ePositionControl;
315  }
316 
317  nullVelocities[jointName] = 0.0;
318  jointNamesUsed[jointName] = true;
319 
320  if (localModel)
321  {
322  LimitlessState ls;
323  ls.enabled = false;
324  VirtualRobot::RobotNodePtr rn = localModel->getRobotNode(jointName);
325  if (rn)
326  {
327  ls.enabled = rn->isLimitless();
328  ls.limitLo = rn->getJointLimitLo();
329  ls.limitHi = rn->getJointLimitHi();
330  limitlessMap[jointName] = rn->isLimitless();
331  }
332  ARMARX_INFO << "limitless status - " << jointName << ": " << rn->isLimitless();
333  limitlessStates.push_back(ls);
334  }
335  }
336 
337  // setup limitless status of joints
338  if (limitlessStates.size() == jointNames.size())
339  {
340  ARMARX_INFO << "SETTING UP LIMITLESS JOINTS";
341  jointTraj->setLimitless(limitlessStates);
342  }
343  /*else
344  {
345  ARMARX_IMPORTANT << "NOT SETTING LIMITLESS JOINTS!";
346  }*/
347 
348  ARMARX_INFO << "Setting null velocities: " << nullVelocities;
349  kinematicUnit->switchControlMode(modes);
350  kinematicUnit->setJointVelocities(nullVelocities);
351 
352 }
353 
354 void TrajectoryPlayer::loadBasePoseTraj(const TrajectoryBasePtr& trajs, const Ice::Current&)
355 {
356  basePoseTraj = TrajectoryPtr::dynamicCast(trajs);
357 }
358 
359 
360 
361 void TrajectoryPlayer::setLoopPlayback(bool loop, const Ice::Current&)
362 {
363  loopPlayback = loop;
364 }
365 
366 
367 void TrajectoryPlayer::setIsVelocityControl(bool isVelocity, const Ice::Current&)
368 {
369  // std::unique_lock lock(motionMutex);
370 
371  isVelocityControl = isVelocity;
372  NameControlModeMap modes;
373 
374  for (size_t i = 0; i < jointNames.size(); ++i)
375  {
376  const auto& jointName = jointNames.at(i);
377 
378  if (isVelocity)
379  {
380  modes[jointName] = eVelocityControl;
381  }
382  else
383  {
384  modes[jointName] = ePositionControl;
385  }
386  }
387 
388  try
389  {
390  kinematicUnit->switchControlMode(modes);
391  }
392  catch (...) { }
393 
394 }
395 
396 
397 
398 
399 void TrajectoryPlayer::reportJointAngles(const NameValueMap& angles, Ice::Long timestamp, bool, const Ice::Current&)
400 {
401  std::unique_lock lock(jointAnglesMutex);
402  latestJointAngles = angles;
403 }
404 
405 
407 {
408  offeringTopic("DebugObserver");
409  usingProxy(getProperty<std::string>("KinematicUnitName").getValue());
410 
411  paused = true;
412 
413  isVelocityControl = getProperty<bool>("isVelocityControl").getValue();
414  loopPlayback = getProperty<bool>("LoopPlayback").getValue();
415  maxVel = getProperty<float>("absMaximumVelocity").getValue();
416 
417  usingTopic(getProperty<std::string>("KinematicTopicName").getValue());
418 
419  offeringTopic("DebugDrawerUpdates");
420 }
421 
422 
424 {
425  kinematicUnit = getProxy<KinematicUnitInterfacePrx>(getProperty<std::string>("KinematicUnitName").getValue());
426  debugObserver = getTopic<DebugObserverInterfacePrx>("DebugObserver");
427  debugDrawer = getTopic<armarx::DebugDrawerInterfacePrx>("DebugDrawerUpdates");
428  armarxProject = getProperty<std::string>("ArmarXProjects").getValue();
429  robotPoseUnitEnabled = getProperty<bool>("EnableRobotPoseUnit").getValue();
430 
431  Eigen::Vector3f position(getProperty<float>("Offset.x").getValue(), getProperty<float>("Offset.y").getValue(), getProperty<float>("Offset.z").getValue());
432  Eigen::Vector3f orientation(getProperty<float>("Offset.roll").getValue(), getProperty<float>("Offset.pitch").getValue(), getProperty<float>("Offset.yaw").getValue());
433  offset = simox::math::pos_rpy_to_mat4f(position, orientation);
434  ARMARX_INFO << "Trajectory Player Offset " << offset;
435 
436  targetRobotPose = new Pose();
437 
438 }
439 
440 
442 {
443 
444 }
445 
446 
448 {
449 
450 }
451 
453 {
456 }
457 
459 {
460  if (!jointTraj)
461  {
462  ARMARX_WARNING << "joint trajectory not found ...";
463  return;
464  }
465 
466  if (paused)
467  {
468  sleep(1);
470  }
471  else
472  {
473  runningTime = (armarx::TimeUtil::GetTime() - startTime).toSecondsDouble() + timeOffset;
474 
475  if (direction > 0)
476  {
478  }
479  else
480  {
482  }
483 
484  // if (!firstRound)
485  // {
486  // startCal = armarx::TimeUtil::GetTime();
487  // }
488 
489  ARMARX_INFO << deactivateSpam(1) << "currentTime: " << currentTime;
490  ARMARX_INFO << deactivateSpam(1) << "endTime: " << endTime;
491 
492  if (runningTime >= endTime) // reset timer.
493  {
494  runningTime = 0;
496  timeOffset = 0;
497  }
498 
499 
500  if (currentTime >= endTime)
501  {
502  kinematicUnit->setJointVelocities(nullVelocities);
503 
504  if (loopPlayback)
505  {
506  direction = -1;
507  }
508  else if (task)
509  {
510  task->stop();
511  sleep(1);
512  return;
513  }
514  }
515 
516  if (currentTime <= 0)
517  {
518  if (loopPlayback)
519  {
520  direction = 1;
521  }
522  else if (task)
523  {
524  task->stop();
525  sleep(1);
526  return;
527  }
528  }
529 
530  StringVariantBaseMap debugTargetValues;
531  StringVariantBaseMap debugVelocityValues;
532 
533  {
534  std::unique_lock lock(motionMutex);
535  ARMARX_CHECK_EXPRESSION((size_t)jointNames.size() == jointTraj->dim());
536  // updateTargetValues();
537  targetPositionValues.clear();
538  targetVelocityValues.clear();
539 
540  int maxDerivative = 1;
541  // ARMARX_INFO << deactivateSpam(1) << VAROUT(currentTime);
542  std::vector<Ice::DoubleSeq > states = jointTraj->getAllStates(currentTime, maxDerivative);
543 
544 
545 
546  for (size_t i = 0; i < jointNames.size(); ++i)
547  {
548  const auto& jointName = jointNames.at(i);
549 
550  if (jointNamesUsed[jointName])
551  {
552  // update targetPositionValues
553  auto& targetPosValue = targetPositionValues[jointName] = states[i][STATE_POSITION];
554  auto it = jointOffets.find(jointName);
555  if (it != jointOffets.end())
556  {
557  targetPosValue += it->second;
558  }
559  assert(targetPosValue == targetPositionValues[jointName]);
560  debugTargetValues[jointName] = new Variant(targetPosValue);
561 
562 
563  // update targetVelocityValues
564 
565  // float& targetVel = targetVelocityValues[jointName] = 0;
566  // if (frozenTime != currentTime)
567  // {
568  // targetVel = (states[i][STATE_POSITION] - lastStates[i][STATE_POSITION]) / (currentTime - frozenTime);
569  // }
570 
571  // ARMARX_INFO << "jointName: " << jointName << " targetVel: " << targetVel;
572  float& targetVel = targetVelocityValues[jointName] = states[i][STATE_VELOCITY];
573 
574  if (isVelocityControl)
575  {
576 
577  auto pid = PIDs.find(jointName);
578 
579  if (pid != PIDs.end())
580  {
581  auto cv = pid->second->getControlValue();
582  /*if (cv > 20)
583  {
584  ARMARX_INFO << "" << (jointName) << ": targetPosValue: " << targetPosValue << ", targetVel:" << (targetVel) << ", pid-cv:" << cv << ", result vel:" << (cv + targetVel);
585  }
586  if (fabs(cv) > 0.2)
587  {
588  ARMARX_IMPORTANT << "|cv| > 1: " << (jointName) << ": targetPosValue: " << targetPosValue << ", actualPosValue: " << latestJointAngles[jointName] << ", targetVel:" << (targetVel) << ", pid-cv:" << cv << ", result vel:" << (cv + targetVel);
589  }
590  if (fabs(targetVel) > 0.2)
591  {
592  ARMARX_IMPORTANT << "|targetVel| > 1: " << (jointName) << ": targetPosValue: " << targetPosValue << ", actualPosValue: " << latestJointAngles[jointName] << ", targetVel:" << (targetVel) << ", pid-cv:" << cv << ", result vel:" << (cv + targetVel);
593  }*/
594  targetVel += cv;
595  }
596 
597  }
598  targetVel = std::min<double>(maxVel / 180.0 * M_PI, targetVel);
599  targetVel = std::max<double>(-1 * maxVel / 180.0 * M_PI, targetVel);
600  targetVel *= direction;
601  debugVelocityValues[jointName] = new Variant(targetVel);
602  }
603  else
604  {
605  targetVelocityValues[jointName] = 0;
606  }
607  }
608 
609 
611  {
612  std::vector<Ice::DoubleSeq > pose = basePoseTraj->getAllStates(currentTime, 0);
613 
614  Eigen::Vector3f position(pose[0][0], pose[1][0], pose[2][0]);
615  Eigen::Quaternionf orientation(pose[3][0], pose[4][0], pose[5][0], pose[6][0]);
616  Eigen::Matrix4f p = offset * simox::math::pos_quat_to_mat4f(position, orientation);
617  if (customRootNode)
618  {
619  localModel->setJointValues(targetPositionValues);
620  localModel->setGlobalPoseForRobotNode(customRootNode, p);
621  targetRobotPose = new Pose(localModel->getGlobalPose());
622  }
623  else
624  {
625  targetRobotPose = new Pose(p);
626  }
627 
628  }
629  }
630 
631  /*{
632  ARMARX_INFO << "ELBOW - target pos:" << targetPositionValues["ArmL6_Elb2"] << ", actual pos:" << latestJointAngles["ArmL6_Elb2"] << ",\t targetVel:" << targetVelocityValues["ArmL6_Elb2"] << std::endl;
633  }*/
634 
635 
636  if (!isPreview)
637  {
638  if (!isVelocityControl)
639  {
640  kinematicUnit->setJointAngles(targetPositionValues);
641  }
642  else
643  {
644  kinematicUnit->setJointVelocities(targetVelocityValues);
645  }
646 
648  {
649  RobotPoseUnitInterfacePrx robotPoseUnitPrx
650  = getProxy<RobotPoseUnitInterfacePrx>(getProperty<std::string>("RobotPoseUnitName").getValue());
651 
652  robotPoseUnitPrx->moveTo(PoseBasePtr::dynamicCast(targetRobotPose), 0.001f, 0.001f);
653  }
654 
655 
656  }
657  else
658  {
659  ARMARX_INFO << "Preview ... ";
660 
661  if (checkJointsLimit())
662  {
663  debugDrawer->updateRobotConfig("Preview", "previewRobot", targetPositionValues);
664 
666  {
667  debugDrawer->updateRobotPose("Preview", "previewRobot", PoseBasePtr::dynamicCast(targetRobotPose));
668  }
669  }
670 
671  else
672  {
673  task->stop();
674  sleep(1);
675  return;
676  }
677 
678  }
679 
680  {
681  std::unique_lock lock(jointAnglesMutex);
682  updatePIDController(latestJointAngles);
683  }
684 
685  debugObserver->setDebugChannel("targetJointAngles", debugTargetValues);
686  debugObserver->setDebugChannel("targetVelocity", debugVelocityValues);
687 
688  }
689 
690 
691 
692 }
693 
694 void TrajectoryPlayer::updatePIDController(const NameValueMap& angles)
695 {
696  if (!isVelocityControl)
697  {
698  ARMARX_INFO << deactivateSpam() << "jointangles reporting DISABLED";
699  return;
700  }
701 
702  for (const auto& joint : angles)
703  {
704  const std::string& name = joint.first;
705 
706  if (targetPositionValues.find(name) == targetPositionValues.end())
707  {
708  continue;
709  }
710 
711  auto it = PIDs.find(name);
712 
713  if (it == PIDs.end())
714  {
715  PIDs[name] = PIDControllerPtr(new PIDController(getProperty<float>("Kp").getValue(),
716  getProperty<float>("Ki").getValue(),
717  getProperty<float>("Kd").getValue(),
720  limitlessMap[name]
721  ));
722  ARMARX_INFO << "Creating PID for " << name << " is limitless:" << limitlessMap[name];
723  it = PIDs.find(name);
724  }
725 
726  PIDControllerPtr pid = it->second;
727  pid->update(joint.second, targetPositionValues[name]);
728  //ARMARX_INFO << "PID update:" << name << ", measured:" << joint.second << ", target:" << targetPositionValues[name];
729  }
730 }
731 
732 
734 {
735 
736  if (!localModel)
737  {
738  ARMARX_WARNING << "No local model found !!! (No joints limit checked)";
739  return false;
740  }
741 
742  std::unique_lock lock(jointAnglesMutex);
743 
744 
745  for (NameValueMap::iterator it = latestJointAngles.begin(); it != latestJointAngles.end(); it++)
746  {
747  std::string jointName = it->first;
748  float jointValue = it->second;
749 
750  float lowLimit = localModel->getRobotNode(jointName)->getJointLimitLow();
751  float highLimit = localModel->getRobotNode(jointName)->getJointLimitHigh();
752  DrawColor errColor = {1, 0, 0, 1};
753  DrawColor warnColor = {1, 1, 0, 1};
754  DrawColor normColor = {0, 1, 0, 1};
755  if (jointValue < lowLimit || jointValue > highLimit)
756  {
757  debugDrawer->updateRobotNodeColor("Preview", "previewRobot", jointName, errColor);
758  return false;
759  }
760 
761  float dist = highLimit - lowLimit;
762 
763  bool isWarning = ((jointValue < (lowLimit + 0.1 * dist)) && (jointValue >= lowLimit)) ||
764  ((jointValue > (highLimit - 0.1 * dist)) && (jointValue <= highLimit));
765 
766  if (isWarning)
767  {
768  debugDrawer->updateRobotNodeColor("Preview", "previewRobot", jointName, warnColor);
769  }
770  else
771  {
772  debugDrawer->updateRobotNodeColor("Preview", "previewRobot", jointName, normColor);
773 
774  }
775 
776 
777  }
778 
779  return true;
780 }
781 
783 {
784  if (!localModel)
785  {
786  ARMARX_WARNING << "No local model found !!! (No joints limit checked)";
787  return false;
788  }
789 
790  std::unique_lock lock(jointAnglesMutex);
791 
792  localModel->setJointValues(latestJointAngles);
793 
794  return true;
795 }
796 
armarx::TrajectoryPlayer::offset
Eigen::Matrix4f offset
Definition: TrajectoryPlayer.h:234
armarx::TrajectoryPlayer::localModel
VirtualRobot::RobotPtr localModel
Definition: TrajectoryPlayer.h:269
armarx::Variant
The Variant class is described here: Variants.
Definition: Variant.h:224
armarx::TrajectoryPlayer::armarxProject
std::string armarxProject
Definition: TrajectoryPlayer.h:231
armarx::TrajectoryPlayer::debugObserver
DebugObserverInterfacePrx debugObserver
Definition: TrajectoryPlayer.h:228
armarx::TrajectoryPlayer::targetVelocityValues
NameValueMap targetVelocityValues
Definition: TrajectoryPlayer.h:253
armarx::TrajectoryPlayer::onDisconnectComponent
void onDisconnectComponent() override
Definition: TrajectoryPlayer.cpp:441
armarx::StringVariantBaseMap
std::map< std::string, VariantBasePtr > StringVariantBaseMap
Definition: ManagedIceObject.h:111
armarx::CMakePackageFinder::packageFound
bool packageFound() const
Returns whether or not this package was found with cmake.
Definition: CMakePackageFinder.cpp:485
armarx::navigation::core::Pose
Eigen::Isometry3f Pose
Definition: basic_types.h:31
armarx::TrajectoryPlayer::loadJointTraj
void loadJointTraj(const TrajectoryBasePtr &trajs, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: TrajectoryPlayer.cpp:241
armarx::TrajectoryPlayer::targetPositionValues
NameValueMap targetPositionValues
Definition: TrajectoryPlayer.h:252
armarx::TrajectoryPlayer::run
void run()
Definition: TrajectoryPlayer.cpp:458
armarx::Split
std::vector< std::string > Split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
Definition: StringHelperTemplates.h:35
armarx::TrajectoryPlayer::kinematicUnit
KinematicUnitInterfacePrx kinematicUnit
Definition: TrajectoryPlayer.h:227
armarx::PIDControllerPtr
std::shared_ptr< PIDController > PIDControllerPtr
Definition: PIDController.h:92
armarx::CMakePackageFinder
The CMakePackageFinder class provides an interface to the CMake Package finder capabilities.
Definition: CMakePackageFinder.h:53
armarx::TrajectoryPlayer::endTime
double endTime
Definition: TrajectoryPlayer.h:247
armarx::TrajectoryPlayer::jointNames
Ice::StringSeq jointNames
Definition: TrajectoryPlayer.h:237
armarx::TrajectoryPlayer::loopPlayback
bool loopPlayback
Definition: TrajectoryPlayer.h:249
armarx::TrajectoryPlayer::stopTrajectoryPlayer
bool stopTrajectoryPlayer(const Ice::Current &) override
Definition: TrajectoryPlayer.cpp:89
armarx::TrajectoryPlayer::limitlessMap
std::map< std::string, bool > limitlessMap
Definition: TrajectoryPlayer.h:239
armarx::navigation::platform_controller::platform_global_trajectory::NameValueMap
std::map< std::string, float > NameValueMap
Definition: PlatformGlobalTrajectoryController.h:93
armarx::TrajectoryPlayer::onConnectComponent
void onConnectComponent() override
Definition: TrajectoryPlayer.cpp:423
armarx::TrajectoryPlayer::nullVelocities
NameValueMap nullVelocities
Definition: TrajectoryPlayer.h:255
armarx::TrajectoryPlayer::jointTraj
::armarx::TrajectoryPtr jointTraj
Definition: TrajectoryPlayer.h:223
TrajectoryPlayer.h
armarx::TrajectoryPlayer::setIsVelocityControl
void setIsVelocityControl(bool isVelocity, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: TrajectoryPlayer.cpp:367
armarx::TrajectoryPlayer::startTime
IceUtil::Time startTime
Definition: TrajectoryPlayer.h:245
cxxopts::empty
bool empty(const std::string &s)
Definition: cxxopts.hpp:255
armarx::TrajectoryPlayer::modelFileName
std::string modelFileName
Definition: TrajectoryPlayer.h:262
armarx::TrajectoryPlayerPropertyDefinitions
Definition: TrajectoryPlayer.h:51
armarx::TrajectoryPlayer::isVelocityControl
bool isVelocityControl
Definition: TrajectoryPlayer.h:241
armarx::TrajectoryPlayer::onInitComponent
void onInitComponent() override
Definition: TrajectoryPlayer.cpp:406
armarx::TrajectoryPlayer::maxVel
float maxVel
Definition: TrajectoryPlayer.h:260
M_PI
#define M_PI
Definition: MathTools.h:17
armarx::PIDController
Definition: PIDController.h:43
armarx::TrajectoryPlayer::direction
int direction
Definition: TrajectoryPlayer.h:258
armarx::TrajectoryPlayer::currentTime
double currentTime
Definition: TrajectoryPlayer.h:243
STATE_VELOCITY
#define STATE_VELOCITY
Definition: TrajectoryPlayer.cpp:32
armarx::TrajectoryPlayer::resetTrajectoryPlayer
bool resetTrajectoryPlayer(bool moveToFrameZeroPose, const Ice::Current &) override
Definition: TrajectoryPlayer.cpp:219
armarx::TrajectoryPlayer::runningTime
double runningTime
Definition: TrajectoryPlayer.h:244
armarx::CMakePackageFinder::getDataDir
std::string getDataDir() const
Definition: CMakePackageFinder.h:176
armarx::TrajectoryPlayer::setLoopPlayback
void setLoopPlayback(bool loop, const Ice::Current &) override
Definition: TrajectoryPlayer.cpp:361
armarx::VariantType::Long
const VariantTypeId Long
Definition: Variant.h:917
armarx::TrajectoryPlayer::updateTargetValues
void updateTargetValues()
Definition: TrajectoryPlayer.cpp:125
armarx::TrajectoryPlayer::pauseTrajectoryPlayer
bool pauseTrajectoryPlayer(const Ice::Current &) override
Definition: TrajectoryPlayer.cpp:70
max
T max(T t1, T t2)
Definition: gdiam.h:48
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
armarx::TrajectoryPlayer::checkJointsLimit
bool checkJointsLimit()
Definition: TrajectoryPlayer.cpp:733
armarx::TrajectoryPlayer::checkSelfCollision
bool checkSelfCollision()
Definition: TrajectoryPlayer.cpp:782
armarx::TrajectoryPlayer::jointNamesUsed
std::map< std::string, bool > jointNamesUsed
Definition: TrajectoryPlayer.h:238
armarx::TimeUtil::GetTime
static IceUtil::Time GetTime(TimeMode timeMode=TimeMode::VirtualTime)
Get the current time.
Definition: TimeUtil.cpp:42
armarx::TrajectoryPlayer::isPreview
bool isPreview
Definition: TrajectoryPlayer.h:250
armarx::control::common::getValue
T getValue(nlohmann::json &userConfig, nlohmann::json &defaultConfig, const std::string &entryName)
Definition: utils.h:55
armarx::ManagedIceObject::usingTopic
void usingTopic(const std::string &name, bool orderedPublishing=false)
Registers a proxy for subscription after initialization.
Definition: ManagedIceObject.cpp:248
armarx::TrajectoryPlayer::reportJointAngles
void reportJointAngles(const NameValueMap &angles, Ice::Long, bool, const Ice::Current &) override
Definition: TrajectoryPlayer.cpp:399
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:74
CMakePackageFinder.h
armarx::TrajectoryPlayer::robotPoseUnitEnabled
bool robotPoseUnitEnabled
Definition: TrajectoryPlayer.h:232
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
ARMARX_CHECK_EXPRESSION
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
Definition: ExpressionException.h:73
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx::ArmarXDataPath::addDataPaths
static void addDataPaths(const std::string &dataPathList)
Definition: ArmarXDataPath.cpp:559
armarx::TrajectoryPlayer::jointOffets
NameValueMap jointOffets
Definition: TrajectoryPlayer.h:259
STATE_POSITION
#define STATE_POSITION
Definition: TrajectoryPlayer.cpp:31
VAROUT
#define VAROUT(x)
Definition: StringHelpers.h:182
armarx::TrajectoryPlayer::debugDrawer
DebugDrawerInterfacePrx debugDrawer
Definition: TrajectoryPlayer.h:229
armarx::Quaternion< float, 0 >
armarx::ManagedIceObject::offeringTopic
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
Definition: ManagedIceObject.cpp:290
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::TrajectoryPlayer::targetRobotPose
PosePtr targetRobotPose
Definition: TrajectoryPlayer.h:254
armarx::Logging::deactivateSpam
SpamFilterDataPtr deactivateSpam(float deactivationDurationSec=10.0f, const std::string &identifier="", bool deactivate=true) const
disables the logging for the current line for the given amount of seconds.
Definition: Logging.cpp:92
cv
Definition: helper.h:35
armarx::ArmarXDataPath::getAbsolutePath
static bool getAbsolutePath(const std::string &relativeFilename, std::string &storeAbsoluteFilename, const std::vector< std::string > &additionalSearchPaths={}, bool verbose=true)
Definition: ArmarXDataPath.cpp:111
armarx::PeriodicTask
Definition: ArmarXManager.h:70
armarx::TrajectoryPlayer::task
PeriodicTask< TrajectoryPlayer >::pointer_type task
Definition: TrajectoryPlayer.h:236
armarx::TrajectoryPlayer::timeOffset
double timeOffset
Definition: TrajectoryPlayer.h:246
armarx::TrajectoryPlayer::startTrajectoryPlayer
bool startTrajectoryPlayer(const Ice::Current &) override
Definition: TrajectoryPlayer.cpp:35
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:186
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:34
ArmarXDataPath.h
armarx::TrajectoryPlayer::setJointsInUse
bool setJointsInUse(const std::string &jointName, bool inUse, const Ice::Current &) override
Definition: TrajectoryPlayer.cpp:233
armarx::ManagedIceObject::usingProxy
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Definition: ManagedIceObject.cpp:151
armarx::TrajectoryPlayer::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: TrajectoryPlayer.cpp:452
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::TrajectoryPlayer::PIDs
std::map< std::string, PIDControllerPtr > PIDs
Definition: TrajectoryPlayer.h:251
armarx::TrajectoryPlayer::loadBasePoseTraj
void loadBasePoseTraj(const TrajectoryBasePtr &trajs, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: TrajectoryPlayer.cpp:354
armarx::TrajectoryPlayer::basePoseTraj
::armarx::TrajectoryPtr basePoseTraj
Definition: TrajectoryPlayer.h:224
armarx::TrajectoryPlayer::onExitComponent
void onExitComponent() override
Definition: TrajectoryPlayer.cpp:447