12 Feature::Feature(
const std::string& name)
39 : controlFrame(cf), axes(a)
46 u.col(k++) = Vector3d(1., 0., 0.);
48 u.col(k++) = Vector3d(0., 1., 0.);
50 u.col(k++) = Vector3d(0., 0., 1.);
52 error = VectorXd::Zero(dim);
53 errorDot = VectorXd::Zero(dim);
54 effort = VectorXd::Zero(dim);
55 acceleration = VectorXd::Zero(dim);
56 jacobian = MatrixXd::Zero(dim, cf->getJacobian().cols());
62 , pimpl(new
Pimpl(frame, axes))
69 const Eigen::Displacementd::Rotation3D& R = pimpl->controlFrame->getPosition().getRotation();
70 pimpl->spaceTransform = pimpl->u.transpose() * R.adjoint();
71 return pimpl->spaceTransform;
92 pimpl->effort = pimpl->u.transpose() * (pimpl->controlFrame->getWrench().getForce() - sdes.pimpl->controlFrame->getWrench().getForce());
105 pimpl->effort = pimpl->u.transpose() * pimpl->controlFrame->getWrench().getForce();
106 return pimpl->effort;
120 pimpl->acceleration = pimpl->u.transpose() * (pimpl->controlFrame->getAcceleration().getLinearVelocity() - sdes.pimpl->controlFrame->getAcceleration().getLinearVelocity());
121 return pimpl->acceleration;
129 pimpl->acceleration = pimpl->u.transpose() * pimpl->controlFrame->getAcceleration().getLinearVelocity();
130 return pimpl->acceleration;
144 pimpl->error = pimpl->u.transpose() * (pimpl->controlFrame->getPosition().getTranslation() - sdes.pimpl->controlFrame->getPosition().getTranslation());
158 pimpl->error = pimpl->u.transpose() * pimpl->controlFrame->getPosition().getTranslation();
176 pimpl->errorDot = pimpl->u.transpose() * (pimpl->controlFrame->getVelocity().getLinearVelocity()-sdes.pimpl->controlFrame->getVelocity().getLinearVelocity());
179 return pimpl->errorDot;
190 pimpl->errorDot = pimpl->u.transpose() * pimpl->controlFrame->getVelocity().getLinearVelocity();
192 return pimpl->errorDot;
209 pimpl->jacobian = pimpl->u.transpose() * pimpl->controlFrame->getJacobian().bottomRows(3);
211 return pimpl->jacobian;
222 pimpl->jacobian = pimpl->u.transpose() * pimpl->controlFrame->getJacobian().bottomRows(3);
223 return pimpl->jacobian;
228 if(!pimpl->controlFrame->dependsOnModelConfiguration())
229 throw std::runtime_error(
"[PositionFeature::computeProjectedMass] feature does not depend on configuration");
238 if(!pimpl->controlFrame->dependsOnModelConfiguration())
239 throw std::runtime_error(
"[PositionFeature::computeProjectedMass] feature does not depend on configuration");
248 if(!pimpl->controlFrame->dependsOnModelConfiguration())
249 throw std::runtime_error(
"[PositionFeature::computeProjectedMassInverse] feature does not depend on configuration");
252 const MatrixXd& Minv = pimpl->controlFrame->getModel().getInertiaMatrixInverse();
253 pimpl->Minv = J * Minv * J.transpose();
260 if(!pimpl->controlFrame->dependsOnModelConfiguration())
261 throw std::runtime_error(
"[PositionFeature::computeProjectedMassInverse] feature does not depend on configuration");
264 const MatrixXd& Minv = pimpl->controlFrame->getModel().getInertiaMatrixInverse();
265 pimpl->Minv = J * Minv * J.transpose();
273 state.
setPosition(pimpl->controlFrame->getPosition());
274 state.
setVelocity(pimpl->controlFrame->getVelocity());
284 TargetFrame::Ptr targetFrame = std::dynamic_pointer_cast<
TargetFrame>(pimpl->controlFrame);
295 targetFrame->setWrench(newState.
getWrench());
297 }
catch (
int errCode) {
298 std::cout <<
"You cannot set the state of this feature because it is not a desired feature. It must be constructed with a TargetFrame." << errCode << std::endl;
319 , spaceTransform(Matrix3d::Identity())
320 , error(VectorXd::Zero(3))
321 , errorDot(VectorXd::Zero(3))
322 , effort(VectorXd::Zero(3))
323 , acceleration(VectorXd::Zero(3))
324 , jacobian(MatrixXd::Zero(3, cf->getJacobian().cols()))
331 , pimpl(new
Pimpl(frame))
337 return pimpl->spaceTransform;
347 throw std::runtime_error(
"[PointContactFeature::computeEffort(const Feature&)] Desired feature are irrelevant in PointContactFeatures");
352 pimpl->effort = pimpl->controlFrame->getWrench().getForce();
353 return pimpl->effort;
358 throw std::runtime_error(
"[PointContactFeature::computeAcceleration(const Feature&)] Desired feature are irrelevant in PointContactFeatures");
363 pimpl->acceleration = pimpl->controlFrame->getAcceleration().getLinearVelocity();
364 return pimpl->acceleration;
369 throw std::runtime_error(
"[PointContactFeature::computeError(const Feature&)] Desired feature are irrelevant in PointContactFeatures");
377 pimpl->error = pimpl->controlFrame->getPosition().getTranslation();
383 throw std::runtime_error(
"[PointContactFeature::computeErrorDot(const Feature&)] Desired feature are irrelevant in PointContactFeatures");
388 pimpl->errorDot = pimpl->controlFrame->getVelocity().getLinearVelocity();
389 return pimpl->errorDot;
394 throw std::runtime_error(
"[PointContactFeature::computeJacobian(const Feature&)] Desired feature are irrelevant in PointContactFeatures");
399 pimpl->jacobian = pimpl->controlFrame->getJacobian().bottomRows(3);
400 return pimpl->jacobian;
405 throw std::runtime_error(
"[PointContactFeature::computeProjectedMass(const Feature&)] Desired feature are irrelevant in PointContactFeatures");
410 if(!pimpl->controlFrame->dependsOnModelConfiguration())
411 throw std::runtime_error(
"[PositionFeature::computeProjectedMass] Feature must depend on configuration!");
420 throw std::runtime_error(
"[PointContactFeature::computeProjectedMassInverse(const Feature&)] Desired feature are irrelevant in PointContactFeatures");
425 if(!pimpl->controlFrame->dependsOnModelConfiguration())
426 throw std::runtime_error(
"[PositionFeature::computeProjectedMassInverse] feature does not depend on configuration");
429 const MatrixXd& Minv = pimpl->controlFrame->getModel().getInertiaMatrixInverse();
430 pimpl->Minv = J * Minv * J.transpose();
437 state.
setPosition(pimpl->controlFrame->getPosition());
438 state.
setVelocity(pimpl->controlFrame->getVelocity());
440 state.
setWrench(pimpl->controlFrame->getWrench());
448 TargetFrame::Ptr targetFrame = std::dynamic_pointer_cast<
TargetFrame>(pimpl->controlFrame);
459 targetFrame->setWrench(newState.
getWrench());
461 }
catch (
int errCode) {
462 std::cout <<
"You cannot set the state of this feature because it is not a desired feature. It must be constructed with a TargetFrame." << errCode << std::endl;
483 spaceTransform = MatrixXd::Identity(3, 3);
484 error = VectorXd::Zero(3);
485 errorDot = VectorXd::Zero(3);
486 effort = VectorXd::Zero(3);
487 acceleration = VectorXd::Zero(3);
488 jacobian = MatrixXd::Zero(3, cf->getJacobian().cols());
494 , pimpl(new
Pimpl(frame))
500 return pimpl->spaceTransform;
512 const Eigen::Displacementd::Rotation3D& R = pimpl->controlFrame->getPosition().getRotation();
513 const Eigen::Displacementd::Rotation3D& Rdes = sdes.pimpl->controlFrame->getPosition().getRotation();
514 const Eigen::Displacementd::Rotation3D Rdes_in_r = R.inverse() * Rdes;
516 pimpl->effort = pimpl->controlFrame->getWrench().getTorque() - Rdes_in_r.adjoint() * sdes.pimpl->controlFrame->getWrench().getTorque();
518 return pimpl->effort;
523 pimpl->effort = pimpl->controlFrame->getWrench().getTorque();
524 return pimpl->effort;
531 const Eigen::Displacementd::Rotation3D& R = pimpl->controlFrame->getPosition().getRotation();
537 pimpl->acceleration = pimpl->controlFrame->getAcceleration().getAngularVelocity() - sdes.pimpl->controlFrame->getAcceleration().getAngularVelocity();
538 return pimpl->acceleration;
543 pimpl->acceleration = pimpl->controlFrame->getAcceleration().getAngularVelocity();
544 return pimpl->acceleration;
551 const Eigen::Displacementd::Rotation3D& R = pimpl->controlFrame->getPosition().getRotation();
552 const Eigen::Displacementd::Rotation3D& Rdes = sdes.pimpl->controlFrame->getPosition().getRotation();
555 pimpl->error = Rdes.adjoint()*((Rdes.inverse() * R).log());
562 const Eigen::Displacementd::Rotation3D& R = pimpl->controlFrame->getPosition().getRotation();
563 pimpl->error = R.log();
571 const Eigen::Displacementd::Rotation3D& R = pimpl->controlFrame->getPosition().getRotation();
572 const Eigen::Displacementd::Rotation3D& Rdes = sdes.pimpl->controlFrame->getPosition().getRotation();
573 const Eigen::Displacementd::Rotation3D Rdes_in_r = R.inverse() * Rdes;
576 pimpl->errorDot = pimpl->controlFrame->getVelocity().getAngularVelocity() - sdes.pimpl->controlFrame->getVelocity().getAngularVelocity();
578 return pimpl->errorDot;
583 pimpl->errorDot = pimpl->controlFrame->getVelocity().getAngularVelocity();
584 return pimpl->errorDot;
591 const Eigen::Displacementd::Rotation3D& R = pimpl->controlFrame->getPosition().getRotation();
592 const Eigen::Displacementd::Rotation3D& Rdes = sdes.pimpl->controlFrame->getPosition().getRotation();
593 const Eigen::Displacementd::Rotation3D Rdes_in_r = R.inverse() * Rdes;
597 pimpl->jacobian = pimpl->controlFrame->getJacobian().topRows(3) - sdes.pimpl->controlFrame->getJacobian().topRows(3);
598 return pimpl->jacobian;
603 pimpl->jacobian = pimpl->controlFrame->getJacobian().topRows(3);
604 return pimpl->jacobian;
609 if(!pimpl->controlFrame->dependsOnModelConfiguration())
610 throw std::runtime_error(
"[OrientationFeature::computeProjectedMass] feature does not depend on configuration");
619 if(!pimpl->controlFrame->dependsOnModelConfiguration())
620 throw std::runtime_error(
"[OrientationFeature::computeProjectedMass] feature does not depend on configuration");
629 if(!pimpl->controlFrame->dependsOnModelConfiguration())
630 throw std::runtime_error(
"[OrientationFeature::computeProjectedMassInverse] feature does not depend on configuration");
633 const MatrixXd& Minv = pimpl->controlFrame->getModel().getInertiaMatrixInverse();
634 pimpl->Minv = J * Minv * J.transpose();
641 if(!pimpl->controlFrame->dependsOnModelConfiguration())
642 throw std::runtime_error(
"[OrientationFeature::computeProjectedMassInverse] feature does not depend on configuration");
645 const MatrixXd& Minv = pimpl->controlFrame->getModel().getInertiaMatrixInverse();
646 pimpl->Minv = J * Minv * J.transpose();
653 state.
setPosition(pimpl->controlFrame->getPosition());
654 state.
setVelocity(pimpl->controlFrame->getVelocity());
656 state.
setWrench(pimpl->controlFrame->getWrench());
664 TargetFrame::Ptr targetFrame = std::dynamic_pointer_cast<
TargetFrame>(pimpl->controlFrame);
675 targetFrame->setWrench(newState.
getWrench());
677 }
catch (
int errCode) {
678 std::cout <<
"You cannot set the state of this feature because it is not a desired feature. It must be constructed with a TargetFrame." << errCode << std::endl;
707 u.col(k++) = Vector3d(1., 0., 0.);
709 u.col(k++) = Vector3d(0., 1., 0.);
711 u.col(k++) = Vector3d(0., 0., 1.);
713 error = VectorXd::Zero(dim);
714 errorDot = VectorXd::Zero(dim);
715 effort = VectorXd::Zero(dim);
716 acceleration = VectorXd::Zero(dim);
717 jacobian = MatrixXd::Zero(dim, cf->getJacobian().cols());
718 spaceTransform = MatrixXd(dim, 6);
724 , pimpl(new
Pimpl(frame, axes))
730 pimpl->spaceTransform.topRows(3).setIdentity();
732 const Eigen::Displacementd::Rotation3D& R = pimpl->controlFrame->getPosition().getRotation();
733 pimpl->spaceTransform.bottomRows(3) = pimpl->u.transpose() * R.adjoint();
735 return pimpl->spaceTransform;
748 const Eigen::Displacementd Herror = sdes.pimpl->controlFrame->getPosition().inverse() * pimpl->controlFrame->getPosition();
749 const Eigen::Wrenchd Werror = pimpl->controlFrame->getWrench() - Herror.adjointTr(sdes.pimpl->controlFrame->getWrench());
752 const Eigen::Displacementd::Rotation3D& R = pimpl->controlFrame->getPosition().getRotation();
753 const MatrixXd u_in_mobileFrame = R.inverse().adjoint() * pimpl->u;
754 pimpl->effort.tail(pimpl->dim - 3) = u_in_mobileFrame.transpose() * Werror.getForce();
756 pimpl->effort.head(3) = Werror.getTorque();
758 return pimpl->effort;
764 const Eigen::Wrenchd Werror = pimpl->controlFrame->getWrench();
767 const Eigen::Displacementd::Rotation3D& R = pimpl->controlFrame->getPosition().getRotation();
768 const MatrixXd u_in_mobileFrame = R.inverse().adjoint() * pimpl->u;
769 pimpl->effort.tail(pimpl->dim - 3) = u_in_mobileFrame.transpose() * Werror.getForce();
770 pimpl->effort.head(3) = Werror.getTorque();
772 return pimpl->effort;
796 pimpl->acceleration = pimpl->controlFrame->getAcceleration() - sdes.pimpl->controlFrame->getAcceleration();
798 return pimpl->acceleration;
811 pimpl->acceleration = pimpl->controlFrame->getAcceleration();
813 return pimpl->acceleration;
824 const Eigen::Displacementd::Rotation3D& R = pimpl->controlFrame->getPosition().getRotation();
828 const Eigen::Displacementd::Rotation3D& Rdes = sdes.pimpl->controlFrame->getPosition().getRotation();
830 pimpl->error.head(3) = Rdes.adjoint()*((Rdes.inverse() * R).log());
832 pimpl->error.tail(pimpl->dim - 3) = pimpl->controlFrame->getPosition().getTranslation() - sdes.pimpl->controlFrame->getPosition().getTranslation();
842 const Eigen::Displacementd::Rotation3D& R = pimpl->controlFrame->getPosition().getRotation();
843 const MatrixXd u_in_mobileFrame = R.inverse().adjoint() * pimpl->u;
845 pimpl->error.tail(pimpl->dim - 3) = pimpl->controlFrame->getPosition().getTranslation();
846 pimpl->error.head(3) = R.log();
863 pimpl->errorDot.tail(pimpl->dim - 3) = pimpl->controlFrame->getVelocity().getLinearVelocity() - sdes.pimpl->controlFrame->getVelocity().getLinearVelocity();
867 pimpl->errorDot.head(3) = pimpl->controlFrame->getVelocity().getAngularVelocity() - sdes.pimpl->controlFrame->getVelocity().getAngularVelocity();
870 return pimpl->errorDot;
882 pimpl->errorDot.tail(pimpl->dim - 3) = pimpl->controlFrame->getVelocity().getLinearVelocity();
885 pimpl->errorDot.head(3) = pimpl->controlFrame->getVelocity().getAngularVelocity();
887 return pimpl->errorDot;
905 const Eigen::Displacementd::Rotation3D& R = pimpl->controlFrame->getPosition().getRotation();
906 const MatrixXd J = pimpl->controlFrame->getJacobian() - sdes.pimpl->controlFrame->getJacobian();
908 return pimpl->jacobian;
914 const Eigen::Displacementd Herror = pimpl->controlFrame->getPosition().inverse();
916 pimpl->jacobian = pimpl->controlFrame->getJacobian();
924 return pimpl->jacobian;
929 if(!pimpl->controlFrame->dependsOnModelConfiguration())
930 throw std::runtime_error(
"[DisplacementFeature::computeProjectedMass] feature does not depend on configuration");
939 if(!pimpl->controlFrame->dependsOnModelConfiguration())
940 throw std::runtime_error(
"[DisplacementFeature::computeProjectedMass] feature does not depend on configuration");
949 if(!pimpl->controlFrame->dependsOnModelConfiguration())
950 throw std::runtime_error(
"[DisplacementFeature::computeProjectedMassInverse] feature does not depend on configuration");
953 const MatrixXd& Minv = pimpl->controlFrame->getModel().getInertiaMatrixInverse();
954 pimpl->Minv = J * Minv * J.transpose();
961 if(!pimpl->controlFrame->dependsOnModelConfiguration())
962 throw std::runtime_error(
"[DisplacementFeature::computeProjectedMassInverse] feature does not depend on configuration");
965 const MatrixXd& Minv = pimpl->controlFrame->getModel().getInertiaMatrix().inverse();
966 pimpl->Minv = J * Minv * J.transpose();
973 state.
setPosition(pimpl->controlFrame->getPosition());
974 state.
setVelocity(pimpl->controlFrame->getVelocity());
976 state.
setWrench(pimpl->controlFrame->getWrench());
984 TargetFrame::Ptr targetFrame = std::dynamic_pointer_cast<
TargetFrame>(pimpl->controlFrame);
995 targetFrame->setWrench(newState.
getWrench());
997 }
catch (
int errCode) {
998 std::cout <<
"You cannot set the state of this feature because it is not a desired feature. It must be constructed with a TargetFrame." << errCode << std::endl;
1018 , spaceTransform(MatrixXd::Identity(6, 6))
1019 , error(VectorXd::Zero(6))
1020 , errorDot(VectorXd::Zero(6))
1021 , effort(VectorXd::Zero(6))
1022 , acceleration(VectorXd::Zero(6))
1023 , jacobian(MatrixXd::Zero(6, cf->getJacobian().cols()))
1030 , pimpl(new
Pimpl(frame))
1036 return pimpl->spaceTransform;
1046 throw std::runtime_error(
"[ContactConstraintFeature::computeEffort(const Feature&)] Desired feature are irrelevant in ContactConstraintFeature");
1051 const Eigen::Wrenchd Werror = pimpl->controlFrame->getWrench();
1052 pimpl->effort.tail(3) = Werror.getForce();
1053 pimpl->effort.head(3) = Werror.getTorque();
1054 return pimpl->effort;
1059 throw std::runtime_error(
"[ContactConstraintFeature::computeAcceleration(const Feature&)] Desired feature are irrelevant in ContactConstraintFeature");
1064 pimpl->acceleration.head(3) = pimpl->controlFrame->getAcceleration().getAngularVelocity();
1065 pimpl->acceleration.tail(3) = pimpl->controlFrame->getAcceleration().getLinearVelocity();
1066 return pimpl->acceleration;
1071 throw std::runtime_error(
"[ContactConstraintFeature::computeError(const Feature&)] Desired feature are irrelevant in ContactConstraintFeature");
1076 const Eigen::Displacementd H = pimpl->controlFrame->getPosition();
1077 const Eigen::Displacementd::Rotation3D& R = H.getRotation();
1079 pimpl->error.tail(3) = H.getTranslation();
1080 pimpl->error.head(3) = R.log();
1081 return pimpl->error;
1086 throw std::runtime_error(
"[ContactConstraintFeature::computeErrorDot(const Feature&)] Desired feature are irrelevant in ContactConstraintFeature");
1091 const Eigen::Twistd Terror = pimpl->controlFrame->getVelocity();
1092 pimpl->errorDot.tail(3) = Terror.getLinearVelocity();
1093 pimpl->errorDot.head(3) = Terror.getAngularVelocity();
1094 return pimpl->errorDot;
1099 throw std::runtime_error(
"[ContactConstraintFeature::computeJacobian(const Feature&)] Desired feature are irrelevant in ContactConstraintFeature");
1104 pimpl->jacobian = pimpl->controlFrame->getJacobian();
1105 return pimpl->jacobian;
1110 throw std::runtime_error(
"[ContactConstraintFeature::computeProjectedMass(const Feature&)] Desired feature are irrelevant in ContactConstraintFeature");
1115 if(!pimpl->controlFrame->dependsOnModelConfiguration())
1116 throw std::runtime_error(
"[DisplacementFeature::computeProjectedMass] feature does not depend on configuration");
1125 throw std::runtime_error(
"[ContactConstraintFeature::computeProjectedMassInverse(const Feature&)] Desired feature are irrelevant in ContactConstraintFeature");
1130 if(!pimpl->controlFrame->dependsOnModelConfiguration())
1131 throw std::runtime_error(
"[DisplacementFeature::computeProjectedMassInverse] feature does not depend on configuration");
1134 const MatrixXd& Minv = pimpl->controlFrame->getModel().getInertiaMatrix().inverse();
1135 pimpl->Minv = J * Minv * J.transpose();
1142 state.
setPosition(pimpl->controlFrame->getPosition());
1143 state.
setVelocity(pimpl->controlFrame->getVelocity());
1145 state.
setWrench(pimpl->controlFrame->getWrench());
1153 TargetFrame::Ptr targetFrame = std::dynamic_pointer_cast<
TargetFrame>(pimpl->controlFrame);
1164 targetFrame->setWrench(newState.
getWrench());
1166 }
catch (
int errCode) {
1167 std::cout <<
"You cannot set the state of this feature because it is not a desired feature. It must be constructed with a TargetFrame." << errCode << std::endl;
1191 spaceTransform = MatrixXd::Identity(state->getSize(), state->getSize());
1197 , pimpl( new
Pimpl(state) )
1203 return pimpl->spaceTransform;
1208 return pimpl->state->getSize();
1214 pimpl->effort = pimpl->state->tau() - sdes.pimpl->state->tau();
1215 return pimpl->effort;
1220 pimpl->effort = pimpl->state->tau();
1221 return pimpl->effort;
1227 pimpl->acceleration = pimpl->state->qddot() - sdes.pimpl->state->qddot();
1228 return pimpl->acceleration;
1233 pimpl->acceleration = pimpl->state->qddot();
1234 return pimpl->acceleration;
1240 pimpl->error = pimpl->state->q() - sdes.pimpl->state->q();
1241 return pimpl->error;
1246 pimpl->error = pimpl->state->q();
1247 return pimpl->error;
1253 pimpl->errorDot = pimpl->state->qdot() - sdes.pimpl->state->qdot();
1254 return pimpl->errorDot;
1259 pimpl->errorDot = pimpl->state->qdot();
1260 return pimpl->errorDot;
1266 pimpl->J = pimpl->state->getJacobian();
1272 pimpl->J = pimpl->state->getJacobian();
1279 pimpl->M = pimpl->state->getInertiaMatrix();
1285 pimpl->M = pimpl->state->getInertiaMatrix();
1292 pimpl->M = pimpl->state->getInertiaMatrixInverse();
1298 pimpl->M = pimpl->state->getInertiaMatrixInverse();
1305 state.
setQ(pimpl->state->q());
1306 state.
setQd(pimpl->state->qdot());
1307 state.
setQdd(pimpl->state->qddot());
1315 FullTargetState::Ptr targetState = std::dynamic_pointer_cast<
FullTargetState>(pimpl->state);
1316 if(newState.
hasQ()) {
1319 if(newState.
hasQd()) {
1320 targetState->set_qdot(newState.
getQd());
1323 targetState->set_qddot(newState.
getQdd());
1325 }
catch (
int errCode) {
1326 std::cout <<
"You cannot set the state of this feature because it is not a desired feature. It must be constructed with a FullTargetState." << errCode << std::endl;
1347 spaceTransform = MatrixXd::Identity(state->getSize(), state->getSize());
1353 , pimpl( new
Pimpl(state) )
1359 return pimpl->spaceTransform;
1364 return pimpl->state->getSize();
1370 pimpl->effort = pimpl->state->tau() - sdes.pimpl->state->tau();
1371 return pimpl->effort;
1376 pimpl->effort = pimpl->state->tau();
1377 return pimpl->effort;
1383 pimpl->acceleration = pimpl->state->qddot() - sdes.pimpl->state->qddot();
1384 return pimpl->acceleration;
1389 pimpl->acceleration = pimpl->state->qddot();
1390 return pimpl->acceleration;
1396 pimpl->error = pimpl->state->q() - sdes.pimpl->state->q();
1397 return pimpl->error;
1402 pimpl->error = pimpl->state->q();
1403 return pimpl->error;
1409 pimpl->errorDot = pimpl->state->qdot() - sdes.pimpl->state->qdot();
1410 return pimpl->errorDot;
1415 pimpl->errorDot = pimpl->state->qdot();
1416 return pimpl->errorDot;
1422 pimpl->J = pimpl->state->getJacobian();
1428 pimpl->J = pimpl->state->getJacobian();
1435 pimpl->M = pimpl->state->getInertiaMatrix();
1441 pimpl->M = pimpl->state->getInertiaMatrix();
1448 pimpl->M = pimpl->state->getInertiaMatrixInverse();
1454 pimpl->M = pimpl->state->getInertiaMatrixInverse();
1460 state.
setQ(pimpl->state->q());
1461 state.
setQd(pimpl->state->qdot());
1462 state.
setQdd(pimpl->state->qddot());
1470 PartialTargetState::Ptr targetState = std::dynamic_pointer_cast<
PartialTargetState>(pimpl->state);
1471 if(newState.
hasQ()) {
1474 if(newState.
hasQd()) {
1475 targetState->set_qdot(newState.
getQd());
1478 targetState->set_qddot(newState.
getQdd());
1480 }
catch (
int errCode) {
1481 std::cout <<
"You cannot set the state of this feature because it is not a desired feature. It must be constructed with a PartialTargetState." << errCode << std::endl;
const Eigen::VectorXd & computeError() const
Used to build tasks in a partial configuration space.
PartialStateFeature(const std::string &name, PartialState::Ptr state)
const Eigen::MatrixXd & getSpaceTransform() const
void setPosition(const Eigen::Displacementd &newPosition)
const Eigen::MatrixXd & computeProjectedMassInverse() const
void setState(const TaskState &newState)
TaskState getState() const
void setAcceleration(const Eigen::Twistd &newAcceleration)
const Eigen::VectorXd & computeAcceleration() const
void setState(const TaskState &newState)
const Eigen::MatrixXd & computeJacobian() const
const Eigen::MatrixXd & computeProjectedMass() const
Used to build orientation tasks.
const Eigen::VectorXd & computeError() const
const Eigen::VectorXd & computeEffort() const
const Eigen::VectorXd & computeErrorDot() const
const Eigen::MatrixXd & computeProjectedMass() const
void setState(const TaskState &newState)
const Eigen::MatrixXd & computeJacobian() const
Eigen::VectorXd getQdd() const
void set_q(const Eigen::VectorXd &q)
const Eigen::VectorXd & computeAcceleration() const
DisplacementFeature(const std::string &name, ControlFrame::Ptr frame, ECartesianDof axes)
void setVelocity(const Eigen::Twistd &newVelocity)
Pimpl(ControlFrame::Ptr cf)
const Eigen::VectorXd & computeEffort() const
A class hierarchy to compute task errors based on control frames.
const Eigen::MatrixXd & computeJacobian() const
void setState(const TaskState &newState)
Feature interface, used by tasks to compute errors and jacobians.
Eigen::VectorXd getQd() const
const Eigen::VectorXd & computeAcceleration() const
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
const Eigen::VectorXd & computeErrorDot() const
const Eigen::MatrixXd & getSpaceTransform() const
FullStateFeature(const std::string &name, FullState::Ptr state)
const Eigen::VectorXd & computeErrorDot() const
const Eigen::VectorXd & computeEffort() const
const Eigen::VectorXd & computeError() const
const Eigen::MatrixXd & computeProjectedMass() const
TaskState getState() const
const Eigen::VectorXd & computeErrorDot() const
ControlFrame::Ptr controlFrame
Used to build positioning tasks.
const Eigen::MatrixXd & getSpaceTransform() const
bool hasAcceleration() const
const Eigen::MatrixXd & computeProjectedMass() const
const Eigen::MatrixXd & computeProjectedMassInverse() const
Eigen::VectorXd getQ() const
void setPosition(const Eigen::Displacementd &H)
Used to build tasks in the manikin configuration space.
const Eigen::MatrixXd & computeProjectedMass() const
TaskState getState() const
const Eigen::VectorXd & computeError() const
ControlFrame::Ptr controlFrame
const Eigen::MatrixXd & computeProjectedMassInverse() const
const Eigen::MatrixXd & computeJacobian() const
void set_q(const Eigen::VectorXd &q)
void setQd(const Eigen::VectorXd &newQd)
const Eigen::MatrixXd & getSpaceTransform() const
ControlFrame::Ptr controlFrame
PositionFeature(const std::string &name, ControlFrame::Ptr frame, ECartesianDof axes)
TaskState getState() const
Used to build position/orientation tasks.
const Eigen::MatrixXd & computeProjectedMassInverse() const
OrientationFeature(const std::string &name, ControlFrame::Ptr frame)
TaskState getState() const
void setQdd(const Eigen::VectorXd &newQdd)
Eigen::Wrenchd getWrench() const
Pimpl(ControlFrame::Ptr cf, ECartesianDof a)
Pimpl(ControlFrame::Ptr cf, ECartesianDof a)
const Eigen::MatrixXd & getSpaceTransform() const
void setWrench(const Eigen::Wrenchd &newWrench)
Eigen::Twistd getAcceleration() const
const Eigen::VectorXd & computeError() const
void setQ(const Eigen::VectorXd &newQ)
Eigen::Displacementd getPosition() const
Eigen::Twistd getVelocity() const
const Eigen::MatrixXd & computeJacobian() const
const Eigen::VectorXd & computeEffort() const
const Eigen::MatrixXd & computeProjectedMassInverse() const
const Eigen::VectorXd & computeErrorDot() const
int computeDimensionFor(ECartesianDof fixedPosition, ECartesianDof fixedOrientation)
Computes the number of directions specified by two ECartesianDof enums.
void setState(const TaskState &newState)
const Eigen::VectorXd & computeAcceleration() const
A target for a model partial state.
Represents a 'target', i.e. something that does not depend on a model but must match with another fra...
const Eigen::VectorXd & computeEffort() const
Pimpl(PartialState::Ptr ps)
const Eigen::VectorXd & computeAcceleration() const