NJointBimanualForceMPController.cpp
Go to the documentation of this file.
2 
3 #include <random>
4 
5 
7 {
8  NJointControllerRegistration<NJointBimanualForceMPController>
9  registrationControllerNJointBimanualForceMPController("NJointBimanualForceMPController");
10 
12  const RobotUnitPtr& robUnit,
13  const armarx::NJointControllerConfigPtr& config,
15  {
17  cfg = NJointBimanualForceMPControllerConfigPtr::dynamicCast(config);
18 
19  VirtualRobot::RobotNodeSetPtr lrns = rtGetRobot()->getRobotNodeSet("LeftArm");
20  for (size_t i = 0; i < lrns->getSize(); ++i)
21  {
22  std::string jointName = lrns->getNode(i)->getName();
23  ControlTargetBase* ct = useControlTarget(jointName, ControlModes::Velocity1DoF);
24  const SensorValueBase* sv = useSensorValue(jointName);
25  leftTargets.push_back(ct->asA<ControlTarget1DoFActuatorVelocity>());
26  const SensorValue1DoFActuatorVelocity* velocitySensor =
27  sv->asA<SensorValue1DoFActuatorVelocity>();
28  const SensorValue1DoFActuatorPosition* positionSensor =
29  sv->asA<SensorValue1DoFActuatorPosition>();
30 
31  if (!velocitySensor)
32  {
33  ARMARX_WARNING << "No velocity sensor available for " << jointName;
34  }
35  if (!positionSensor)
36  {
37  ARMARX_WARNING << "No position sensor available for " << jointName;
38  }
39 
40  leftVelocitySensors.push_back(velocitySensor);
41  leftPositionSensors.push_back(positionSensor);
42  };
43 
44  VirtualRobot::RobotNodeSetPtr rrns = rtGetRobot()->getRobotNodeSet("RightArm");
45  for (size_t i = 0; i < rrns->getSize(); ++i)
46  {
47  std::string jointName = rrns->getNode(i)->getName();
48  ControlTargetBase* ct = useControlTarget(jointName, ControlModes::Velocity1DoF);
49  const SensorValueBase* sv = useSensorValue(jointName);
50  rightTargets.push_back(ct->asA<ControlTarget1DoFActuatorVelocity>());
51  const SensorValue1DoFActuatorVelocity* velocitySensor =
52  sv->asA<SensorValue1DoFActuatorVelocity>();
53  const SensorValue1DoFActuatorPosition* positionSensor =
54  sv->asA<SensorValue1DoFActuatorPosition>();
55 
56  if (!velocitySensor)
57  {
58  ARMARX_WARNING << "No velocity sensor available for " << jointName;
59  }
60  if (!positionSensor)
61  {
62  ARMARX_WARNING << "No position sensor available for " << jointName;
63  }
64 
65  rightVelocitySensors.push_back(velocitySensor);
66  rightPositionSensors.push_back(positionSensor);
67  };
68  const SensorValueBase* svlf = robUnit->getSensorDevice("FT L")->getSensorValue();
69  leftForceTorque = svlf->asA<SensorValueForceTorque>();
70  const SensorValueBase* svrf = robUnit->getSensorDevice("FT R")->getSensorValue();
71  rightForceTorque = svrf->asA<SensorValueForceTorque>();
72 
73  leftIK.reset(new VirtualRobot::DifferentialIK(
74  lrns, lrns->getRobot()->getRootNode(), VirtualRobot::JacobiProvider::eSVDDamped));
75  rightIK.reset(new VirtualRobot::DifferentialIK(
76  rrns, rrns->getRobot()->getRootNode(), VirtualRobot::JacobiProvider::eSVDDamped));
77 
78  leftTCP = lrns->getTCP();
79  rightTCP = rrns->getTCP();
80 
81  leftLearned = false;
82  rightLearned = false;
83 
84  // set tcp controller
85  leftTCPController.reset(new CartesianVelocityController(lrns, leftTCP));
86  rightTCPController.reset(new CartesianVelocityController(rrns, rightTCP));
87 
88 
89  finished = false;
90  tsvmp::TaskSpaceDMPControllerConfig taskSpaceDMPConfig;
91  taskSpaceDMPConfig.motionTimeDuration = cfg->timeDuration;
92  taskSpaceDMPConfig.DMPKernelSize = cfg->kernelSize;
93  taskSpaceDMPConfig.DMPMode = cfg->dmpMode;
94  taskSpaceDMPConfig.DMPStyle = cfg->dmpStyle;
95  taskSpaceDMPConfig.DMPAmplitude = cfg->dmpAmplitude;
96  taskSpaceDMPConfig.phaseStopParas.goDist = cfg->phaseDist0;
97  taskSpaceDMPConfig.phaseStopParas.backDist = cfg->phaseDist1;
98  taskSpaceDMPConfig.phaseStopParas.Kpos = cfg->phaseKpPos;
99  taskSpaceDMPConfig.phaseStopParas.Dpos = 0;
100  taskSpaceDMPConfig.phaseStopParas.Kori = cfg->phaseKpOri;
101  taskSpaceDMPConfig.phaseStopParas.Dori = 0;
102  taskSpaceDMPConfig.phaseStopParas.mm2radi = cfg->posToOriRatio;
103  taskSpaceDMPConfig.phaseStopParas.maxValue = cfg->phaseL;
104  taskSpaceDMPConfig.phaseStopParas.slop = cfg->phaseK;
105  leftDMPController.reset(new tsvmp::TaskSpaceDMPController("Left", taskSpaceDMPConfig, false));
106  rightDMPController.reset(new tsvmp::TaskSpaceDMPController("Right", taskSpaceDMPConfig, false));
107 
108 
109  // initialize tcp position and orientation
110  NJointBimanualForceMPControllerSensorData initSensorData;
111  initSensorData.leftPoseInRootFrame = leftTCP->getPoseInRootFrame();
112  initSensorData.leftTwistInRootFrame.setZero();
113  initSensorData.rightPoseInRootFrame = rightTCP->getPoseInRootFrame();
114  initSensorData.rightTwistInRootFrame.setZero();
115  initSensorData.leftForceInRootFrame.setZero();
116  initSensorData.rightForceInRootFrame.setZero();
117  controllerSensorData.reinitAllBuffers(initSensorData);
118 
120  initData.leftTargetPose = leftTCP->getPoseInRootFrame();
121  initData.rightTargetPose = rightTCP->getPoseInRootFrame();
122  reinitTripleBuffer(initData);
123 
124 
125  Kp_LinearVel = cfg->Kp_LinearVel;
126  Kp_AngularVel = cfg->Kp_AngularVel;
127  Kd_LinearVel = cfg->Kd_LinearVel;
128  Kd_AngularVel = cfg->Kd_AngularVel;
129 
130  forceIterm = 0;
131  I_decay = 0.9;
132  xvel = 0;
133 
134  leftFilteredValue.setZero();
135  rightFilteredValue.setZero();
136 
137  for (size_t i = 0; i < 3; ++i)
138  {
139  leftForceOffset(i) = cfg->leftForceOffset.at(i);
140  }
141  for (size_t i = 0; i < 3; ++i)
142  {
143  rightForceOffset(i) = cfg->rightForceOffset.at(i);
144  }
145 
146 
147  targetSupportForce = cfg->targetSupportForce;
148 
149  NJointBimanualForceMPControllerInterfaceData initInterfaceData;
150  initInterfaceData.leftTcpPoseInRootFrame = leftTCP->getPoseInRootFrame();
151  initInterfaceData.rightTcpPoseInRootFrame = rightTCP->getPoseInRootFrame();
152  interfaceData.reinitAllBuffers(initInterfaceData);
153  }
154 
155  std::string
157  {
158  return "NJointBimanualForceMPController";
159  }
160 
161  void
163  {
164  if (!controllerSensorData.updateReadBuffer() || !leftDMPController || !rightDMPController)
165  {
166  return;
167  }
168  double deltaT = controllerSensorData.getReadBuffer().deltaT;
169  Eigen::Matrix4f leftPose = controllerSensorData.getReadBuffer().leftPoseInRootFrame;
170  Eigen::Matrix4f rightPose = controllerSensorData.getReadBuffer().rightPoseInRootFrame;
171  Eigen::Vector6f leftTwist = controllerSensorData.getReadBuffer().leftTwistInRootFrame;
172  Eigen::Vector6f rightTwist = controllerSensorData.getReadBuffer().rightTwistInRootFrame;
173  Eigen::Vector3f leftForce = controllerSensorData.getReadBuffer().leftForceInRootFrame;
174  Eigen::Vector3f rightForce = controllerSensorData.getReadBuffer().rightForceInRootFrame;
175 
176  float forceOnHands = (leftForce + rightForce)(2);
177 
178  xvel =
179  cfg->forceP * (targetSupportForce + forceOnHands) + I_decay * cfg->forceI * forceIterm;
180 
181  forceIterm += targetSupportForce - forceOnHands;
182 
183  canVal = canVal + forceSign * xvel * deltaT;
184  // canVal = cfg->timeDuration + forceSign * xvel;
185 
186 
187  if (canVal > cfg->timeDuration)
188  {
189  canVal = cfg->timeDuration;
190  }
191 
192 
193  leftDMPController->canVal = canVal;
194  rightDMPController->canVal = canVal;
195 
196  leftDMPController->flow(deltaT, leftPose, leftTwist);
197  rightDMPController->flow(deltaT, rightPose, rightTwist);
198 
199  if (canVal < 1e-8)
200  {
201  finished = true;
202  }
203 
204 
205  std::vector<double> leftTargetState = leftDMPController->getTargetPose();
206  debugOutputData.getWriteBuffer().dmpTargets["leftTarget_x"] = leftTargetState[0];
207  debugOutputData.getWriteBuffer().dmpTargets["leftTarget_y"] = leftTargetState[1];
208  debugOutputData.getWriteBuffer().dmpTargets["leftTarget_z"] = leftTargetState[2];
209  debugOutputData.getWriteBuffer().dmpTargets["leftTarget_qw"] = leftTargetState[3];
210  debugOutputData.getWriteBuffer().dmpTargets["leftTarget_qx"] = leftTargetState[4];
211  debugOutputData.getWriteBuffer().dmpTargets["leftTarget_qy"] = leftTargetState[5];
212  debugOutputData.getWriteBuffer().dmpTargets["leftTarget_qz"] = leftTargetState[6];
213  std::vector<double> rightTargetState = rightDMPController->getTargetPose();
214  debugOutputData.getWriteBuffer().dmpTargets["rightTarget_x"] = rightTargetState[0];
215  debugOutputData.getWriteBuffer().dmpTargets["rightTarget_y"] = rightTargetState[1];
216  debugOutputData.getWriteBuffer().dmpTargets["rightTarget_z"] = rightTargetState[2];
217  debugOutputData.getWriteBuffer().dmpTargets["rightTarget_qw"] = rightTargetState[3];
218  debugOutputData.getWriteBuffer().dmpTargets["rightTarget_qx"] = rightTargetState[4];
219  debugOutputData.getWriteBuffer().dmpTargets["rightTarget_qy"] = rightTargetState[5];
220  debugOutputData.getWriteBuffer().dmpTargets["rightTarget_qz"] = rightTargetState[6];
221 
222 
223  {
224  debugOutputData.getWriteBuffer().currentPose["leftPose_x"] = leftPose(0, 3);
225  debugOutputData.getWriteBuffer().currentPose["leftPose_y"] = leftPose(1, 3);
226  debugOutputData.getWriteBuffer().currentPose["leftPose_z"] = leftPose(2, 3);
228  VirtualRobot::MathTools::eigen4f2quat(leftPose);
229  debugOutputData.getWriteBuffer().currentPose["leftPose_qw"] = leftQuat.w;
230  debugOutputData.getWriteBuffer().currentPose["leftPose_qx"] = leftQuat.x;
231  debugOutputData.getWriteBuffer().currentPose["leftPose_qy"] = leftQuat.y;
232  debugOutputData.getWriteBuffer().currentPose["leftPose_qz"] = leftQuat.z;
233  }
234  {
235  debugOutputData.getWriteBuffer().currentPose["rightPose_x"] = rightPose(0, 3);
236  debugOutputData.getWriteBuffer().currentPose["rightPose_y"] = rightPose(1, 3);
237  debugOutputData.getWriteBuffer().currentPose["rightPose_z"] = rightPose(2, 3);
239  VirtualRobot::MathTools::eigen4f2quat(rightPose);
240  debugOutputData.getWriteBuffer().currentPose["rightPose_qw"] = rightQuat.w;
241  debugOutputData.getWriteBuffer().currentPose["rightPose_qx"] = rightQuat.x;
242  debugOutputData.getWriteBuffer().currentPose["rightPose_qy"] = rightQuat.y;
243  debugOutputData.getWriteBuffer().currentPose["rightPose_qz"] = rightQuat.z;
244  }
245 
246  debugOutputData.getWriteBuffer().canVal = canVal;
247  debugOutputData.getWriteBuffer().forceOnHands = forceOnHands;
248  debugOutputData.commitWrite();
249 
250 
251  getWriterControlStruct().leftTargetPose = leftDMPController->getTargetPoseMat();
252  getWriterControlStruct().rightTargetPose = rightDMPController->getTargetPoseMat();
254  }
255 
256 
257  void
259  const IceUtil::Time& timeSinceLastIteration)
260  {
261  Eigen::Matrix4f leftPose = leftTCP->getPoseInRootFrame();
262  Eigen::Matrix4f rightPose = rightTCP->getPoseInRootFrame();
263  Eigen::MatrixXf leftJacobi =
264  leftIK->getJacobianMatrix(leftTCP, VirtualRobot::IKSolver::CartesianSelection::All);
265  Eigen::MatrixXf rightJacobi =
266  leftIK->getJacobianMatrix(leftTCP, VirtualRobot::IKSolver::CartesianSelection::All);
267 
268  Eigen::VectorXf qvel;
269  qvel.resize(leftVelocitySensors.size());
270  for (size_t i = 0; i < leftVelocitySensors.size(); ++i)
271  {
272  qvel(i) = leftVelocitySensors[i]->velocity;
273  }
274  Eigen::Vector6f leftTwist = leftJacobi * qvel;
275  for (size_t i = 0; i < rightVelocitySensors.size(); ++i)
276  {
277  qvel(i) = rightVelocitySensors[i]->velocity;
278  }
279  Eigen::Vector6f rightTwist = rightJacobi * qvel;
280 
281  leftFilteredValue = (1 - cfg->filterCoeff) * (leftForceTorque->force - leftForceOffset) +
282  cfg->filterCoeff * leftFilteredValue;
283  rightFilteredValue = (1 - cfg->filterCoeff) * (rightForceTorque->force - rightForceOffset) +
284  cfg->filterCoeff * rightFilteredValue;
285 
286  Eigen::Matrix4f leftSensorFrame =
287  rtGetRobot()->getRobotNode("ArmL8_Wri2")->getPoseInRootFrame();
288  Eigen::Matrix4f rightSensorFrame =
289  rtGetRobot()->getRobotNode("ArmR8_Wri2")->getPoseInRootFrame();
290 
291  Eigen::Vector3f leftForceInRootFrame = leftPose.block<3, 3>(0, 0).transpose() *
292  leftSensorFrame.block<3, 3>(0, 0) *
293  leftFilteredValue;
294  Eigen::Vector3f rightForceInRootFrame = rightPose.block<3, 3>(0, 0).transpose() *
295  rightSensorFrame.block<3, 3>(0, 0) *
296  rightFilteredValue;
297 
298  controllerSensorData.getWriteBuffer().leftPoseInRootFrame = leftPose;
299  controllerSensorData.getWriteBuffer().rightPoseInRootFrame = rightPose;
300  controllerSensorData.getWriteBuffer().leftTwistInRootFrame = leftTwist;
301  controllerSensorData.getWriteBuffer().rightTwistInRootFrame = rightTwist;
302  controllerSensorData.getWriteBuffer().leftForceInRootFrame = leftForceInRootFrame;
303  controllerSensorData.getWriteBuffer().rightForceInRootFrame = rightForceInRootFrame;
304  controllerSensorData.getWriteBuffer().deltaT = timeSinceLastIteration.toSecondsDouble();
305  controllerSensorData.commitWrite();
306 
307  interfaceData.getWriteBuffer().leftTcpPoseInRootFrame = leftPose;
308  interfaceData.getWriteBuffer().rightTcpPoseInRootFrame = rightPose;
309  interfaceData.commitWrite();
310 
311 
312  Eigen::Matrix4f targetPose = rtGetControlStruct().leftTargetPose;
313  Eigen::Matrix4f currentPose = leftPose;
314  Eigen::Vector6f leftVel;
315 
316  {
317  Eigen::Matrix3f diffMat =
318  targetPose.block<3, 3>(0, 0) * currentPose.block<3, 3>(0, 0).inverse();
319  Eigen::Vector3f errorRPY = VirtualRobot::MathTools::eigen3f2rpy(diffMat);
320 
321  Eigen::Vector6f rtTargetVel;
322  rtTargetVel.block<3, 1>(0, 0) =
323  Kp_LinearVel * (targetPose.block<3, 1>(0, 3) - currentPose.block<3, 1>(0, 3)) +
324  Kd_LinearVel * (-leftTwist.block<3, 1>(0, 0));
325  rtTargetVel.block<3, 1>(3, 0) =
326  Kp_AngularVel * errorRPY + Kd_AngularVel * (-leftTwist.block<3, 1>(3, 0));
327 
328  float normLinearVelocity = rtTargetVel.block<3, 1>(0, 0).norm();
329  if (normLinearVelocity > cfg->maxLinearVel)
330  {
331  rtTargetVel.block<3, 1>(0, 0) =
332  cfg->maxLinearVel * rtTargetVel.block<3, 1>(0, 0) / normLinearVelocity;
333  }
334 
335  float normAngularVelocity = rtTargetVel.block<3, 1>(3, 0).norm();
336  if (normAngularVelocity > cfg->maxAngularVel)
337  {
338  rtTargetVel.block<3, 1>(3, 0) =
339  cfg->maxAngularVel * rtTargetVel.block<3, 1>(3, 0) / normAngularVelocity;
340  }
341 
342  for (size_t i = 0; i < 6; i++)
343  {
344  leftVel(i) = rtTargetVel(i);
345  }
346  }
347 
348  // cartesian vel controller
349 
350 
351  targetPose = rtGetControlStruct().rightTargetPose;
352  currentPose = rightPose;
353  Eigen::Vector6f rightVel;
354 
355  {
356  Eigen::Matrix3f diffMat =
357  targetPose.block<3, 3>(0, 0) * currentPose.block<3, 3>(0, 0).inverse();
358  Eigen::Vector3f errorRPY = VirtualRobot::MathTools::eigen3f2rpy(diffMat);
359 
360  Eigen::Vector6f rtTargetVel;
361  rtTargetVel.block<3, 1>(0, 0) =
362  Kp_LinearVel * (targetPose.block<3, 1>(0, 3) - currentPose.block<3, 1>(0, 3)) +
363  Kd_LinearVel * (-rightTwist.block<3, 1>(0, 0));
364  rtTargetVel.block<3, 1>(3, 0) =
365  Kp_AngularVel * errorRPY + Kd_AngularVel * (-rightTwist.block<3, 1>(3, 0));
366 
367  float normLinearVelocity = rtTargetVel.block<3, 1>(0, 0).norm();
368  if (normLinearVelocity > cfg->maxLinearVel)
369  {
370  rtTargetVel.block<3, 1>(0, 0) =
371  cfg->maxLinearVel * rtTargetVel.block<3, 1>(0, 0) / normLinearVelocity;
372  }
373 
374  float normAngularVelocity = rtTargetVel.block<3, 1>(3, 0).norm();
375  if (normAngularVelocity > cfg->maxAngularVel)
376  {
377  rtTargetVel.block<3, 1>(3, 0) =
378  cfg->maxAngularVel * rtTargetVel.block<3, 1>(3, 0) / normAngularVelocity;
379  }
380 
381  for (size_t i = 0; i < 6; i++)
382  {
383  rightVel(i) = rtTargetVel(i);
384  }
385  }
386 
387 
388  Eigen::VectorXf leftJTV =
389  leftTCPController->calculate(leftVel,
390  cfg->KpJointLimitAvoidanceScale,
391  VirtualRobot::IKSolver::CartesianSelection::All);
392  for (size_t i = 0; i < leftTargets.size(); ++i)
393  {
394  leftTargets.at(i)->velocity = leftJTV(i);
395  if (!leftTargets.at(i)->isValid())
396  {
399  << "Velocity controller target is invalid - setting to zero! set value: "
400  << leftTargets.at(i)->velocity;
401  leftTargets.at(i)->velocity = 0.0f;
402  }
403  }
404 
405  Eigen::VectorXf rightJTV =
406  rightTCPController->calculate(rightVel,
407  cfg->KpJointLimitAvoidanceScale,
408  VirtualRobot::IKSolver::CartesianSelection::All);
409  for (size_t i = 0; i < rightTargets.size(); ++i)
410  {
411  rightTargets.at(i)->velocity = rightJTV(i);
412  if (!rightTargets.at(i)->isValid())
413  {
416  << "Velocity controller target is invalid - setting to zero! set value: "
417  << rightTargets.at(i)->velocity;
418  rightTargets.at(i)->velocity = 0.0f;
419  }
420  }
421  }
422 
423 
424  void
426  const Ice::StringSeq& fileNames,
427  const Ice::Current&)
428  {
429  ARMARX_IMPORTANT << "Learn DMP " << whichDMP;
430  if (whichDMP == "Left")
431  {
432  leftDMPController->learnDMPFromFiles(fileNames);
433  leftLearned = true;
434  ARMARX_INFO << "Left Learned";
435  }
436  if (whichDMP == "Right")
437  {
438  rightDMPController->learnDMPFromFiles(fileNames);
439  rightLearned = true;
440  ARMARX_INFO << "Right Learned";
441  }
442  }
443 
444 
445  void
446  NJointBimanualForceMPController::runDMP(const Ice::DoubleSeq& leftGoals,
447  const Ice::DoubleSeq& rightGoals,
448  const Ice::Current&)
449  {
450  if (!leftLearned)
451  {
452  ARMARX_ERROR << "Left DMP is not learned, aborted";
453  return;
454  }
455 
456  if (!rightLearned)
457  {
458  ARMARX_ERROR << "Right DMP is not learned, aborted";
459  return;
460  }
461 
462  while (!interfaceData.updateReadBuffer())
463  {
464  usleep(100);
465  }
466 
467  Eigen::Matrix4f leftPose = interfaceData.getReadBuffer().leftTcpPoseInRootFrame;
468  Eigen::Matrix4f rightPose = interfaceData.getReadBuffer().rightTcpPoseInRootFrame;
469 
470  forceSign = leftGoals.at(2) - leftPose(2, 3) > 0 ? -1 : 1;
471  // Eigen::Matrix4f pose = tcp->getPoseInRootFrame();
472  ARMARX_IMPORTANT << "leftGoals dim: " << leftGoals.size();
473  ARMARX_IMPORTANT << "rightGoals dim: " << rightGoals.size();
474 
475  leftDMPController->prepareExecution(leftDMPController->eigen4f2vec(leftPose), leftGoals);
476  rightDMPController->prepareExecution(rightDMPController->eigen4f2vec(rightPose),
477  rightGoals);
478 
479  canVal = cfg->timeDuration;
480  finished = false;
481 
482  ARMARX_INFO << "run DMP";
483  controllerTask->start();
484  }
485 
486  void
488  double u,
489  const Ice::DoubleSeq& viaPoint,
490  const Ice::Current&)
491  {
492  if (whichDMP == "Left")
493  {
494  leftDMPController->setViaPose(u, viaPoint);
495  }
496  if (whichDMP == "Right")
497  {
498  rightDMPController->setViaPose(u, viaPoint);
499  }
500  }
501 
502  void
505  const DebugObserverInterfacePrx& debugObs)
506  {
507  std::string debugName = cfg->debugName;
508  std::string datafieldName = debugName;
509  StringVariantBaseMap datafields;
510 
511  auto dmpTargets = debugOutputData.getUpToDateReadBuffer().dmpTargets;
512  for (auto& pair : dmpTargets)
513  {
514  datafieldName = pair.first + "_" + debugName;
515  datafields[datafieldName] = new Variant(pair.second);
516  }
517 
518  auto currentPose = debugOutputData.getUpToDateReadBuffer().currentPose;
519  for (auto& pair : currentPose)
520  {
521  datafieldName = pair.first + "_" + debugName;
522  datafields[datafieldName] = new Variant(pair.second);
523  }
524 
525  datafieldName = "canVal_" + debugName;
526  datafields[datafieldName] = new Variant(debugOutputData.getUpToDateReadBuffer().canVal);
527 
528  datafieldName = "forceOnHands_" + debugName;
529  datafields[datafieldName] =
530  new Variant(debugOutputData.getUpToDateReadBuffer().forceOnHands);
531  datafieldName = "DMPController_" + debugName;
532 
533  debugObs->setDebugChannel(datafieldName, datafields);
534  }
535 
536  void
538  {
539  ARMARX_INFO << "init ...";
542  }
543 
544  void
546  {
547  ARMARX_INFO << "stopped ...";
548  controllerTask->stop();
549  }
550 
551 
552 } // namespace armarx::ctrl::njoint_ctrl::dmp
armarx::NJointControllerWithTripleBuffer< NJointBimanualForceMPControllerControlData >::reinitTripleBuffer
void reinitTripleBuffer(const NJointBimanualForceMPControllerControlData &initial)
Definition: NJointControllerWithTripleBuffer.h:68
armarx::control::deprecated_njoint_mp_controller::bimanual::NJointBimanualForceMPController::learnDMPFromFiles
void learnDMPFromFiles(const std::string &whichMP, const Ice::StringSeq &fileNames, const Ice::Current &) override
Definition: NJointBimanualForceMPController.cpp:425
armarx::ControlTargetBase::asA
const T * asA() const
Definition: ControlTargetBase.h:76
armarx::Variant
The Variant class is described here: Variants.
Definition: Variant.h:224
armarx::control::deprecated_njoint_mp_controller::tsvmp::PhaseStopParams::Kori
float Kori
Definition: TaskSpaceVMP.h:47
armarx::control::deprecated_njoint_mp_controller::bimanual::NJointBimanualForceMPController::getClassName
std::string getClassName(const Ice::Current &) const override
Definition: NJointBimanualForceMPController.cpp:156
armarx::control::deprecated_njoint_mp_controller::tsvmp::PhaseStopParams::Dpos
float Dpos
Definition: TaskSpaceVMP.h:46
armarx::TripleBuffer::getWriteBuffer
T & getWriteBuffer()
Definition: TripleBuffer.h:90
armarx::NJointControllerBase::useSynchronizedRtRobot
const VirtualRobot::RobotPtr & useSynchronizedRtRobot(bool updateCollisionModel=false)
Requests a VirtualRobot for use in rtRun *.
Definition: NJointController.cpp:293
armarx::NJointControllerWithTripleBuffer< NJointBimanualForceMPControllerControlData >::rtGetControlStruct
const NJointBimanualForceMPControllerControlData & rtGetControlStruct() const
Definition: NJointControllerWithTripleBuffer.h:32
armarx::control::deprecated_njoint_mp_controller::tsvmp::TaskSpaceDMPControllerConfig::DMPKernelSize
int DMPKernelSize
Definition: TaskSpaceVMP.h:54
armarx::StringVariantBaseMap
std::map< std::string, VariantBasePtr > StringVariantBaseMap
Definition: ManagedIceObject.h:111
ARMARX_IMPORTANT
#define ARMARX_IMPORTANT
Definition: Logging.h:183
armarx::SensorValueBase::asA
const T * asA() const
Definition: SensorValueBase.h:82
armarx::SensorValueBase
The SensorValueBase class.
Definition: SensorValueBase.h:40
armarx::ControlTargetBase
Brief description of class JointControlTargetBase.
Definition: ControlTargetBase.h:47
armarx::TripleBuffer::commitWrite
void commitWrite()
Definition: TripleBuffer.h:146
armarx::NJointControllerBase::useControlTarget
ControlTargetBase * useControlTarget(const std::string &deviceName, const std::string &controlMode)
Declares to calculate the ControlTarget for the given ControlDevice in the given ControlMode when rtR...
Definition: NJointController.cpp:410
armarx::control::deprecated_njoint_mp_controller::bimanual::NJointBimanualForceMPControllerControlData
Definition: NJointBimanualForceMPController.h:34
armarx::control::deprecated_njoint_mp_controller::bimanual::NJointBimanualForceMPControllerControlData::leftTargetPose
Eigen::Matrix4f leftTargetPose
Definition: NJointBimanualForceMPController.h:37
armarx::control::deprecated_njoint_mp_controller::tsvmp::TaskSpaceDMPControllerConfig
Definition: TaskSpaceVMP.h:52
armarx::CartesianVelocityController
Definition: CartesianVelocityController.h:36
armarx::control::deprecated_njoint_mp_controller::tsvmp::TaskSpaceDMPControllerConfig::phaseStopParas
PhaseStopParams phaseStopParas
Definition: TaskSpaceVMP.h:60
armarx::NJointControllerWithTripleBuffer< NJointBimanualForceMPControllerControlData >::getWriterControlStruct
NJointBimanualForceMPControllerControlData & getWriterControlStruct()
Definition: NJointControllerWithTripleBuffer.h:54
armarx::control::deprecated_njoint_mp_controller::tsvmp::PhaseStopParams::goDist
float goDist
Definition: TaskSpaceVMP.h:41
armarx::control::deprecated_njoint_mp_controller::bimanual::registrationControllerNJointBimanualForceMPController
NJointControllerRegistration< NJointBimanualForceMPController > registrationControllerNJointBimanualForceMPController("NJointBimanualForceMPController")
armarx::SensorValueForceTorque::force
Eigen::Vector3f force
Definition: SensorValueForceTorque.h:35
armarx::VariantType::Quaternion
const VariantTypeId Quaternion
Definition: Pose.h:39
armarx::control::deprecated_njoint_mp_controller::tsvmp::TaskSpaceDMPControllerConfig::motionTimeDuration
float motionTimeDuration
Definition: TaskSpaceVMP.h:59
armarx::NJointControllerBase::rtGetRobot
const VirtualRobot::RobotPtr & rtGetRobot()
TODO make protected and use attorneys.
Definition: NJointControllerBase.h:845
armarx::control::deprecated_njoint_mp_controller::tsvmp::PhaseStopParams::backDist
float backDist
Definition: TaskSpaceVMP.h:42
armarx::control::deprecated_njoint_mp_controller::tsvmp::PhaseStopParams::maxValue
float maxValue
Definition: TaskSpaceVMP.h:43
armarx::detail::ControlThreadOutputBufferEntry
Definition: ControlThreadOutputBuffer.h:177
armarx::control::deprecated_njoint_mp_controller::tsvmp::PhaseStopParams::Dori
float Dori
Definition: TaskSpaceVMP.h:48
armarx::control::deprecated_njoint_mp_controller::bimanual::NJointBimanualForceMPController::rtRun
void rtRun(const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration) override
TODO make protected and use attorneys.
Definition: NJointBimanualForceMPController.cpp:258
if
if(!yyvaluep)
Definition: Grammar.cpp:724
armarx::control::deprecated_njoint_mp_controller::bimanual::NJointBimanualForceMPControllerControlData::rightTargetPose
Eigen::Matrix4f rightTargetPose
Definition: NJointBimanualForceMPController.h:38
armarx::control::deprecated_njoint_mp_controller::bimanual::NJointBimanualForceMPController::setViaPoints
void setViaPoints(const std::string &whichDMP, double canVal, const Ice::DoubleSeq &viaPoint, const Ice::Current &) override
Definition: NJointBimanualForceMPController.cpp:487
armarx::NJointControllerWithTripleBuffer< NJointBimanualForceMPControllerControlData >::writeControlStruct
void writeControlStruct()
Definition: NJointControllerWithTripleBuffer.h:44
armarx::TripleBuffer::getReadBuffer
const T & getReadBuffer() const
Definition: TripleBuffer.h:102
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
armarx::control::deprecated_njoint_mp_controller::tsvmp::TaskSpaceDMPControllerConfig::DMPAmplitude
float DMPAmplitude
Definition: TaskSpaceVMP.h:57
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::control::deprecated_njoint_mp_controller::tsvmp::PhaseStopParams::slop
float slop
Definition: TaskSpaceVMP.h:44
armarx::to_string
const std::string & to_string(const std::string &s)
Definition: StringHelpers.h:40
armarx::control::deprecated_njoint_mp_controller::tsvmp::PhaseStopParams::Kpos
float Kpos
Definition: TaskSpaceVMP.h:45
GfxTL::Matrix3f
MatrixXX< 3, 3, float > Matrix3f
Definition: MatrixXX.h:600
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx::control::deprecated_njoint_mp_controller::bimanual::NJointBimanualForceMPController::onInitNJointController
void onInitNJointController() override
Definition: NJointBimanualForceMPController.cpp:537
NJointBimanualForceMPController.h
armarx::control::deprecated_njoint_mp_controller::tsvmp::TaskSpaceDMPControllerConfig::DMPStyle
std::string DMPStyle
Definition: TaskSpaceVMP.h:56
IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface >
armarx::control::deprecated_njoint_mp_controller::tsvmp::TaskSpaceDMPControllerConfig::DMPMode
std::string DMPMode
Definition: TaskSpaceVMP.h:55
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
Eigen::Matrix< float, 6, 1 >
armarx::control::deprecated_njoint_mp_controller::tsvmp::PhaseStopParams::mm2radi
float mm2radi
Definition: TaskSpaceVMP.h:49
armarx::PeriodicTask
Definition: ArmarXManager.h:70
armarx::TripleBuffer::getUpToDateReadBuffer
const T & getUpToDateReadBuffer() const
Definition: TripleBuffer.h:108
armarx::SensorValueForceTorque
Definition: SensorValueForceTorque.h:31
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:186
armarx::transpose
std::vector< std::vector< T > > transpose(const std::vector< std::vector< T >> &src, Thrower thrower)
Definition: SimoxCSpace.cpp:706
armarx::control::deprecated_njoint_mp_controller::bimanual::NJointBimanualForceMPController::runDMP
void runDMP(const Ice::DoubleSeq &leftGoals, const Ice::DoubleSeq &rightGoals, const Ice::Current &) override
Definition: NJointBimanualForceMPController.cpp:446
armarx::control::deprecated_njoint_mp_controller::bimanual::NJointBimanualForceMPController::onPublish
virtual void onPublish(const SensorAndControl &, const DebugDrawerInterfacePrx &, const DebugObserverInterfacePrx &) override
Definition: NJointBimanualForceMPController.cpp:503
armarx::control::deprecated_njoint_mp_controller::bimanual::NJointBimanualForceMPController::controllerRun
void controllerRun()
Definition: NJointBimanualForceMPController.cpp:162
armarx::TripleBuffer::reinitAllBuffers
std::enable_if< std::is_copy_constructible< U >::value >::type reinitAllBuffers(const T &init)
Definition: TripleBuffer.h:153
armarx::control::deprecated_njoint_mp_controller::tsvmp::TaskSpaceDMPController
Brief description of class TaskSpaceDMPController.
Definition: TaskSpaceVMP.h:83
armarx::NJointControllerBase::useSensorValue
const SensorValueBase * useSensorValue(const std::string &sensorDeviceName) const
Get a const ptr to the given SensorDevice's SensorValue.
Definition: NJointController.cpp:383
armarx::control::deprecated_njoint_mp_controller::bimanual::NJointBimanualForceMPController::onDisconnectNJointController
void onDisconnectNJointController() override
Definition: NJointBimanualForceMPController.cpp:545
armarx::control::deprecated_njoint_mp_controller::bimanual::NJointBimanualForceMPController::NJointBimanualForceMPController
NJointBimanualForceMPController(const RobotUnitPtr &, const NJointControllerConfigPtr &config, const VirtualRobot::RobotPtr &)
Definition: NJointBimanualForceMPController.cpp:11
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18
armarx::control::deprecated_njoint_mp_controller::bimanual
Definition: NJointBimanualCartesianAdmittanceController.cpp:9
armarx::TripleBuffer::updateReadBuffer
bool updateReadBuffer() const
Swaps in the hidden buffer if it contains new data.
Definition: TripleBuffer.h:131
norm
double norm(const Point &a)
Definition: point.hpp:94