14 cfg = NJointBimanualCCDMPVelocityControllerConfigPtr::dynamicCast(config);
19 leftRNS =
rtGetRobot()->getRobotNodeSet(
"LeftArm");
20 leftNullSpaceCoefs.resize(leftRNS->getSize());
21 leftNullSpaceCoefs.setOnes();
23 for (
size_t i = 0; i < leftRNS->getSize(); ++i)
25 std::string jointName = leftRNS->getNode(i)->getName();
27 if (leftRNS->getNode(i)->isLimitless())
29 leftNullSpaceCoefs(i) = 1;
32 leftJointNames.push_back(jointName);
35 leftTargets.push_back(ct->
asA<ControlTarget1DoFActuatorVelocity>());
36 const SensorValue1DoFActuatorVelocity* velocitySensor = sv->
asA<SensorValue1DoFActuatorVelocity>();
37 const SensorValue1DoFActuatorPosition* positionSensor = sv->
asA<SensorValue1DoFActuatorPosition>();
38 const SensorValue1DoFActuatorAcceleration* accelerationSensor = sv->
asA<SensorValue1DoFActuatorAcceleration>();
49 if (!accelerationSensor)
51 ARMARX_WARNING <<
"No accelerationSensor available for " << jointName;
55 leftVelocitySensors.push_back(velocitySensor);
56 leftPositionSensors.push_back(positionSensor);
57 leftAccelerationSensors.push_back(accelerationSensor);
60 rightRNS =
rtGetRobot()->getRobotNodeSet(
"RightArm");
62 rightNullSpaceCoefs.resize(rightRNS->getSize());
63 rightNullSpaceCoefs.setOnes();
64 for (
size_t i = 0; i < rightRNS->getSize(); ++i)
66 std::string jointName = rightRNS->getNode(i)->getName();
68 if (rightRNS->getNode(i)->isLimitless())
70 rightNullSpaceCoefs(i) = 1;
73 rightJointNames.push_back(jointName);
76 rightTargets.push_back(ct->
asA<ControlTarget1DoFActuatorVelocity>());
77 const SensorValue1DoFActuatorVelocity* velocitySensor = sv->
asA<SensorValue1DoFActuatorVelocity>();
78 const SensorValue1DoFActuatorPosition* positionSensor = sv->
asA<SensorValue1DoFActuatorPosition>();
79 const SensorValue1DoFActuatorAcceleration* accelerationSensor = sv->
asA<SensorValue1DoFActuatorAcceleration>();
90 if (!accelerationSensor)
92 ARMARX_WARNING <<
"No accelerationSensor available for " << jointName;
95 rightVelocitySensors.push_back(velocitySensor);
96 rightPositionSensors.push_back(positionSensor);
97 rightAccelerationSensors.push_back(accelerationSensor);
107 leftIK.reset(
new VirtualRobot::DifferentialIK(leftRNS,
rtGetRobot()->getRootNode(), VirtualRobot::JacobiProvider::eSVDDamped));
108 rightIK.reset(
new VirtualRobot::DifferentialIK(rightRNS,
rtGetRobot()->getRootNode(), VirtualRobot::JacobiProvider::eSVDDamped));
117 taskSpaceDMPConfig.
DMPMode = cfg->dmpMode;
118 taskSpaceDMPConfig.
DMPStyle = cfg->dmpType;
126 leftJointDMP.reset(
new DMP::UMIDMP(10));
127 rightJointDMP.reset(
new DMP::UMIDMP(10));
128 isLeftJointLearned =
false;
129 isRightJointLearned =
false;
134 leftGroup.push_back(leftLeader);
135 leftGroup.push_back(rightFollower);
137 rightGroup.push_back(rightLeader);
138 rightGroup.push_back(leftFollower);
140 bothLeaderGroup.push_back(leftLeader);
141 bothLeaderGroup.push_back(rightLeader);
144 tcpLeft = leftRNS->getTCP();
145 tcpRight = rightRNS->getTCP();
148 leaderName = cfg->defautLeader;
151 leftDesiredJointValues.resize(leftTargets.size());
154 for (
size_t i = 0; i < leftTargets.size(); ++i)
156 leftDesiredJointValues(i) = cfg->leftDesiredJointValues.at(i);
159 rightDesiredJointValues.resize(rightTargets.size());
162 for (
size_t i = 0; i < rightTargets.size(); ++i)
164 rightDesiredJointValues(i) = cfg->rightDesiredJointValues.at(i);
168 leftKpos << cfg->leftKpos[0], cfg->leftKpos[1], cfg->leftKpos[2];
169 leftDpos << cfg->leftDpos[0], cfg->leftDpos[1], cfg->leftDpos[2];
170 leftKori << cfg->leftKori[0], cfg->leftKori[1], cfg->leftKori[2];
171 leftDori << cfg->leftDori[0], cfg->leftDori[1], cfg->leftDori[2];
173 rightKpos << cfg->rightKpos[0], cfg->rightKpos[1], cfg->rightKpos[2];
174 rightDpos << cfg->rightDpos[0], cfg->rightDpos[1], cfg->rightDpos[2];
175 rightKori << cfg->rightKori[0], cfg->rightKori[1], cfg->rightKori[2];
176 rightDori << cfg->rightDori[0], cfg->rightDori[1], cfg->rightDori[2];
182 timeDuration = cfg->timeDuration;
184 maxLinearVel = cfg->maxLinearVel;
185 maxAngularVel = cfg->maxAngularVel;
187 NJointBimanualCCDMPVelocityControllerInterfaceData initInterfaceData;
190 initInterfaceData.currentLeftJointVals.setZero(leftTargets.size());
191 initInterfaceData.currentRightJointVals.setZero(rightTargets.size());
194 NJointBimanualCCDMPVelocityControllerSensorData initSensorData;
195 initSensorData.deltaT = 0;
196 initSensorData.currentTime = 0;
204 return "NJointBimanualCCDMPVelocityController";
235 Eigen::VectorXf leftTargetVel;
236 leftTargetVel.resize(6);
237 leftTargetVel.setZero();
238 Eigen::VectorXf rightTargetVel;
239 rightTargetVel.resize(6);
240 rightTargetVel.setZero();
244 std::vector<tsvmp::TaskSpaceDMPControllerPtr > currentControlGroup;
247 Eigen::VectorXf currentLeaderTwist;
248 Eigen::VectorXf currentFollowerTwist;
253 if (leaderName ==
"Both")
255 currentControlGroup = bothLeaderGroup;
259 leaderDMPleft->flow(deltaT, controllerSensorData.
getReadBuffer().currentLeftPose, controllerSensorData.
getReadBuffer().currentLeftTwist);
260 leaderDMPright->flow(deltaT, controllerSensorData.
getReadBuffer().currentRightPose, controllerSensorData.
getReadBuffer().currentRightTwist);
262 leftTargetVel = leaderDMPleft->getTargetVelocity();
263 leftTargetPose = leaderDMPleft->getTargetPoseMat();
264 rightTargetVel = leaderDMPright->getTargetVelocity();
265 rightTargetPose = leaderDMPright->getTargetPoseMat();
267 virtualtimer = leaderDMPleft->canVal;
271 if (leaderName ==
"Left")
273 currentControlGroup = leftGroup;
274 currentLeaderPose = controllerSensorData.
getReadBuffer().currentLeftPose;
275 currentFollowerPose = controllerSensorData.
getReadBuffer().currentRightPose;
276 currentLeaderTwist = controllerSensorData.
getReadBuffer().currentLeftTwist;
277 currentFollowerTwist = controllerSensorData.
getReadBuffer().currentRightTwist;
279 else if (leaderName ==
"Right")
281 currentControlGroup = rightGroup;
282 currentLeaderPose = controllerSensorData.
getReadBuffer().currentRightPose;
283 currentFollowerPose = controllerSensorData.
getReadBuffer().currentLeftPose;
284 currentLeaderTwist = controllerSensorData.
getReadBuffer().currentRightTwist;
285 currentFollowerTwist = controllerSensorData.
getReadBuffer().currentLeftTwist;
290 virtualtimer = leaderDMP->canVal;
292 if (virtualtimer < 1e-8)
300 leaderDMP->flow(deltaT, currentLeaderPose, currentLeaderTwist);
303 currentFollowerLocalPose.block<3, 3>(0, 0) = currentLeaderPose.block<3, 3>(0, 0).inverse() * currentFollowerPose.block<3, 3>(0, 0);
304 currentFollowerLocalPose.block<3, 1>(0, 3) = currentLeaderPose.block<3, 3>(0, 0).inverse() * (currentFollowerPose.block<3, 1>(0, 3) - currentLeaderPose.block<3, 1>(0, 3));
305 followerDMP->flow(deltaT, currentFollowerLocalPose, currentFollowerTwist);
307 Eigen::VectorXf leaderTargetVel = leaderDMP->getTargetVelocity();
309 Eigen::Matrix4f followerLocalTargetPose = followerDMP->getTargetPoseMat();
310 std::vector<double> followerLocalTargetPoseVec = followerDMP->getTargetPose();
313 followerTargetPose.block<3, 3>(0, 0) = currentLeaderPose.block<3, 3>(0, 0) * followerLocalTargetPose.block<3, 3>(0, 0);
314 followerTargetPose.block<3, 1>(0, 3) = currentLeaderPose.block<3, 3>(0, 0) * followerLocalTargetPose.block<3, 1>(0, 3) + currentLeaderPose.block<3, 1>(0, 3);
317 Eigen::VectorXf followerLocalTargetVel = followerDMP->getTargetVelocity();
318 Eigen::VectorXf followerTargetVel = followerLocalTargetVel;
319 followerTargetVel.setZero();
321 std::vector<double> leftDMPTarget;
322 std::vector<double> rightDMPTarget;
324 if (leaderName ==
"Left")
326 leftTargetVel = leaderTargetVel;
327 rightTargetVel = followerTargetVel;
328 leftDMPTarget = leaderDMP->getTargetPose();
329 rightDMPTarget = followerLocalTargetPoseVec;
330 leftTargetPose = leaderTargetPose;
331 rightTargetPose = followerTargetPose;
333 else if (leaderName ==
"Right")
335 rightTargetVel = leaderTargetVel;
336 leftTargetVel = followerTargetVel;
337 rightDMPTarget = leaderDMP->getTargetPose();
338 leftDMPTarget = followerLocalTargetPoseVec;
339 rightTargetPose = leaderTargetPose;
340 leftTargetPose = followerTargetPose;
345 Eigen::VectorXf leftDesiredJoint = leftDesiredJointValues;
346 Eigen::VectorXf rightDesiredJoint = rightDesiredJointValues;
347 if (isLeftJointLearned)
350 currentLeftJointState = leftJointDMP->calculateDirectlyVelocity(currentLeftJointState, virtualtimer / timeDuration, deltaT / timeDuration, targetJointState);
351 for (
size_t i = 0; i < targetJointState.size(); ++i)
353 leftDesiredJoint(i) = targetJointState[i];
357 if (isRightJointLearned)
360 currentRightJointState = rightJointDMP->calculateDirectlyVelocity(currentRightJointState, virtualtimer / timeDuration, deltaT / timeDuration, targetJointState);
361 for (
size_t i = 0; i < targetJointState.size(); ++i)
363 rightDesiredJoint(i) = targetJointState[i];
379 Eigen::VectorXf NJointBimanualCCDMPVelocityController::getControlWrench(
const Eigen::VectorXf& tcptwist,
const Eigen::Matrix4f& currentPose,
const Eigen::Matrix4f& targetPose)
381 return Eigen::Vector6f::Zero();
388 double deltaT = timeSinceLastIteration.toSecondsDouble();
390 controllerSensorData.
getWriteBuffer().currentLeftPose = tcpLeft->getPoseInRootFrame();
391 controllerSensorData.
getWriteBuffer().currentRightPose = tcpRight->getPoseInRootFrame();
398 Eigen::MatrixXf jacobiL = leftIK->getJacobianMatrix(tcpLeft, VirtualRobot::IKSolver::CartesianSelection::All);
400 Eigen::VectorXf leftqpos;
401 Eigen::VectorXf leftqvel;
402 leftqpos.resize(leftPositionSensors.size());
403 leftqvel.resize(leftVelocitySensors.size());
404 for (
size_t i = 0; i < leftVelocitySensors.size(); ++i)
406 leftqpos(i) = leftPositionSensors[i]->position;
407 leftqvel(i) = leftVelocitySensors[i]->velocity;
410 Eigen::MatrixXf jacobiR = rightIK->getJacobianMatrix(tcpRight, VirtualRobot::IKSolver::CartesianSelection::All);
411 Eigen::VectorXf rightqpos;
412 Eigen::VectorXf rightqvel;
413 rightqpos.resize(rightPositionSensors.size());
414 rightqvel.resize(rightVelocitySensors.size());
416 for (
size_t i = 0; i < rightVelocitySensors.size(); ++i)
418 rightqpos(i) = rightPositionSensors[i]->position;
419 rightqvel(i) = rightVelocitySensors[i]->velocity;
422 Eigen::VectorXf currentLeftTwist = jacobiL * leftqvel;
423 Eigen::VectorXf currentRightTwist = jacobiR * rightqvel;
425 controllerSensorData.
getWriteBuffer().currentLeftTwist = currentLeftTwist;
426 controllerSensorData.
getWriteBuffer().currentRightTwist = currentRightTwist;
430 interfaceData.
getWriteBuffer().currentLeftPose = tcpLeft->getPoseInRootFrame();
431 interfaceData.
getWriteBuffer().currentRightPose = tcpRight->getPoseInRootFrame();
438 for (
size_t i = 0; i < leftTargets.size(); ++i)
440 leftTargets.at(i)->velocity = 0;
442 for (
size_t i = 0; i < rightTargets.size(); ++i)
444 rightTargets.at(i)->velocity = 0;
460 Eigen::VectorXf leftCartesianTarget(6);
462 Eigen::Vector3f targetTCPLinearVelocity;
463 targetTCPLinearVelocity << leftTargetVel(0), leftTargetVel(1), leftTargetVel(2);
464 Eigen::Vector3f currentTCPLinearVelocity;
465 currentTCPLinearVelocity << currentLeftTwist(0), currentLeftTwist(1), currentLeftTwist(2);
466 Eigen::Vector3f currentTCPPosition = leftCurrentPose.block<3, 1>(0, 3);
467 Eigen::Vector3f desiredPosition = leftTargetPose.block<3, 1>(0, 3);
468 Eigen::Vector3f posVel = leftKpos.cwiseProduct(desiredPosition - currentTCPPosition) + leftDpos.cwiseProduct(targetTCPLinearVelocity - currentTCPLinearVelocity);
471 Eigen::Vector3f currentTCPAngularVelocity;
472 currentTCPAngularVelocity << currentLeftTwist(3), currentLeftTwist(4), currentLeftTwist(5);
474 Eigen::Matrix3f diffMat = leftTargetPose.block<3, 3>(0, 0) * currentRotMat.inverse();
475 Eigen::Vector3f rpy = VirtualRobot::MathTools::eigen3f2rpy(diffMat);
476 Eigen::Vector3f oriVel = leftKori.cwiseProduct(rpy) - leftDori.cwiseProduct(currentTCPAngularVelocity);
478 float normLinearVelocity = posVel.norm();
479 if (normLinearVelocity > maxLinearVel)
481 posVel = maxLinearVel * posVel / normLinearVelocity;
483 float normAngularVelocity = oriVel.norm();
484 if (normAngularVelocity > maxAngularVel)
486 oriVel = maxAngularVel * oriVel / normAngularVelocity;
489 leftCartesianTarget << posVel, oriVel;
492 Eigen::VectorXf rightCartesianTarget(6);
494 Eigen::Vector3f targetTCPLinearVelocity;
495 targetTCPLinearVelocity << rightTargetVel(0), rightTargetVel(1), rightTargetVel(2);
496 Eigen::Vector3f currentTCPLinearVelocity;
497 currentTCPLinearVelocity << currentRightTwist(0), currentRightTwist(1), currentRightTwist(2);
498 Eigen::Vector3f currentTCPPosition = rightCurrentPose.block<3, 1>(0, 3);
499 Eigen::Vector3f desiredPosition = rightTargetPose.block<3, 1>(0, 3);
500 Eigen::Vector3f posVel = rightKpos.cwiseProduct(desiredPosition - currentTCPPosition) + rightDpos.cwiseProduct(targetTCPLinearVelocity - currentTCPLinearVelocity);
503 Eigen::Vector3f currentTCPAngularVelocity;
504 currentTCPAngularVelocity << currentRightTwist(3), currentRightTwist(4), currentRightTwist(5);
506 Eigen::Matrix3f diffMat = rightTargetPose.block<3, 3>(0, 0) * currentRotMat.inverse();
507 Eigen::Vector3f rpy = VirtualRobot::MathTools::eigen3f2rpy(diffMat);
508 Eigen::Vector3f oriVel = rightKori.cwiseProduct(rpy) - rightDori.cwiseProduct(currentTCPAngularVelocity);
510 float normLinearVelocity = posVel.norm();
511 if (normLinearVelocity > maxLinearVel)
513 posVel = maxLinearVel * posVel / normLinearVelocity;
515 float normAngularVelocity = oriVel.norm();
516 if (normAngularVelocity > maxAngularVel)
518 oriVel = maxAngularVel * oriVel / normAngularVelocity;
521 rightCartesianTarget << posVel, oriVel;
525 Eigen::VectorXf leftNullspaceVel = knull * (leftDesiredJoint - leftqpos) - dnull * leftqvel;
526 Eigen::VectorXf rightNullspaceVel = knull * (rightDesiredJoint - rightqpos) - dnull * rightqvel;
527 Eigen::VectorXf desiredLeftVels = leftCtrl->calculate(leftCartesianTarget, leftNullspaceVel, VirtualRobot::IKSolver::CartesianSelection::All);
528 Eigen::VectorXf desiredRightVels = rightCtrl->calculate(rightCartesianTarget, rightNullspaceVel, VirtualRobot::IKSolver::CartesianSelection::All);
531 for (
size_t i = 0; i < leftTargets.size(); ++i)
534 float desiredVel = desiredLeftVels[i];
536 if (fabs(desiredVel) > cfg->maxJointVel)
538 desiredVel = cfg->maxJointVel * desiredVel / fabs(desiredVel);
541 leftTargets.at(i)->velocity = desiredVel;
542 debugDataInfo.
getWriteBuffer().desired_velocities[leftJointNames[i]] = desiredVel;
546 for (
size_t i = 0; i < rightTargets.size(); ++i)
548 float desiredVel = desiredRightVels[i];
550 if (fabs(desiredVel) > cfg->maxJointVel)
552 desiredVel = cfg->maxJointVel * desiredVel / fabs(desiredVel);
555 rightTargets.at(i)->velocity = desiredVel;
556 debugDataInfo.
getWriteBuffer().desired_velocities[rightJointNames[i]] = desiredVel;
560 debugDataInfo.
getWriteBuffer().leftControlSignal_x = leftCartesianTarget(0);
561 debugDataInfo.
getWriteBuffer().leftControlSignal_y = leftCartesianTarget(1);
562 debugDataInfo.
getWriteBuffer().leftControlSignal_z = leftCartesianTarget(2);
563 debugDataInfo.
getWriteBuffer().leftControlSignal_ro = leftCartesianTarget(3);
564 debugDataInfo.
getWriteBuffer().leftControlSignal_pi = leftCartesianTarget(4);
565 debugDataInfo.
getWriteBuffer().leftControlSignal_ya = leftCartesianTarget(5);
567 debugDataInfo.
getWriteBuffer().rightControlSignal_x = rightCartesianTarget(0);
568 debugDataInfo.
getWriteBuffer().rightControlSignal_y = rightCartesianTarget(1);
569 debugDataInfo.
getWriteBuffer().rightControlSignal_z = rightCartesianTarget(2);
570 debugDataInfo.
getWriteBuffer().rightControlSignal_ro = rightCartesianTarget(3);
571 debugDataInfo.
getWriteBuffer().rightControlSignal_pi = rightCartesianTarget(4);
572 debugDataInfo.
getWriteBuffer().rightControlSignal_ya = rightCartesianTarget(5);
574 debugDataInfo.
getWriteBuffer().leftTargetPose_x = leftTargetPose(0, 3);
575 debugDataInfo.
getWriteBuffer().leftTargetPose_y = leftTargetPose(1, 3);
576 debugDataInfo.
getWriteBuffer().leftTargetPose_z = leftTargetPose(2, 3);
577 debugDataInfo.
getWriteBuffer().leftCurrentPose_x = leftCurrentPose(0, 3);
578 debugDataInfo.
getWriteBuffer().leftCurrentPose_y = leftCurrentPose(1, 3);
579 debugDataInfo.
getWriteBuffer().leftCurrentPose_z = leftCurrentPose(2, 3);
582 debugDataInfo.
getWriteBuffer().rightTargetPose_x = rightTargetPose(0, 3);
583 debugDataInfo.
getWriteBuffer().rightTargetPose_y = rightTargetPose(1, 3);
584 debugDataInfo.
getWriteBuffer().rightTargetPose_z = rightTargetPose(2, 3);
586 debugDataInfo.
getWriteBuffer().rightCurrentPose_x = rightCurrentPose(0, 3);
587 debugDataInfo.
getWriteBuffer().rightCurrentPose_y = rightCurrentPose(1, 3);
588 debugDataInfo.
getWriteBuffer().rightCurrentPose_z = rightCurrentPose(2, 3);
598 if (name ==
"LeftLeader")
600 leftGroup.at(0)->learnDMPFromFiles(fileNames);
602 else if (name ==
"LeftFollower")
604 rightGroup.at(1)->learnDMPFromFiles(fileNames);
606 else if (name ==
"RightLeader")
608 rightGroup.at(0)->learnDMPFromFiles(fileNames);
610 else if (name ==
"RightFollower")
612 leftGroup.at(1)->learnDMPFromFiles(fileNames);
614 else if (name ==
"LeftJoint")
616 DMP::Vec<DMP::SampledTrajectoryV2 > trajs;
617 DMP::SampledTrajectoryV2 traj;
620 traj.readFromCSVFile(absPath);
622 trajs.push_back(traj);
623 leftJointDMP->learnFromTrajectories(trajs);
625 else if (name ==
"RightJoint")
627 DMP::Vec<DMP::SampledTrajectoryV2 > trajs;
628 DMP::SampledTrajectoryV2 traj;
631 traj.readFromCSVFile(absPath);
633 trajs.push_back(traj);
634 rightJointDMP->learnFromTrajectories(trajs);
638 ARMARX_ERROR <<
"The given name is not supported by CCDMP, the supported names contain ";
647 DMP::Vec<DMP::SampledTrajectoryV2 > leftFollowerTrajs;
648 DMP::Vec<DMP::SampledTrajectoryV2 > rightFollowerTrajs;
650 for (
size_t i = 0; i < leftFiles.size(); ++i)
652 DMP::SampledTrajectoryV2 leftFollowerTraj = DMP::RobotHelpers::getRelativeTrajFromFiles(leftFiles[i], rightFiles[i]);
653 leftFollowerTrajs.push_back(leftFollowerTraj);
654 DMP::SampledTrajectoryV2 rightFollowerTraj = DMP::RobotHelpers::getRelativeTrajFromFiles(rightFiles[i], leftFiles[i]);
655 rightFollowerTrajs.push_back(rightFollowerTraj);
658 leftGroup.at(0)->learnDMPFromFiles(leftFiles, cfg->initRatio);
659 leftGroup.at(1)->learnDMPFromSampledTrajectory(leftFollowerTrajs, cfg->initRatio);
660 rightGroup.at(0)->learnDMPFromFiles(rightFiles, cfg->initRatio);
661 rightGroup.at(1)->learnDMPFromSampledTrajectory(rightFollowerTrajs, cfg->initRatio);
666 leftGroup.at(0)->setRatios(ratios);
667 leftGroup.at(1)->setRatios(ratios);
668 rightGroup.at(0)->setRatios(ratios);
669 rightGroup.at(1)->setRatios(ratios);
676 if (leaderName ==
"Left")
678 leftGroup.at(0)->setViaPose(u, viapoint);
682 rightGroup.at(0)->setViaPose(u, viapoint);
689 if (leaderName ==
"Left")
691 leftGroup.at(0)->setGoalPoseVec(goals);
695 rightGroup.at(0)->setGoalPoseVec(goals);
704 if (leaderName ==
"Left")
706 leaderName =
"Right";
707 rightGroup.at(0)->canVal = virtualtimer;
708 rightGroup.at(1)->canVal = virtualtimer;
713 leftGroup.at(0)->canVal = virtualtimer;
714 leftGroup.at(1)->canVal = virtualtimer;
729 Eigen::VectorXf leftJointVals = interfaceData.
getReadBuffer().currentLeftJointVals;
730 Eigen::VectorXf rightJointVals = interfaceData.
getReadBuffer().currentRightJointVals;
732 for (
size_t i = 0; i < leftTargets.size(); ++i)
734 DMP::DMPState jstate;
735 jstate.pos = leftJointVals(i);
737 currentLeftJointState.push_back(jstate);
740 for (
size_t i = 0; i < rightTargets.size(); ++i)
742 DMP::DMPState jstate;
743 jstate.pos = rightJointVals(i);
745 currentRightJointState.push_back(jstate);
748 virtualtimer = cfg->timeDuration;
749 leftGroup.at(0)->prepareExecution(leftGroup.at(0)->eigen4f2vec(leftPose), leftGoals);
750 rightGroup.at(0)->prepareExecution(rightGroup.at(0)->eigen4f2vec(rightPose), rightGoals);
753 ARMARX_INFO <<
"leftgroup goal local pose: " << getLocalPose(leftGoals, rightGoals);
755 leftGroup.at(1)->prepareExecution(getLocalPose(leftPose, rightPose), getLocalPose(leftGoals, rightGoals));
756 rightGroup.at(1)->prepareExecution(getLocalPose(rightPose, leftPose), getLocalPose(rightGoals, leftGoals));
766 localPose.block<3, 3>(0, 0) = newCoordinate.block<3, 3>(0, 0).inverse() * globalTargetPose.block<3, 3>(0, 0);
767 localPose.block<3, 1>(0, 3) = newCoordinate.block<3, 3>(0, 0).inverse() * (globalTargetPose.block<3, 1>(0, 3) - newCoordinate.block<3, 1>(0, 3));
781 datafields[pair.first] =
new Variant(pair.second);
785 for (
auto& pair : constrained_force)
787 datafields[pair.first] =
new Variant(pair.second);
824 debugObs->setDebugChannel(
"CCDMPVelocityController", datafields);
831 runTask(
"NJointBimanualCCDMPVelocityController", [&]
835 while (
getState() == eManagedIceObjectStarted)
841 c.waitForCycleDuration();