5 #include <VirtualRobot/IK/DifferentialIK.h>
6 #include <VirtualRobot/MathTools.h>
7 #include <VirtualRobot/Nodes/RobotNode.h>
8 #include <VirtualRobot/Robot.h>
9 #include <VirtualRobot/RobotNodeSet.h>
12 #include <dmp/representation/dmp/umitsmp.h>
29 NJointControllerRegistration<NJointBimanualCCDMPController>
34 const armarx::NJointControllerConfigPtr& config,
38 cfg = NJointBimanualCCDMPControllerConfigPtr::dynamicCast(config);
43 leftRNS =
rtGetRobot()->getRobotNodeSet(
"LeftArm");
44 leftNullSpaceCoefs.resize(leftRNS->getSize());
45 leftNullSpaceCoefs.setOnes();
47 for (
size_t i = 0; i < leftRNS->getSize(); ++i)
49 std::string jointName = leftRNS->getNode(i)->getName();
51 if (leftRNS->getNode(i)->isLimitless())
53 leftNullSpaceCoefs(i) = 1;
56 leftJointNames.push_back(jointName);
57 ControlTargetBase* ct =
useControlTarget(jointName, ControlModes::Torque1DoF);
59 leftTargets.push_back(ct->asA<ControlTarget1DoFActuatorTorque>());
60 const SensorValue1DoFActuatorVelocity* velocitySensor =
61 sv->asA<SensorValue1DoFActuatorVelocity>();
62 const SensorValue1DoFActuatorPosition* positionSensor =
63 sv->asA<SensorValue1DoFActuatorPosition>();
64 const SensorValue1DoFActuatorAcceleration* accelerationSensor =
65 sv->asA<SensorValue1DoFActuatorAcceleration>();
76 if (!accelerationSensor)
78 ARMARX_WARNING <<
"No accelerationSensor available for " << jointName;
82 leftVelocitySensors.push_back(velocitySensor);
83 leftPositionSensors.push_back(positionSensor);
84 leftAccelerationSensors.push_back(accelerationSensor);
86 rightRNS =
rtGetRobot()->getRobotNodeSet(
"RightArm");
88 rightNullSpaceCoefs.resize(rightRNS->getSize());
89 rightNullSpaceCoefs.setOnes();
90 for (
size_t i = 0; i < rightRNS->getSize(); ++i)
92 std::string jointName = rightRNS->getNode(i)->getName();
94 if (rightRNS->getNode(i)->isLimitless())
96 rightNullSpaceCoefs(i) = 1;
99 rightJointNames.push_back(jointName);
100 ControlTargetBase* ct =
useControlTarget(jointName, ControlModes::Torque1DoF);
102 rightTargets.push_back(ct->asA<ControlTarget1DoFActuatorTorque>());
103 const SensorValue1DoFActuatorVelocity* velocitySensor =
104 sv->asA<SensorValue1DoFActuatorVelocity>();
105 const SensorValue1DoFActuatorPosition* positionSensor =
106 sv->asA<SensorValue1DoFActuatorPosition>();
107 const SensorValue1DoFActuatorAcceleration* accelerationSensor =
108 sv->asA<SensorValue1DoFActuatorAcceleration>();
113 ARMARX_WARNING <<
"No velocitySensor available for " << jointName;
117 ARMARX_WARNING <<
"No positionSensor available for " << jointName;
119 if (!accelerationSensor)
121 ARMARX_WARNING <<
"No accelerationSensor available for " << jointName;
124 rightVelocitySensors.push_back(velocitySensor);
125 rightPositionSensors.push_back(positionSensor);
126 rightAccelerationSensors.push_back(accelerationSensor);
131 leftForceTorque = svlf->
asA<SensorValueForceTorque>();
133 rightForceTorque = svrf->
asA<SensorValueForceTorque>();
135 leftIK.reset(
new VirtualRobot::DifferentialIK(
136 leftRNS,
rtGetRobot()->getRootNode(), VirtualRobot::JacobiProvider::eSVDDamped));
137 rightIK.reset(
new VirtualRobot::DifferentialIK(
138 rightRNS,
rtGetRobot()->getRootNode(), VirtualRobot::JacobiProvider::eSVDDamped));
144 taskSpaceDMPConfig.
DMPMode = cfg->dmpMode;
145 taskSpaceDMPConfig.
DMPStyle = cfg->dmpType;
167 leftGroup.push_back(leftLeader);
168 leftGroup.push_back(rightFollower);
170 rightGroup.push_back(rightLeader);
171 rightGroup.push_back(leftFollower);
173 bothLeaderGroup.push_back(leftLeader);
174 bothLeaderGroup.push_back(rightLeader);
177 tcpLeft = leftRNS->getTCP();
178 tcpRight = rightRNS->getTCP();
181 leaderName = cfg->defautLeader;
184 leftDesiredJointValues.resize(leftTargets.size());
187 for (
size_t i = 0; i < leftTargets.size(); ++i)
189 leftDesiredJointValues(i) = cfg->leftDesiredJointValues.at(i);
192 rightDesiredJointValues.resize(rightTargets.size());
195 for (
size_t i = 0; i < rightTargets.size(); ++i)
197 rightDesiredJointValues(i) = cfg->rightDesiredJointValues.at(i);
201 leftKpos << cfg->leftKpos[0], cfg->leftKpos[1], cfg->leftKpos[2];
202 leftDpos << cfg->leftDpos[0], cfg->leftDpos[1], cfg->leftDpos[2];
203 leftKori << cfg->leftKori[0], cfg->leftKori[1], cfg->leftKori[2];
204 leftDori << cfg->leftDori[0], cfg->leftDori[1], cfg->leftDori[2];
206 rightKpos << cfg->rightKpos[0], cfg->rightKpos[1], cfg->rightKpos[2];
207 rightDpos << cfg->rightDpos[0], cfg->rightDpos[1], cfg->rightDpos[2];
208 rightKori << cfg->rightKori[0], cfg->rightKori[1], cfg->rightKori[2];
209 rightDori << cfg->rightDori[0], cfg->rightDori[1], cfg->rightDori[2];
215 torqueLimit = cfg->torqueLimit;
218 maxLinearVel = cfg->maxLinearVel;
219 maxAngularVel = cfg->maxAngularVel;
222 startReduceTorque = cfg->startReduceTorque;
224 NJointBimanualCCDMPControllerInterfaceData initInterfaceData;
229 NJointBimanualCCDMPControllerSensorData initSensorData;
230 initSensorData.deltaT = 0;
231 initSensorData.currentTime = 0;
240 return "NJointBimanualCCDMPController";
268 Eigen::VectorXf leftTargetVel;
269 leftTargetVel.resize(6);
270 leftTargetVel.setZero();
271 Eigen::VectorXf rightTargetVel;
272 rightTargetVel.resize(6);
273 rightTargetVel.setZero();
275 std::vector<tsvmp::TaskSpaceDMPControllerPtr> currentControlGroup;
278 Eigen::VectorXf currentLeaderTwist;
279 Eigen::VectorXf currentFollowerTwist;
280 if (leaderName ==
"Left")
282 currentControlGroup = leftGroup;
283 currentLeaderPose = controllerSensorData.
getReadBuffer().currentLeftPose;
284 currentFollowerPose = controllerSensorData.
getReadBuffer().currentRightPose;
285 currentLeaderTwist = controllerSensorData.
getReadBuffer().currentLeftTwist;
286 currentFollowerTwist = controllerSensorData.
getReadBuffer().currentRightTwist;
288 else if (leaderName ==
"right")
290 currentControlGroup = rightGroup;
291 currentLeaderPose = controllerSensorData.
getReadBuffer().currentRightPose;
292 currentFollowerPose = controllerSensorData.
getReadBuffer().currentLeftPose;
293 currentLeaderTwist = controllerSensorData.
getReadBuffer().currentRightTwist;
294 currentFollowerTwist = controllerSensorData.
getReadBuffer().currentLeftTwist;
298 currentControlGroup = bothLeaderGroup;
302 leaderDMPleft->flow(deltaT,
305 leaderDMPright->flow(deltaT,
309 Eigen::VectorXf leftTargetVel = leaderDMPleft->getTargetVelocity();
311 Eigen::VectorXf rightTargetVel = leaderDMPright->getTargetVelocity();
314 virtualtimer = leaderDMPleft->canVal;
327 virtualtimer = leaderDMP->canVal;
329 if (virtualtimer < 1e-8)
335 leaderDMP->flow(deltaT, currentLeaderPose, currentLeaderTwist);
338 currentFollowerLocalPose.block<3, 3>(0, 0) =
339 currentLeaderPose.block<3, 3>(0, 0).inverse() * currentFollowerPose.block<3, 3>(0, 0);
340 currentFollowerLocalPose.block<3, 1>(0, 3) =
341 currentLeaderPose.block<3, 3>(0, 0).inverse() *
342 (currentFollowerPose.block<3, 1>(0, 3) - currentLeaderPose.block<3, 1>(0, 3));
343 followerDMP->flow(deltaT, currentFollowerLocalPose, currentFollowerTwist);
345 Eigen::VectorXf leaderTargetVel = leaderDMP->getTargetVelocity();
347 Eigen::Matrix4f followerLocalTargetPose = followerDMP->getTargetPoseMat();
348 std::vector<double> followerLocalTargetPoseVec = followerDMP->getTargetPose();
351 followerTargetPose.block<3, 3>(0, 0) =
352 currentLeaderPose.block<3, 3>(0, 0) * followerLocalTargetPose.block<3, 3>(0, 0);
353 followerTargetPose.block<3, 1>(0, 3) =
354 currentLeaderPose.block<3, 3>(0, 0) * followerLocalTargetPose.block<3, 1>(0, 3) +
355 currentLeaderPose.block<3, 1>(0, 3);
358 Eigen::VectorXf followerLocalTargetVel = followerDMP->getTargetVelocity();
359 Eigen::VectorXf followerTargetVel = followerLocalTargetVel;
360 followerTargetVel.setZero();
371 std::vector<double> leftDMPTarget;
372 std::vector<double> rightDMPTarget;
380 if (leaderName ==
"Left")
382 leftTargetVel = leaderTargetVel;
383 rightTargetVel = followerTargetVel;
385 leftDMPTarget = leaderDMP->getTargetPose();
386 rightDMPTarget = followerLocalTargetPoseVec;
389 leftTargetPose = leaderTargetPose;
390 rightTargetPose = followerTargetPose;
392 else if (leaderName ==
"right")
394 rightTargetVel = leaderTargetVel;
395 leftTargetVel = followerTargetVel;
397 rightDMPTarget = leaderDMP->getTargetPose();
398 leftDMPTarget = followerLocalTargetPoseVec;
400 rightTargetPose = leaderTargetPose;
401 leftTargetPose = followerTargetPose;
415 NJointBimanualCCDMPController::getControlWrench(
const Eigen::VectorXf& tcptwist,
438 return Eigen::Vector6f::Zero();
445 double deltaT = timeSinceLastIteration.toSecondsDouble();
448 interfaceData.
getWriteBuffer().currentLeftPose = tcpLeft->getPoseInRootFrame();
449 interfaceData.
getWriteBuffer().currentRightPose = tcpRight->getPoseInRootFrame();
452 controllerSensorData.
getWriteBuffer().currentLeftPose = tcpLeft->getPoseInRootFrame();
453 controllerSensorData.
getWriteBuffer().currentRightPose = tcpRight->getPoseInRootFrame();
460 Eigen::MatrixXf jacobiL =
461 leftIK->getJacobianMatrix(tcpLeft, VirtualRobot::IKSolver::CartesianSelection::All);
463 Eigen::VectorXf leftqpos;
464 Eigen::VectorXf leftqvel;
465 leftqpos.resize(leftPositionSensors.size());
466 leftqvel.resize(leftVelocitySensors.size());
467 for (
size_t i = 0; i < leftVelocitySensors.size(); ++i)
469 leftqpos(i) = leftPositionSensors[i]->position;
470 leftqvel(i) = leftVelocitySensors[i]->velocity;
473 Eigen::MatrixXf jacobiR =
474 rightIK->getJacobianMatrix(tcpRight, VirtualRobot::IKSolver::CartesianSelection::All);
477 Eigen::VectorXf rightqpos;
478 Eigen::VectorXf rightqvel;
479 rightqpos.resize(rightPositionSensors.size());
480 rightqvel.resize(rightVelocitySensors.size());
482 for (
size_t i = 0; i < rightVelocitySensors.size(); ++i)
484 rightqpos(i) = rightPositionSensors[i]->position;
485 rightqvel(i) = rightVelocitySensors[i]->velocity;
488 Eigen::VectorXf currentLeftTwist = jacobiL * leftqvel;
489 Eigen::VectorXf currentRightTwist = jacobiR * rightqvel;
491 controllerSensorData.
getWriteBuffer().currentLeftTwist = currentLeftTwist;
492 controllerSensorData.
getWriteBuffer().currentRightTwist = currentRightTwist;
496 jacobiL.block<3, 8>(0, 0) = 0.001 * jacobiL.block<3, 8>(0, 0);
497 jacobiR.block<3, 8>(0, 0) = 0.001 * jacobiR.block<3, 8>(0, 0);
507 float normLinearVelocity = leftTargetVel.block<3, 1>(0, 0).
norm();
508 if (normLinearVelocity > maxLinearVel)
510 leftTargetVel.block<3, 1>(0, 0) =
511 maxLinearVel * leftTargetVel.block<3, 1>(0, 0) / normLinearVelocity;
513 float normAngularVelocity = leftTargetVel.block<3, 1>(3, 0).
norm();
514 if (normAngularVelocity > maxAngularVel)
516 leftTargetVel.block<3, 1>(3, 0) =
517 maxAngularVel * leftTargetVel.block<3, 1>(3, 0) / normAngularVelocity;
521 normLinearVelocity = rightTargetVel.block<3, 1>(0, 0).
norm();
522 if (normLinearVelocity > maxLinearVel)
524 rightTargetVel.block<3, 1>(0, 0) =
525 maxLinearVel * rightTargetVel.block<3, 1>(0, 0) / normLinearVelocity;
527 normAngularVelocity = leftTargetVel.block<3, 1>(3, 0).
norm();
528 if (normAngularVelocity > maxAngularVel)
530 rightTargetVel.block<3, 1>(3, 0) =
531 maxAngularVel * rightTargetVel.block<3, 1>(3, 0) / normAngularVelocity;
540 Eigen::Vector3f targetTCPLinearVelocity;
541 targetTCPLinearVelocity << 0.001 * leftTargetVel(0), 0.001 * leftTargetVel(1),
542 0.001 * leftTargetVel(2);
544 Eigen::Vector3f currentTCPLinearVelocity;
545 currentTCPLinearVelocity << 0.001 * currentLeftTwist(0), 0.001 * currentLeftTwist(1),
546 0.001 * currentLeftTwist(2);
547 Eigen::Vector3f currentTCPAngularVelocity;
548 currentTCPAngularVelocity << currentLeftTwist(3), currentLeftTwist(4),
550 Eigen::Vector3f currentTCPPosition = leftCurrentPose.block<3, 1>(0, 3);
551 Eigen::Vector3f desiredPosition = leftTargetPose.block<3, 1>(0, 3);
553 Eigen::Vector3f tcpDesiredForce =
554 0.001 * leftKpos.cwiseProduct(desiredPosition - currentTCPPosition) +
555 leftDpos.cwiseProduct(targetTCPLinearVelocity - currentTCPLinearVelocity);
557 Eigen::Matrix3f diffMat = leftTargetPose.block<3, 3>(0, 0) * currentRotMat.inverse();
558 Eigen::Vector3f rpy = VirtualRobot::MathTools::eigen3f2rpy(diffMat);
559 Eigen::Vector3f tcpDesiredTorque =
560 leftKori.cwiseProduct(rpy) - leftDori.cwiseProduct(currentTCPAngularVelocity);
561 leftJointControlWrench << tcpDesiredForce, tcpDesiredTorque;
567 Eigen::Vector3f targetTCPLinearVelocity;
568 targetTCPLinearVelocity << 0.001 * rightTargetVel(0), 0.001 * rightTargetVel(1),
569 0.001 * rightTargetVel(2);
571 Eigen::Vector3f currentTCPLinearVelocity;
572 currentTCPLinearVelocity << 0.001 * currentRightTwist(0), 0.001 * currentRightTwist(1),
573 0.001 * currentRightTwist(2);
574 Eigen::Vector3f currentTCPAngularVelocity;
575 currentTCPAngularVelocity << currentRightTwist(3), currentRightTwist(4),
576 currentRightTwist(5);
577 Eigen::Vector3f currentTCPPosition = rightCurrentPose.block<3, 1>(0, 3);
578 Eigen::Vector3f desiredPosition = rightTargetPose.block<3, 1>(0, 3);
580 Eigen::Vector3f tcpDesiredForce =
581 0.001 * rightKpos.cwiseProduct(desiredPosition - currentTCPPosition) +
582 rightDpos.cwiseProduct(targetTCPLinearVelocity - currentTCPLinearVelocity);
584 Eigen::Matrix3f diffMat = rightTargetPose.block<3, 3>(0, 0) * currentRotMat.inverse();
585 Eigen::Vector3f rpy = VirtualRobot::MathTools::eigen3f2rpy(diffMat);
586 Eigen::Vector3f tcpDesiredTorque =
587 rightKori.cwiseProduct(rpy) - rightDori.cwiseProduct(currentTCPAngularVelocity);
588 rightJointControlWrench << tcpDesiredForce, tcpDesiredTorque;
624 Eigen::VectorXf leftNullspaceTorque =
625 knull * (leftDesiredJointValues - leftqpos) - dnull * leftqvel;
626 Eigen::VectorXf rightNullspaceTorque =
627 knull * (rightDesiredJointValues - rightqpos) - dnull * rightqvel;
631 Eigen::MatrixXf jtpinvL =
632 leftIK->computePseudoInverseJacobianMatrix(jacobiL.transpose(), lambda);
633 Eigen::MatrixXf jtpinvR =
634 rightIK->computePseudoInverseJacobianMatrix(jacobiR.transpose(), lambda);
635 Eigen::VectorXf leftJointDesiredTorques =
636 jacobiL.transpose() * leftJointControlWrench +
637 (I - jacobiL.transpose() * jtpinvL) *
638 leftNullSpaceCoefs.cwiseProduct(leftNullspaceTorque);
639 Eigen::VectorXf rightJointDesiredTorques =
640 jacobiR.transpose() * rightJointControlWrench +
641 (I - jacobiR.transpose() * jtpinvR) *
642 rightNullSpaceCoefs.cwiseProduct(rightNullspaceTorque);
646 for (
size_t i = 0; i < leftTargets.size(); ++i)
648 float desiredTorque = leftJointDesiredTorques(i);
650 if (isnan(desiredTorque))
655 desiredTorque = (desiredTorque > torqueLimit) ? torqueLimit : desiredTorque;
656 desiredTorque = (desiredTorque < -torqueLimit) ? -torqueLimit : desiredTorque;
658 debugDataInfo.
getWriteBuffer().desired_torques[leftJointNames[i]] = desiredTorque;
660 leftTargets.at(i)->torque = desiredTorque;
664 for (
size_t i = 0; i < rightTargets.size(); ++i)
666 float desiredTorque = rightJointDesiredTorques(i);
668 if (isnan(desiredTorque))
673 desiredTorque = (desiredTorque > torqueLimit) ? torqueLimit : desiredTorque;
674 desiredTorque = (desiredTorque < -torqueLimit) ? -torqueLimit : desiredTorque;
676 debugDataInfo.
getWriteBuffer().desired_torques[rightJointNames[i]] = desiredTorque;
678 rightTargets.at(i)->torque = desiredTorque;
680 debugDataInfo.
getWriteBuffer().leftControlSignal_x = leftJointControlWrench(0);
682 debugDataInfo.
getWriteBuffer().leftControlSignal_x = leftJointControlWrench(0);
683 debugDataInfo.
getWriteBuffer().leftControlSignal_y = leftJointControlWrench(1);
684 debugDataInfo.
getWriteBuffer().leftControlSignal_z = leftJointControlWrench(2);
685 debugDataInfo.
getWriteBuffer().leftControlSignal_ro = leftJointControlWrench(3);
686 debugDataInfo.
getWriteBuffer().leftControlSignal_pi = leftJointControlWrench(4);
687 debugDataInfo.
getWriteBuffer().leftControlSignal_ya = leftJointControlWrench(5);
689 debugDataInfo.
getWriteBuffer().rightControlSignal_x = rightJointControlWrench(0);
690 debugDataInfo.
getWriteBuffer().rightControlSignal_y = rightJointControlWrench(1);
691 debugDataInfo.
getWriteBuffer().rightControlSignal_z = rightJointControlWrench(2);
692 debugDataInfo.
getWriteBuffer().rightControlSignal_ro = rightJointControlWrench(3);
693 debugDataInfo.
getWriteBuffer().rightControlSignal_pi = rightJointControlWrench(4);
694 debugDataInfo.
getWriteBuffer().rightControlSignal_ya = rightJointControlWrench(5);
700 debugDataInfo.
getWriteBuffer().leftTargetPose_x = leftTargetPose(0, 3);
701 debugDataInfo.
getWriteBuffer().leftTargetPose_y = leftTargetPose(1, 3);
702 debugDataInfo.
getWriteBuffer().leftTargetPose_z = leftTargetPose(2, 3);
703 debugDataInfo.
getWriteBuffer().leftCurrentPose_x = leftCurrentPose(0, 3);
704 debugDataInfo.
getWriteBuffer().leftCurrentPose_y = leftCurrentPose(1, 3);
705 debugDataInfo.
getWriteBuffer().leftCurrentPose_z = leftCurrentPose(2, 3);
708 debugDataInfo.
getWriteBuffer().rightTargetPose_x = rightTargetPose(0, 3);
709 debugDataInfo.
getWriteBuffer().rightTargetPose_y = rightTargetPose(1, 3);
710 debugDataInfo.
getWriteBuffer().rightTargetPose_z = rightTargetPose(2, 3);
712 debugDataInfo.
getWriteBuffer().rightCurrentPose_x = rightCurrentPose(0, 3);
713 debugDataInfo.
getWriteBuffer().rightCurrentPose_y = rightCurrentPose(1, 3);
714 debugDataInfo.
getWriteBuffer().rightCurrentPose_z = rightCurrentPose(2, 3);
740 const Ice::StringSeq& fileNames,
743 if (name ==
"LeftLeader")
745 leftGroup.at(0)->learnDMPFromFiles(fileNames);
747 else if (name ==
"LeftFollower")
749 rightGroup.at(1)->learnDMPFromFiles(fileNames);
751 else if (name ==
"RightLeader")
753 rightGroup.at(0)->learnDMPFromFiles(fileNames);
757 leftGroup.at(1)->learnDMPFromFiles(fileNames);
763 const Ice::DoubleSeq& viapoint,
767 if (leaderName ==
"Left")
769 leftGroup.at(0)->setViaPose(u, viapoint);
773 rightGroup.at(0)->setViaPose(u, viapoint);
781 if (leaderName ==
"Left")
783 leftGroup.at(0)->setGoalPoseVec(goals);
787 rightGroup.at(0)->setGoalPoseVec(goals);
796 if (leaderName ==
"Left")
798 leaderName =
"Right";
799 rightGroup.at(0)->canVal = virtualtimer;
800 rightGroup.at(1)->canVal = virtualtimer;
805 leftGroup.at(0)->canVal = virtualtimer;
806 leftGroup.at(1)->canVal = virtualtimer;
812 const Ice::DoubleSeq& rightGoals,
826 virtualtimer = cfg->timeDuration;
828 leftGroup.at(0)->prepareExecution(leftGroup.at(0)->eigen4f2vec(leftPose), leftGoals);
829 rightGroup.at(0)->prepareExecution(rightGroup.at(0)->eigen4f2vec(rightPose), rightGoals);
832 ARMARX_INFO <<
"leftgroup goal local pose: " << getLocalPose(leftGoals, rightGoals);
834 leftGroup.at(1)->prepareExecution(getLocalPose(leftPose, rightPose),
835 getLocalPose(leftGoals, rightGoals));
836 rightGroup.at(1)->prepareExecution(getLocalPose(rightPose, leftPose),
837 getLocalPose(rightGoals, leftGoals));
840 controllerTask->start();
844 NJointBimanualCCDMPController::getLocalPose(
const Eigen::Matrix4f& newCoordinate,
849 localPose.block<3, 3>(0, 0) =
850 newCoordinate.block<3, 3>(0, 0).inverse() * globalTargetPose.block<3, 3>(0, 0);
851 localPose.block<3, 1>(0, 3) =
852 newCoordinate.block<3, 3>(0, 0).inverse() *
853 (globalTargetPose.block<3, 1>(0, 3) - newCoordinate.block<3, 1>(0, 3));
869 datafields[pair.first] =
new Variant(pair.second);
873 for (
auto& pair : constrained_force)
875 datafields[pair.first] =
new Variant(pair.second);
879 datafields[
"leftTargetPose_x"] =
881 datafields[
"leftTargetPose_y"] =
883 datafields[
"leftTargetPose_z"] =
885 datafields[
"rightTargetPose_x"] =
887 datafields[
"rightTargetPose_y"] =
889 datafields[
"rightTargetPose_z"] =
893 datafields[
"leftCurrentPose_x"] =
895 datafields[
"leftCurrentPose_y"] =
897 datafields[
"leftCurrentPose_z"] =
899 datafields[
"rightCurrentPose_x"] =
901 datafields[
"rightCurrentPose_y"] =
903 datafields[
"rightCurrentPose_z"] =
906 datafields[
"leftControlSignal_x"] =
908 datafields[
"leftControlSignal_y"] =
910 datafields[
"leftControlSignal_z"] =
912 datafields[
"leftControlSignal_ro"] =
914 datafields[
"leftControlSignal_pi"] =
916 datafields[
"leftControlSignal_ya"] =
920 datafields[
"rightControlSignal_x"] =
922 datafields[
"rightControlSignal_y"] =
924 datafields[
"rightControlSignal_z"] =
926 datafields[
"rightControlSignal_ro"] =
928 datafields[
"rightControlSignal_pi"] =
930 datafields[
"rightControlSignal_ya"] =
933 datafields[
"virtual_timer"] =
937 debugObs->setDebugChannel(
"DMPController", datafields);
951 controllerTask->stop();
956 NJointBimanualCCDMPController::getLocalPose(
const std::vector<double>& newCoordinateVec,
957 const std::vector<double>& globalTargetPoseVec)
960 VirtualRobot::MathTools::quat2eigen4f(newCoordinateVec.at(4),
961 newCoordinateVec.at(5),
962 newCoordinateVec.at(6),
963 newCoordinateVec.at(3));
964 newCoordinate(0, 3) = newCoordinateVec.at(0);
965 newCoordinate(1, 3) = newCoordinateVec.at(1);
966 newCoordinate(2, 3) = newCoordinateVec.at(2);
969 VirtualRobot::MathTools::quat2eigen4f(globalTargetPoseVec.at(4),
970 globalTargetPoseVec.at(5),
971 globalTargetPoseVec.at(6),
972 globalTargetPoseVec.at(3));
973 globalTargetPose(0, 3) = globalTargetPoseVec.at(0);
974 globalTargetPose(1, 3) = globalTargetPoseVec.at(1);
975 globalTargetPose(2, 3) = globalTargetPoseVec.at(2);
977 return getLocalPose(newCoordinate, globalTargetPose);