33 #ifndef DART_DYNAMICS_DETAIL_GenericJoint_HPP_
34 #define DART_DYNAMICS_DETAIL_GenericJoint_HPP_
38 #include "dart/config.hpp"
44 #define GenericJoint_REPORT_DIM_MISMATCH( func, arg )\
46 dterr << "[GenericJoint::" #func "] Mismatch beteween size of "\
47 << #arg " [" << arg .size() << "] and the number of "\
48 << "DOFs [" << getNumDofs() << "] for Joint named ["\
49 << this->getName() << "].\n";\
53 #define GenericJoint_REPORT_OUT_OF_RANGE( func, index )\
55 dterr << "[GenericJoint::" << #func << "] The index [" << index\
56 << "] is out of range for Joint named [" << this->getName()\
57 << "] which has " << this->getNumDofs() << " DOFs.\n";\
61 #define GenericJoint_REPORT_UNSUPPORTED_ACTUATOR( func )\
63 dterr << "[GenericJoint::" # func "] Unsupported actuator type ("\
64 << Joint::mAspectProperties.mActuatorType << ") for Joint ["\
65 << this->getName() << "].\n";\
69 #define GenericJoint_SET_IF_DIFFERENT( mField, value )\
70 if( value == Base::mAspectProperties. mField )\
72 Base::mAspectProperties. mField = value;\
73 Joint::incrementVersion();
85 template <
class ConfigSpaceT>
89 template <
class ConfigSpaceT>
92 for (
auto i = 0u; i < NumDofs; ++i)
97 template <
class ConfigSpaceT>
105 template <
class ConfigSpaceT>
113 template <
class ConfigSpaceT>
116 setCommands(state.mCommands);
117 setPositionsStatic(state.mPositions);
118 setVelocitiesStatic(state.mVelocities);
119 setAccelerationsStatic(state.mAccelerations);
120 setForces(state.mForces);
124 template <
class ConfigSpaceT>
128 for (
auto i = 0u; i < NumDofs; ++i)
131 setPositionLowerLimit (i,
properties.mPositionLowerLimits[i] );
132 setPositionUpperLimit (i,
properties.mPositionUpperLimits[i] );
133 setInitialPosition (i,
properties.mInitialPositions[i] );
134 setVelocityLowerLimit (i,
properties.mVelocityLowerLimits[i] );
135 setVelocityUpperLimit (i,
properties.mVelocityUpperLimits[i] );
136 setInitialVelocity (i,
properties.mInitialVelocities[i] );
137 setAccelerationLowerLimit(i,
properties.mAccelerationLowerLimits[i]);
138 setAccelerationUpperLimit(i,
properties.mAccelerationUpperLimits[i]);
139 setForceLowerLimit (i,
properties.mForceLowerLimits[i] );
141 setSpringStiffness (i,
properties.mSpringStiffnesses[i] );
142 setRestPosition (i,
properties.mRestPositions[i] );
143 setDampingCoefficient (i,
properties.mDampingCoefficients[i] );
144 setCoulombFriction (i,
properties.mFrictions[i] );
149 template <
class ConfigSpaceT>
158 template <
class ConfigSpaceT>
169 template <
class ConfigSpaceT>
173 if (
nullptr == other)
180 template <
class ConfigSpaceT>
190 template <
class ConfigSpaceT>
202 template <
class ConfigSpaceT>
214 template <
class ConfigSpaceT>
221 template <
class ConfigSpaceT>
224 const std::string&
name,
227 if (NumDofs <=
index)
229 dterr <<
"[GenericJoint::setDofName] Attempting to set the name of DOF "
230 <<
"index " <<
index <<
", which is out of bounds for the Joint ["
232 <<
"]. We will set the name of DOF index 0 instead.\n";
239 std::string& dofName = Base::mAspectProperties.mDofNames[
index];
245 = this->mChildBodyNode ? this->mChildBodyNode->getSkeleton() :
nullptr;
247 dofName = skel->mNameMgrForDofs.changeObjectName(mDofs[
index],
name);
255 template <
class ConfigSpaceT>
258 if (NumDofs <=
index)
268 template <
class ConfigSpaceT>
277 return Base::mAspectProperties.mPreserveDofNames[
index];
281 template <
class ConfigSpaceT>
286 dterr <<
"[GenericJoint::getDofName] Requested name of DOF index ["
287 <<
index <<
"] in Joint [" << this->getName() <<
"], but that is "
288 <<
"out of bounds (max " << NumDofs - 1
289 <<
"). Returning name of DOF 0.\n";
291 return Base::mAspectProperties.mDofNames[0];
294 return Base::mAspectProperties.mDofNames[
index];
298 template <
class ConfigSpaceT>
308 return mDofs[
index]->mIndexInSkeleton;
312 template <
class ConfigSpaceT>
315 if (
index >= getNumDofs())
321 return mDofs[
index]->mIndexInTree;
325 template <
class ConfigSpaceT>
328 if (
index >= getNumDofs())
335 Base::mAspectProperties.mForceLowerLimits[
index],
336 Base::mAspectProperties.mForceUpperLimits[
index]);
341 dtwarn <<
"[GenericJoint::setCommand] Attempting to set a non-zero ("
342 << command <<
") command for a PASSIVE joint ["
343 << this->getName() <<
"].\n";
345 this->mAspectState.mCommands[
index] = command;
349 Base::mAspectProperties.mVelocityLowerLimits[
index],
350 Base::mAspectProperties.mVelocityUpperLimits[
index]);
355 dtwarn <<
"[GenericJoint::setCommand] Attempting to set a non-zero ("
356 << command <<
") command for a MIMIC joint ["
357 << this->getName() <<
"].\n";
360 Base::mAspectProperties.mVelocityLowerLimits[
index],
361 Base::mAspectProperties.mVelocityUpperLimits[
index]);
365 Base::mAspectProperties.mAccelerationLowerLimits[
index],
366 Base::mAspectProperties.mAccelerationUpperLimits[
index]);
370 Base::mAspectProperties.mVelocityLowerLimits[
index],
371 Base::mAspectProperties.mVelocityUpperLimits[
index]);
377 dtwarn <<
"[GenericJoint::setCommand] Attempting to set a non-zero ("
378 << command <<
") command for a LOCKED joint [" << this->getName()
381 this->mAspectState.mCommands[
index] = command;
390 template <
class ConfigSpaceT>
393 if (
index >= getNumDofs())
399 return this->mAspectState.mCommands[
index];
403 template <
class ConfigSpaceT>
405 const Eigen::VectorXd& commands)
407 if (
static_cast<size_t>(commands.size()) != getNumDofs())
416 this->mAspectState.mCommands =
math::clip(commands,
417 Base::mAspectProperties.mForceLowerLimits,
418 Base::mAspectProperties.mForceUpperLimits);
421 if(Vector::Zero() != commands)
423 dtwarn <<
"[GenericJoint::setCommands] Attempting to set a non-zero ("
424 << commands.transpose() <<
") command for a PASSIVE joint ["
425 << this->getName() <<
"].\n";
427 this->mAspectState.mCommands = commands;
430 this->mAspectState.mCommands =
math::clip(commands,
431 Base::mAspectProperties.mVelocityLowerLimits,
432 Base::mAspectProperties.mVelocityUpperLimits);
435 if(Vector::Zero() != commands)
437 dtwarn <<
"[GenericJoint::setCommands] Attempting to set a non-zero ("
438 << commands.transpose() <<
") command for a MIMIC joint ["
439 << this->getName() <<
"].\n";
441 this->mAspectState.mCommands =
math::clip(commands,
442 Base::mAspectProperties.mVelocityLowerLimits,
443 Base::mAspectProperties.mVelocityUpperLimits);
446 this->mAspectState.mCommands =
math::clip(commands,
447 Base::mAspectProperties.mAccelerationLowerLimits,
448 Base::mAspectProperties.mAccelerationUpperLimits);
451 this->mAspectState.mCommands =
math::clip(commands,
452 Base::mAspectProperties.mVelocityLowerLimits,
453 Base::mAspectProperties.mVelocityUpperLimits);
457 if(Vector::Zero() != commands)
459 dtwarn <<
"[GenericJoint::setCommands] Attempting to set a non-zero ("
460 << commands.transpose() <<
") command for a LOCKED joint ["
461 << this->getName() <<
"].\n";
463 this->mAspectState.mCommands = commands;
472 template <
class ConfigSpaceT>
475 return this->mAspectState.mCommands;
479 template <
class ConfigSpaceT>
482 this->mAspectState.mCommands.setZero();
486 template <
class ConfigSpaceT>
503 this->notifyPositionUpdated();
507 template <
class ConfigSpaceT>
510 if (
index >= getNumDofs())
516 return getPositionsStatic()[
index];
520 template <
class ConfigSpaceT>
522 const Eigen::VectorXd& positions)
524 if (
static_cast<size_t>(positions.size()) != getNumDofs())
530 setPositionsStatic(positions);
534 template <
class ConfigSpaceT>
537 return getPositionsStatic();
541 template <
class ConfigSpaceT>
545 if (
index >= getNumDofs())
555 template <
class ConfigSpaceT>
558 if (
index >= getNumDofs())
564 return Base::mAspectProperties.mPositionLowerLimits[
index];
568 template<
class ConfigSpaceT>
570 const Eigen::VectorXd& lowerLimits)
572 if (
static_cast<size_t>(lowerLimits.size()) != getNumDofs())
582 template<
class ConfigSpaceT>
585 return Base::mAspectProperties.mPositionLowerLimits;
589 template <
class ConfigSpaceT>
593 if (
index >= getNumDofs())
603 template <
class ConfigSpaceT>
606 if (
index >= getNumDofs())
612 return Base::mAspectProperties.mPositionUpperLimits[
index];
616 template<
class ConfigSpaceT>
618 const Eigen::VectorXd& upperLimits)
620 if (
static_cast<size_t>(upperLimits.size()) != getNumDofs())
630 template<
class ConfigSpaceT>
633 return Base::mAspectProperties.mPositionUpperLimits;
637 template <
class ConfigSpaceT>
640 if (
index >= getNumDofs())
646 return std::isfinite(Base::mAspectProperties.mPositionUpperLimits[
index])
647 || std::isfinite(Base::mAspectProperties.mPositionLowerLimits[
index]);
651 template <
class ConfigSpaceT>
654 if (
index >= getNumDofs())
660 setPosition(
index, Base::mAspectProperties.mInitialPositions[
index]);
664 template <
class ConfigSpaceT>
667 setPositionsStatic(Base::mAspectProperties.mInitialPositions);
671 template <
class ConfigSpaceT>
673 size_t index,
double initial)
675 if (
index >= getNumDofs())
685 template <
class ConfigSpaceT>
688 if (
index >= getNumDofs())
694 return Base::mAspectProperties.mInitialPositions[
index];
698 template <
class ConfigSpaceT>
700 const Eigen::VectorXd& initial)
702 if (
static_cast<size_t>(initial.size()) != getNumDofs() )
712 template <
class ConfigSpaceT>
715 return Base::mAspectProperties.mInitialPositions;
719 template <
class ConfigSpaceT>
722 if (this->mAspectState.mPositions == positions)
725 this->mAspectState.mPositions = positions;
726 this->notifyPositionUpdated();
730 template <
class ConfigSpaceT>
734 return this->mAspectState.mPositions;
738 template <
class ConfigSpaceT>
742 if (this->mAspectState.mVelocities == velocities)
745 this->mAspectState.mVelocities = velocities;
746 this->notifyVelocityUpdated();
750 template <
class ConfigSpaceT>
754 return this->mAspectState.mVelocities;
758 template <
class ConfigSpaceT>
761 if (this->mAspectState.mAccelerations == accels)
764 this->mAspectState.mAccelerations = accels;
765 this->notifyAccelerationUpdated();
769 template <
class ConfigSpaceT>
773 return this->mAspectState.mAccelerations;
777 template <
class ConfigSpaceT>
780 if (
index >= getNumDofs())
791 this->notifyVelocityUpdated();
794 this->mAspectState.mCommands[
index] = this->getVelocitiesStatic()[
index];
798 template <
class ConfigSpaceT>
801 if (
index >= getNumDofs())
807 return getVelocitiesStatic()[
index];
811 template <
class ConfigSpaceT>
813 const Eigen::VectorXd& velocities)
815 if (
static_cast<size_t>(velocities.size()) != getNumDofs())
821 setVelocitiesStatic(velocities);
824 this->mAspectState.mCommands = this->getVelocitiesStatic();
828 template <
class ConfigSpaceT>
831 return getVelocitiesStatic();
835 template <
class ConfigSpaceT>
839 if (
index >= getNumDofs())
849 template <
class ConfigSpaceT>
852 if (
index >= getNumDofs())
858 return Base::mAspectProperties.mVelocityLowerLimits[
index];
862 template<
class ConfigSpaceT>
864 const Eigen::VectorXd& lowerLimits)
866 if (
static_cast<size_t>(lowerLimits.size()) != getNumDofs())
876 template<
class ConfigSpaceT>
879 return Base::mAspectProperties.mVelocityLowerLimits;
883 template <
class ConfigSpaceT>
887 if (
index >= getNumDofs())
897 template <
class ConfigSpaceT>
901 if (
index >= getNumDofs())
907 return Base::mAspectProperties.mVelocityUpperLimits[
index];
911 template<
class ConfigSpaceT>
913 const Eigen::VectorXd& upperLimits)
915 if (
static_cast<size_t>(upperLimits.size()) != getNumDofs())
925 template<
class ConfigSpaceT>
928 return Base::mAspectProperties.mVelocityUpperLimits;
932 template <
class ConfigSpaceT>
935 if (
index >= getNumDofs())
941 setVelocity(
index, Base::mAspectProperties.mInitialVelocities[
index]);
945 template <
class ConfigSpaceT>
948 setVelocitiesStatic(Base::mAspectProperties.mInitialVelocities);
952 template <
class ConfigSpaceT>
956 if (
index >= getNumDofs())
966 template <
class ConfigSpaceT>
969 if (
index >= getNumDofs())
975 return Base::mAspectProperties.mInitialVelocities[
index];
979 template <
class ConfigSpaceT>
981 const Eigen::VectorXd& initial)
983 if (
static_cast<size_t>(initial.size()) != getNumDofs() )
993 template <
class ConfigSpaceT>
996 return Base::mAspectProperties.mInitialVelocities;
1000 template <
class ConfigSpaceT>
1004 if (
index >= getNumDofs())
1015 this->notifyAccelerationUpdated();
1018 this->mAspectState.mCommands[
index] = this->getAccelerationsStatic()[
index];
1022 template <
class ConfigSpaceT>
1025 if (
index >= getNumDofs())
1031 return getAccelerationsStatic()[
index];
1035 template <
class ConfigSpaceT>
1037 const Eigen::VectorXd& accelerations)
1039 if (
static_cast<size_t>(accelerations.size()) != getNumDofs())
1045 setAccelerationsStatic(accelerations);
1048 this->mAspectState.mCommands = this->getAccelerationsStatic();
1052 template <
class ConfigSpaceT>
1055 return getAccelerationsStatic();
1059 template <
class ConfigSpaceT>
1063 if (
index >= getNumDofs())
1074 template <
class ConfigSpaceT>
1078 if (
index >= getNumDofs())
1084 return Base::mAspectProperties.mAccelerationLowerLimits[
index];
1088 template<
class ConfigSpaceT>
1090 const Eigen::VectorXd& lowerLimits)
1092 if (
static_cast<size_t>(lowerLimits.size()) != getNumDofs())
1102 template<
class ConfigSpaceT>
1105 return Base::mAspectProperties.mAccelerationLowerLimits;
1109 template <
class ConfigSpaceT>
1113 if (
index >= getNumDofs())
1124 template <
class ConfigSpaceT>
1128 if (
index >= getNumDofs())
1134 return Base::mAspectProperties.mAccelerationUpperLimits[
index];
1138 template<
class ConfigSpaceT>
1140 const Eigen::VectorXd& upperLimits)
1142 if (
static_cast<size_t>(upperLimits.size()) != getNumDofs())
1152 template<
class ConfigSpaceT>
1155 return Base::mAspectProperties.mAccelerationUpperLimits;
1159 template <
class ConfigSpaceT>
1162 setAccelerationsStatic(Vector::Zero());
1166 template <
class ConfigSpaceT>
1169 if (
index >= getNumDofs())
1178 this->mAspectState.mCommands[
index] = this->mAspectState.mForces[
index];
1182 template <
class ConfigSpaceT>
1185 if (
index >= getNumDofs())
1191 return this->mAspectState.mForces[
index];
1195 template <
class ConfigSpaceT>
1198 if (
static_cast<size_t>(forces.size()) != getNumDofs())
1204 this->mAspectState.mForces = forces;
1207 this->mAspectState.mCommands = this->mAspectState.mForces;
1211 template <
class ConfigSpaceT>
1214 return this->mAspectState.mForces;
1218 template <
class ConfigSpaceT>
1221 if (
index >= getNumDofs())
1231 template <
class ConfigSpaceT>
1235 if (
index >= getNumDofs())
1241 return Base::mAspectProperties.mForceLowerLimits[
index];
1245 template<
class ConfigSpaceT>
1247 const Eigen::VectorXd& lowerLimits)
1249 if (
static_cast<size_t>(lowerLimits.size()) != getNumDofs())
1259 template<
class ConfigSpaceT>
1262 return Base::mAspectProperties.mForceLowerLimits;
1266 template <
class ConfigSpaceT>
1269 if (
index >= getNumDofs())
1279 template <
class ConfigSpaceT>
1283 if (
index >= getNumDofs())
1289 return Base::mAspectProperties.mForceUpperLimits[
index];
1293 template<
class ConfigSpaceT>
1295 const Eigen::VectorXd& upperLimits)
1297 if (
static_cast<size_t>(upperLimits.size()) != getNumDofs())
1307 template<
class ConfigSpaceT>
1310 return Base::mAspectProperties.mForceUpperLimits;
1314 template <
class ConfigSpaceT>
1317 this->mAspectState.mForces.setZero();
1320 this->mAspectState.mCommands = this->mAspectState.mForces;
1324 template <
class ConfigSpaceT>
1326 size_t index,
double velocityChange)
1328 if (
index >= getNumDofs())
1334 mVelocityChanges[
index] = velocityChange;
1338 template <
class ConfigSpaceT>
1341 if (
index >= getNumDofs())
1347 return mVelocityChanges[
index];
1351 template <
class ConfigSpaceT>
1354 mVelocityChanges.setZero();
1358 template <
class ConfigSpaceT>
1362 if (
index >= getNumDofs())
1368 mConstraintImpulses[
index] = impulse;
1372 template <
class ConfigSpaceT>
1375 if (
index >= getNumDofs())
1381 return mConstraintImpulses[
index];
1385 template <
class ConfigSpaceT>
1388 mConstraintImpulses.setZero();
1392 template <
class ConfigSpaceT>
1395 const Point& point = math::integratePosition<ConfigSpaceT>(
1396 math::toManifoldPoint<ConfigSpaceT>(getPositionsStatic()),
1397 getVelocitiesStatic(), dt);
1399 setPositionsStatic(math::toEuclideanPoint<ConfigSpaceT>(point));
1403 template <
class ConfigSpaceT>
1406 setVelocitiesStatic(math::integrateVelocity<ConfigSpaceT>(
1407 getVelocitiesStatic(),
1408 getAccelerationsStatic(), dt));
1412 template <
class ConfigSpaceT>
1414 const Eigen::VectorXd& q2,
const Eigen::VectorXd& q1)
const
1416 if (
static_cast<size_t>(q1.size()) != getNumDofs()
1417 ||
static_cast<size_t>(q2.size()) != getNumDofs())
1419 dterr <<
"[GenericJoint::getPositionsDifference] q1's size [" << q1.size()
1420 <<
"] or q2's size [" << q2.size() <<
"] must both equal the dof ["
1421 << this->getNumDofs() <<
"] for Joint [" << this->getName() <<
"].\n";
1423 return Eigen::VectorXd::Zero(getNumDofs());
1426 return getPositionDifferencesStatic(q2, q1);
1430 template <
class ConfigSpaceT>
1431 typename ConfigSpaceT::Vector
1440 template <
class ConfigSpaceT>
1443 if (
index >= getNumDofs())
1455 template <
class ConfigSpaceT>
1458 if (
index >= getNumDofs())
1464 return Base::mAspectProperties.mSpringStiffnesses[
index];
1468 template <
class ConfigSpaceT>
1471 if (
index >= getNumDofs())
1477 if (Base::mAspectProperties.mPositionLowerLimits[
index] > q0
1478 || Base::mAspectProperties.mPositionUpperLimits[
index] < q0)
1480 dtwarn <<
"[GenericJoint::setRestPosition] Value of _q0 [" << q0
1481 <<
"], is out of the limit range ["
1482 << Base::mAspectProperties.mPositionLowerLimits[
index] <<
", "
1483 << Base::mAspectProperties.mPositionUpperLimits[
index]
1484 <<
"] for index [" <<
index <<
"] of Joint [" << this->getName()
1493 template <
class ConfigSpaceT>
1496 if (
index >= getNumDofs())
1502 return Base::mAspectProperties.mRestPositions[
index];
1506 template <
class ConfigSpaceT>
1510 if (
index >= getNumDofs())
1522 template <
class ConfigSpaceT>
1525 if (
index >= getNumDofs())
1531 return Base::mAspectProperties.mDampingCoefficients[
index];
1535 template <
class ConfigSpaceT>
1539 if (
index >= getNumDofs())
1551 template <
class ConfigSpaceT>
1554 if (
index >= getNumDofs())
1560 return Base::mAspectProperties.mFrictions[
index];
1564 template <
class ConfigSpaceT>
1569 = getPositionsStatic() - Base::mAspectProperties.mRestPositions;
1571 const double pe = 0.5 * displacement.dot(
1572 Base::mAspectProperties.mSpringStiffnesses.cwiseProduct(displacement));
1578 template <
class ConfigSpaceT>
1582 return getRelativeJacobianStatic();
1586 template <
class ConfigSpaceT>
1590 if (this->mIsRelativeJacobianDirty)
1592 this->updateRelativeJacobian(
false);
1593 this->mIsRelativeJacobianDirty =
false;
1600 template <
class ConfigSpaceT>
1602 const Eigen::VectorXd& positions)
const
1604 return getRelativeJacobianStatic(positions);
1608 template <
class ConfigSpaceT>
1612 return getRelativeJacobianTimeDerivStatic();
1616 template <
class ConfigSpaceT>
1620 if (this->mIsRelativeJacobianTimeDerivDirty)
1622 this->updateRelativeJacobianTimeDeriv();
1623 this->mIsRelativeJacobianTimeDerivDirty =
false;
1626 return mJacobianDeriv;
1630 template <
class ConfigSpaceT>
1633 : mVelocityChanges(
Vector::Zero()),
1634 mImpulses(
Vector::Zero()),
1635 mConstraintImpulses(
Vector::Zero()),
1638 mInvProjArtInertia(
Matrix::Zero()),
1639 mInvProjArtInertiaImplicit(
Matrix::Zero()),
1640 mTotalForce(
Vector::Zero()),
1641 mTotalImpulse(
Vector::Zero())
1643 for (
auto i = 0u; i <
NumDofs; ++i)
1644 mDofs[i] = this->createDofPointer(i);
1652 template <
class ConfigSpaceT>
1655 const SkeletonPtr& skel = this->mChildBodyNode->getSkeleton();
1656 for (
auto i = 0u; i < NumDofs; ++i)
1658 Base::mAspectProperties.mDofNames[i]
1659 = skel->mNameMgrForDofs.issueNewNameAndAdd(mDofs[i]->getName(),
1665 template <
class ConfigSpaceT>
1669 assert(this->mChildBodyNode);
1670 return this->mChildBodyNode->getBodyForce()
1671 - this->getRelativeJacobianStatic() * this->mAspectState.mForces;
1675 template <
class ConfigSpaceT>
1678 this->mSpatialVelocity =
1679 this->getRelativeJacobianStatic() * this->getVelocitiesStatic();
1683 template <
class ConfigSpaceT>
1686 this->mSpatialAcceleration =
1687 this->getRelativePrimaryAcceleration()
1688 + this->getRelativeJacobianTimeDerivStatic() * this->getVelocitiesStatic();
1692 template <
class ConfigSpaceT>
1695 this->mPrimaryAcceleration =
1696 this->getRelativeJacobianStatic() * this->getAccelerationsStatic();
1700 template <
class ConfigSpaceT>
1704 vel.noalias() += getRelativeJacobianStatic() * getVelocitiesStatic();
1711 template <
class ConfigSpaceT>
1717 partialAcceleration =
math::ad(childVelocity,
1718 getRelativeJacobianStatic() * getVelocitiesStatic())
1719 + getRelativeJacobianTimeDerivStatic() * getVelocitiesStatic();
1725 template <
class ConfigSpaceT>
1730 acc.noalias() += getRelativeJacobianStatic() * getAccelerationsStatic();
1737 template <
class ConfigSpaceT>
1742 velocityChange.noalias() += getRelativeJacobianStatic() * mVelocityChanges;
1749 template <
class ConfigSpaceT>
1755 return mInvProjArtInertia;
1759 template <
class ConfigSpaceT>
1765 return mInvProjArtInertiaImplicit;
1769 template <
class ConfigSpaceT>
1780 addChildArtInertiaToDynamic(parentArtInertia,
1786 addChildArtInertiaToKinematic(parentArtInertia,
1796 template <
class ConfigSpaceT>
1802 JacobianMatrix AIS = childArtInertia * getRelativeJacobianStatic();
1804 PI.noalias() -= AIS * mInvProjArtInertia * AIS.transpose();
1810 this->getRelativeTransform().
inverse(), PI);
1814 template <
class ConfigSpaceT>
1822 this->getRelativeTransform().
inverse(), childArtInertia);
1826 template <
class ConfigSpaceT>
1837 addChildArtInertiaImplicitToDynamic(parentArtInertia,
1843 addChildArtInertiaImplicitToKinematic(parentArtInertia,
1853 template <
class ConfigSpaceT>
1859 JacobianMatrix AIS = childArtInertia * getRelativeJacobianStatic();
1861 PI.noalias() -= AIS * mInvProjArtInertiaImplicit * AIS.transpose();
1867 this->getRelativeTransform().
inverse(), PI);
1871 template <
class ConfigSpaceT>
1879 this->getRelativeTransform().
inverse(), childArtInertia);
1883 template <
class ConfigSpaceT>
1893 updateInvProjArtInertiaDynamic(artInertia);
1898 updateInvProjArtInertiaKinematic(artInertia);
1907 template <
class ConfigSpaceT>
1916 mInvProjArtInertia = math::inverse<ConfigSpaceT>(projAI);
1923 template <
class ConfigSpaceT>
1931 template <
class ConfigSpaceT>
1942 updateInvProjArtInertiaImplicitDynamic(artInertia, timeStep);
1947 updateInvProjArtInertiaImplicitKinematic(artInertia, timeStep);
1951 updateInvProjArtInertiaImplicit);
1957 template <
class ConfigSpaceT>
1968 (timeStep * Base::mAspectProperties.mDampingCoefficients
1969 + timeStep * timeStep * Base::mAspectProperties.mSpringStiffnesses).asDiagonal();
1972 mInvProjArtInertiaImplicit = math::inverse<ConfigSpaceT>(projAI);
1979 template <
class ConfigSpaceT>
1987 template <
class ConfigSpaceT>
2000 addChildBiasForceToDynamic(parentBiasForce,
2008 addChildBiasForceToKinematic(parentBiasForce,
2020 template <
class ConfigSpaceT>
2032 + getRelativeJacobianStatic() * getInvProjArtInertiaImplicit()
2045 parentBiasForce +=
math::dAdInvT(this->getRelativeTransform(), beta);
2049 template <
class ConfigSpaceT>
2059 + childArtInertia*(childPartialAcc
2060 + getRelativeJacobianStatic()*getAccelerationsStatic());
2072 _parentBiasForce +=
math::dAdInvT(this->getRelativeTransform(), beta);
2076 template <
class ConfigSpaceT>
2088 addChildBiasImpulseToDynamic(parentBiasImpulse,
2095 addChildBiasImpulseToKinematic(parentBiasImpulse,
2106 template <
class ConfigSpaceT>
2115 + childArtInertia*getRelativeJacobianStatic()
2116 *getInvProjArtInertia()*mTotalImpulse;
2123 _parentBiasImpulse +=
math::dAdInvT(this->getRelativeTransform(), beta);
2127 template <
class ConfigSpaceT>
2135 parentBiasImpulse +=
math::dAdInvT(this->getRelativeTransform(), childBiasImpulse);
2139 template <
class ConfigSpaceT>
2144 assert(timeStep > 0.0);
2149 this->mAspectState.mForces = this->mAspectState.mCommands;
2150 updateTotalForceDynamic(bodyForce, timeStep);
2155 this->mAspectState.mForces.setZero();
2156 updateTotalForceDynamic(bodyForce, timeStep);
2159 setAccelerationsStatic(this->mAspectState.mCommands);
2160 updateTotalForceKinematic(bodyForce, timeStep);
2163 setAccelerationsStatic(
2164 (this->mAspectState.mCommands - getVelocitiesStatic()) / timeStep );
2165 updateTotalForceKinematic(bodyForce, timeStep);
2168 setVelocitiesStatic(Vector::Zero());
2169 setAccelerationsStatic(Vector::Zero());
2170 updateTotalForceKinematic(bodyForce, timeStep);
2179 template <
class ConfigSpaceT>
2186 = -Base::mAspectProperties.mSpringStiffnesses.cwiseProduct(
2187 getPositionsStatic()
2188 - Base::mAspectProperties.mRestPositions
2189 + getVelocitiesStatic() * timeStep);
2192 const Vector dampingForce
2193 = -Base::mAspectProperties.mDampingCoefficients.cwiseProduct(
2194 getVelocitiesStatic());
2197 mTotalForce = this->mAspectState.mForces
2200 - getRelativeJacobianStatic().transpose() * bodyForce;
2204 template <
class ConfigSpaceT>
2213 template <
class ConfigSpaceT>
2223 updateTotalImpulseDynamic(bodyImpulse);
2228 updateTotalImpulseKinematic(bodyImpulse);
2237 template <
class ConfigSpaceT>
2242 mTotalImpulse = mConstraintImpulses
2243 - getRelativeJacobianStatic().transpose() * bodyImpulse;
2247 template <
class ConfigSpaceT>
2255 template <
class ConfigSpaceT>
2258 mTotalImpulse.setZero();
2262 template <
class ConfigSpaceT>
2273 updateAccelerationDynamic(artInertia, spatialAcc);
2278 updateAccelerationKinematic(artInertia, spatialAcc);
2287 template <
class ConfigSpaceT>
2293 setAccelerationsStatic( getInvProjArtInertiaImplicit()
2294 * (mTotalForce - getRelativeJacobianStatic().transpose()
2295 *artInertia*
math::AdInvT(this->getRelativeTransform(), spatialAcc)) );
2302 template <
class ConfigSpaceT>
2311 template <
class ConfigSpaceT>
2322 updateVelocityChangeDynamic(artInertia, velocityChange);
2327 updateVelocityChangeKinematic(artInertia, velocityChange);
2336 template <
class ConfigSpaceT>
2343 = getInvProjArtInertia()
2344 * (mTotalImpulse - getRelativeJacobianStatic().transpose()
2345 *artInertia*
math::AdInvT(this->getRelativeTransform(), velocityChange));
2352 template <
class ConfigSpaceT>
2361 template <
class ConfigSpaceT>
2365 bool withDampingForces,
2366 bool withSpringForces)
2368 this->mAspectState.mForces = getRelativeJacobianStatic().transpose() * bodyForce;
2371 if (withDampingForces)
2373 const typename ConfigSpaceT::Vector dampingForces
2374 = -Base::mAspectProperties.mDampingCoefficients.cwiseProduct(
2375 getVelocitiesStatic());
2376 this->mAspectState.mForces -= dampingForces;
2380 if (withSpringForces)
2382 const typename ConfigSpaceT::Vector springForces
2383 = -Base::mAspectProperties.mSpringStiffnesses.cwiseProduct(
2384 getPositionsStatic()
2385 - Base::mAspectProperties.mRestPositions
2386 + getVelocitiesStatic() * timeStep);
2387 this->mAspectState.mForces -= springForces;
2392 template <
class ConfigSpaceT>
2396 bool withDampingForces,
2397 bool withSpringForces)
2409 updateForceID(bodyForce, timeStep, withDampingForces, withSpringForces);
2418 template <
class ConfigSpaceT>
2422 mImpulses = getRelativeJacobianStatic().transpose()*bodyImpulse;
2426 template <
class ConfigSpaceT>
2440 updateImpulseID(bodyImpulse);
2449 template <
class ConfigSpaceT>
2458 updateConstrainedTermsDynamic(timeStep);
2463 updateConstrainedTermsKinematic(timeStep);
2472 template <
class ConfigSpaceT>
2476 const double invTimeStep = 1.0 / timeStep;
2478 setVelocitiesStatic(getVelocitiesStatic() + mVelocityChanges);
2479 setAccelerationsStatic(getAccelerationsStatic()
2480 + mVelocityChanges * invTimeStep);
2481 this->mAspectState.mForces.noalias() += mImpulses * invTimeStep;
2486 template <
class ConfigSpaceT>
2490 this->mAspectState.mForces.noalias() += mImpulses / timeStep;
2494 template <
class ConfigSpaceT>
2502 beta.noalias() += childArtInertia * getRelativeJacobianStatic()
2503 * getInvProjArtInertia() * mInvM_a;
2510 parentBiasForce +=
math::dAdInvT(this->getRelativeTransform(), beta);
2514 template <
class ConfigSpaceT>
2522 beta.noalias() += childArtInertia * getRelativeJacobianStatic()
2523 * getInvProjArtInertiaImplicit() * mInvM_a;
2530 parentBiasForce +=
math::dAdInvT(this->getRelativeTransform(), beta);
2534 template <
class ConfigSpaceT>
2539 mInvM_a = this->mAspectState.mForces
2540 - getRelativeJacobianStatic().transpose() * bodyForce;
2544 template <
class ConfigSpaceT>
2546 Eigen::MatrixXd& _invMassMat,
2552 mInvMassMatrixSegment
2553 = getInvProjArtInertia()
2554 * (mInvM_a - getRelativeJacobianStatic().transpose()
2555 * artInertia *
math::AdInvT(this->getRelativeTransform(), spatialAcc));
2561 size_t iStart = mDofs[0]->mIndexInTree;
2564 _invMassMat.block<NumDofs, 1>(iStart, _col) = mInvMassMatrixSegment;
2568 template <
class ConfigSpaceT>
2570 Eigen::MatrixXd& invMassMat,
2576 mInvMassMatrixSegment
2577 = getInvProjArtInertiaImplicit()
2578 * (mInvM_a - getRelativeJacobianStatic().transpose()
2579 * artInertia *
math::AdInvT(this->getRelativeTransform(), spatialAcc));
2585 size_t iStart = mDofs[0]->mIndexInTree;
2588 invMassMat.block<NumDofs, 1>(iStart, col) = mInvMassMatrixSegment;
2592 template <
class ConfigSpaceT>
2597 acc += getRelativeJacobianStatic() * mInvMassMatrixSegment;
2601 template <
class ConfigSpaceT>
2605 return getRelativeJacobianStatic().transpose() * spatial;
#define dterr
Output an error message.
Definition: Console.hpp:49
#define dtwarn
Output a warning message.
Definition: Console.hpp:46
BodyPropPtr properties
Definition: SdfParser.cpp:80
std::string * name
Definition: SkelParser.cpp:1642
bool * preserveName
Definition: SkelParser.cpp:1641
Eigen::VectorXd velocity
Definition: SkelParser.cpp:108
Eigen::VectorXd force
Definition: SkelParser.cpp:110
std::size_t index
Definition: SkelParser.cpp:1617
Eigen::VectorXd acceleration
Definition: SkelParser.cpp:109
double * friction
Definition: SkelParser.cpp:1639
Eigen::VectorXd position
Definition: SkelParser.cpp:107
AspectProperties mAspectProperties
Aspect::Properties data, directly accessible to your derived class.
Definition: EmbeddedAspect.hpp:237
typename Impl::AspectState AspectState
Definition: EmbeddedAspect.hpp:444
AspectState mAspectState
Aspect::State data, directly accessible to your derived class.
Definition: EmbeddedAspect.hpp:422
typename Impl::AspectProperties AspectProperties
Definition: EmbeddedAspect.hpp:446
DegreeOfFreedom class is a proxy class for accessing single degrees of freedom (aka generalized coord...
Definition: DegreeOfFreedom.hpp:53
Definition: GenericJoint.hpp:49
void setAspectState(const AspectState &state)
Set the AspectState of this GenericJoint.
Definition: GenericJoint.hpp:114
void setForceLowerLimits(const Eigen::VectorXd &lowerLimits) override
Definition: GenericJoint.hpp:1246
double getCommand(std::size_t index) const override
Definition: GenericJoint.hpp:391
typename ConfigSpaceT::Matrix Matrix
Definition: GenericJoint.hpp:61
void addChildArtInertiaImplicitToKinematic(Eigen::Matrix6d &parentArtInertia, const Eigen::Matrix6d &childArtInertia)
Definition: GenericJoint.hpp:1872
Eigen::VectorXd getCommands() const override
Definition: GenericJoint.hpp:473
void resetVelocities() override
Definition: GenericJoint.hpp:946
const Vector & getPositionsStatic() const
Fixed-size version of getPositions()
Definition: GenericJoint.hpp:732
void setAccelerationsStatic(const Vector &accels)
Fixed-size version of setAccelerations()
Definition: GenericJoint.hpp:759
void copy(const ThisClass &otherJoint)
Copy the Properties of another GenericJoint.
Definition: GenericJoint.hpp:159
void setForceUpperLimits(const Eigen::VectorXd &upperLimits) override
Definition: GenericJoint.hpp:1294
void updateTotalImpulseKinematic(const Eigen::Vector6d &bodyImpulse)
Definition: GenericJoint.hpp:2248
void setCoulombFriction(std::size_t index, double friction) override
Definition: GenericJoint.hpp:1536
const JacobianMatrix & getRelativeJacobianTimeDerivStatic() const
Fixed-size version of getRelativeJacobianTimeDeriv()
Definition: GenericJoint.hpp:1618
void setRestPosition(std::size_t index, double q0) override
Definition: GenericJoint.hpp:1469
void setAccelerations(const Eigen::VectorXd &accelerations) override
Definition: GenericJoint.hpp:1036
void updateTotalImpulse(const Eigen::Vector6d &bodyImpulse) override
Definition: GenericJoint.hpp:2214
void updateForceFD(const Eigen::Vector6d &bodyForce, double timeStep, bool withDampingForcese, bool withSpringForces) override
Definition: GenericJoint.hpp:2393
const Matrix & getInvProjArtInertiaImplicit() const
Get the inverse of projected articulated inertia for implicit joint damping and spring forces.
Definition: GenericJoint.hpp:1761
Eigen::VectorXd getPositionUpperLimits() const override
Definition: GenericJoint.hpp:631
void setVelocityUpperLimits(const Eigen::VectorXd &upperLimits) override
Definition: GenericJoint.hpp:912
void updateForceID(const Eigen::Vector6d &bodyForce, double timeStep, bool withDampingForces, bool withSpringForces) override
Definition: GenericJoint.hpp:2362
Eigen::VectorXd getAccelerationUpperLimits() const override
Definition: GenericJoint.hpp:1153
void updateAccelerationKinematic(const Eigen::Matrix6d &artInertia, const Eigen::Vector6d &spatialAcc)
Definition: GenericJoint.hpp:2303
void updateVelocityChangeDynamic(const Eigen::Matrix6d &artInertia, const Eigen::Vector6d &velocityChange)
Definition: GenericJoint.hpp:2337
Eigen::VectorXd getVelocityLowerLimits() const override
Definition: GenericJoint.hpp:877
void updateInvProjArtInertiaImplicit(const Eigen::Matrix6d &artInertia, double timeStep) override
Definition: GenericJoint.hpp:1932
void setVelocityLowerLimits(const Eigen::VectorXd &lowerLimits) override
Definition: GenericJoint.hpp:863
void updateConstrainedTermsDynamic(double timeStep)
Definition: GenericJoint.hpp:2473
void setPositionLowerLimit(std::size_t index, double position) override
Definition: GenericJoint.hpp:542
const GenericJoint< ConfigSpaceT >::JacobianMatrix & getRelativeJacobianStatic() const
Fixed-size version of getRelativeJacobian()
Definition: GenericJoint.hpp:1588
void addChildArtInertiaToDynamic(Eigen::Matrix6d &parentArtInertia, const Eigen::Matrix6d &childArtInertia)
Definition: GenericJoint.hpp:1797
const math::Jacobian getRelativeJacobianTimeDeriv() const override
Definition: GenericJoint.hpp:1610
void setVelocities(const Eigen::VectorXd &velocities) override
Definition: GenericJoint.hpp:812
void addChildBiasImpulseToKinematic(Eigen::Vector6d &parentBiasImpulse, const Eigen::Matrix6d &childArtInertia, const Eigen::Vector6d &childBiasImpulse)
Definition: GenericJoint.hpp:2128
void addChildArtInertiaImplicitTo(Eigen::Matrix6d &parentArtInertiaImplicit, const Eigen::Matrix6d &childArtInertiaImplicit) override
Definition: GenericJoint.hpp:1827
void setPosition(std::size_t index, double position) override
Definition: GenericJoint.hpp:487
void updateVelocityChange(const Eigen::Matrix6d &artInertia, const Eigen::Vector6d &velocityChange) override
Definition: GenericJoint.hpp:2312
void setCommand(std::size_t index, double command) override
Definition: GenericJoint.hpp:326
std::array< DegreeOfFreedom *, NumDofs > mDofs
Array of DegreeOfFreedom objects.
Definition: GenericJoint.hpp:675
void setInitialPosition(std::size_t index, double initial) override
Definition: GenericJoint.hpp:672
Eigen::VectorXd getForces() const override
Definition: GenericJoint.hpp:1212
void resetCommands() override
Definition: GenericJoint.hpp:480
void setVelocityChange(std::size_t index, double velocityChange) override
Definition: GenericJoint.hpp:1325
void setAccelerationUpperLimits(const Eigen::VectorXd &upperLimits) override
Definition: GenericJoint.hpp:1139
void setPartialAccelerationTo(Eigen::Vector6d &partialAcceleration, const Eigen::Vector6d &childVelocity) override
Definition: GenericJoint.hpp:1712
double getVelocity(std::size_t index) const override
Definition: GenericJoint.hpp:799
Eigen::Vector6d getBodyConstraintWrench() const override
Definition: GenericJoint.hpp:1667
void addAccelerationTo(Eigen::Vector6d &acc) override
Definition: GenericJoint.hpp:1726
void updateTotalImpulseDynamic(const Eigen::Vector6d &bodyImpulse)
Definition: GenericJoint.hpp:2238
void setForce(std::size_t index, double force) override
Definition: GenericJoint.hpp:1167
void setInitialVelocity(std::size_t index, double initial) override
Definition: GenericJoint.hpp:953
double getForce(std::size_t index) const override
Definition: GenericJoint.hpp:1183
void setInitialVelocities(const Eigen::VectorXd &initial) override
Definition: GenericJoint.hpp:980
void updateInvProjArtInertiaDynamic(const Eigen::Matrix6d &artInertia)
Definition: GenericJoint.hpp:1908
DegreeOfFreedom * getDof(std::size_t index) override
void setPositionUpperLimit(std::size_t index, double position) override
Definition: GenericJoint.hpp:590
void updateInvProjArtInertiaImplicitKinematic(const Eigen::Matrix6d &artInertia, double timeStep)
Definition: GenericJoint.hpp:1980
const math::Jacobian getRelativeJacobian() const override
Definition: GenericJoint.hpp:1580
std::size_t getNumDofs() const override
Definition: GenericJoint.hpp:215
void resetForces() override
Definition: GenericJoint.hpp:1315
void addChildArtInertiaTo(Eigen::Matrix6d &parentArtInertia, const Eigen::Matrix6d &childArtInertia) override
Definition: GenericJoint.hpp:1770
Eigen::VectorXd getPositionLowerLimits() const override
Definition: GenericJoint.hpp:583
bool isDofNamePreserved(size_t index) const override
Definition: GenericJoint.hpp:269
void addVelocityTo(Eigen::Vector6d &vel) override
Definition: GenericJoint.hpp:1701
void preserveDofName(size_t index, bool preserve) override
Definition: GenericJoint.hpp:256
double getVelocityUpperLimit(std::size_t index) const override
Definition: GenericJoint.hpp:898
double getVelocityChange(std::size_t index) const override
Definition: GenericJoint.hpp:1339
void updateTotalForce(const Eigen::Vector6d &bodyForce, double timeStep) override
Definition: GenericJoint.hpp:2140
void resetConstraintImpulses() override
Definition: GenericJoint.hpp:1386
virtual Vector getPositionDifferencesStatic(const Vector &q2, const Vector &q1) const
Fixed-size version of getPositionDifferences()
Definition: GenericJoint.hpp:1432
void setVelocity(std::size_t index, double velocity) override
Definition: GenericJoint.hpp:778
double getRestPosition(std::size_t index) const override
Definition: GenericJoint.hpp:1494
void updateConstrainedTerms(double timeStep) override
Definition: GenericJoint.hpp:2450
void integrateVelocities(double dt) override
Definition: GenericJoint.hpp:1404
Eigen::VectorXd getPositions() const override
Definition: GenericJoint.hpp:535
void addChildBiasImpulseToDynamic(Eigen::Vector6d &parentBiasImpulse, const Eigen::Matrix6d &childArtInertia, const Eigen::Vector6d &childBiasImpulse)
Definition: GenericJoint.hpp:2107
double getAcceleration(std::size_t index) const override
Definition: GenericJoint.hpp:1023
Eigen::VectorXd getVelocities() const override
Definition: GenericJoint.hpp:829
Eigen::VectorXd getInitialPositions() const override
Definition: GenericJoint.hpp:713
Eigen::VectorXd getPositionDifferences(const Eigen::VectorXd &q2, const Eigen::VectorXd &q1) const override
Definition: GenericJoint.hpp:1413
void setPositionLowerLimits(const Eigen::VectorXd &lowerLimits) override
Definition: GenericJoint.hpp:569
double getAccelerationUpperLimit(std::size_t index) const override
Definition: GenericJoint.hpp:1125
void setForceLowerLimit(size_t index, double force) override
Definition: GenericJoint.hpp:1219
void setSpringStiffness(std::size_t index, double k) override
Definition: GenericJoint.hpp:1441
void updateRelativePrimaryAcceleration() const override
Definition: GenericJoint.hpp:1693
void setProperties(const Properties &properties)
Set the Properties of this GenericJoint.
Definition: GenericJoint.hpp:98
double getForceLowerLimit(std::size_t index) const override
Definition: GenericJoint.hpp:1232
static constexpr std::size_t NumDofs
Definition: GenericJoint.hpp:52
const Vector & getVelocitiesStatic() const
Fixed-size version of getVelocities()
Definition: GenericJoint.hpp:752
double getPositionUpperLimit(std::size_t index) const override
Definition: GenericJoint.hpp:604
const std::string & getDofName(size_t index) const override
Definition: GenericJoint.hpp:282
ThisClass & operator=(const ThisClass &other)
Same as copy(const GenericJoint&)
Definition: GenericJoint.hpp:182
double computePotentialEnergy() const override
Definition: GenericJoint.hpp:1565
double getSpringStiffness(std::size_t index) const override
Definition: GenericJoint.hpp:1456
void setDampingCoefficient(std::size_t index, double coeff) override
Definition: GenericJoint.hpp:1507
void updateInvProjArtInertia(const Eigen::Matrix6d &artInertia) override
Definition: GenericJoint.hpp:1884
void resetVelocity(std::size_t index) override
Definition: GenericJoint.hpp:933
void setPositionsStatic(const Vector &positions)
Fixed-size version of setPositions()
Definition: GenericJoint.hpp:720
void addChildBiasForceForInvAugMassMatrix(Eigen::Vector6d &parentBiasForce, const Eigen::Matrix6d &childArtInertia, const Eigen::Vector6d &childBiasForce) override
Definition: GenericJoint.hpp:2515
void updateConstrainedTermsKinematic(double timeStep)
Definition: GenericJoint.hpp:2487
void setAccelerationLowerLimits(const Eigen::VectorXd &lowerLimits) override
Definition: GenericJoint.hpp:1089
void setAspectProperties(const AspectProperties &properties)
Set the AspectProperties of this GenericJoint.
Definition: GenericJoint.hpp:125
Eigen::VectorXd getForceUpperLimits() const override
Definition: GenericJoint.hpp:1308
detail::GenericJointProperties< ConfigSpaceT > Properties
Definition: GenericJoint.hpp:64
void updateImpulseFD(const Eigen::Vector6d &bodyImpulse) override
Definition: GenericJoint.hpp:2427
GenericJoint(const ThisClass &)=delete
void updateInvProjArtInertiaImplicitDynamic(const Eigen::Matrix6d &artInertia, double timeStep)
Definition: GenericJoint.hpp:1958
void updateTotalForceKinematic(const Eigen::Vector6d &bodyForce, double timeStep)
Definition: GenericJoint.hpp:2205
void resetTotalImpulses() override
Definition: GenericJoint.hpp:2256
void integratePositions(double dt) override
Definition: GenericJoint.hpp:1393
void setPositions(const Eigen::VectorXd &positions) override
Definition: GenericJoint.hpp:521
void addChildBiasForceToDynamic(Eigen::Vector6d &parentBiasForce, const Eigen::Matrix6d &childArtInertia, const Eigen::Vector6d &childBiasForce, const Eigen::Vector6d &childPartialAcc)
Definition: GenericJoint.hpp:2021
Eigen::VectorXd getForceLowerLimits() const override
Definition: GenericJoint.hpp:1260
double getInitialVelocity(std::size_t index) const override
Definition: GenericJoint.hpp:967
Eigen::VectorXd getAccelerations() const override
Definition: GenericJoint.hpp:1053
typename ConfigSpaceT::Vector Vector
Definition: GenericJoint.hpp:59
void updateVelocityChangeKinematic(const Eigen::Matrix6d &artInertia, const Eigen::Vector6d &velocityChange)
Definition: GenericJoint.hpp:2353
const Vector & getAccelerationsStatic() const
Fixed-size version of getAccelerations()
Definition: GenericJoint.hpp:771
Eigen::VectorXd getInitialVelocities() const override
Definition: GenericJoint.hpp:994
void setCommands(const Eigen::VectorXd &commands) override
Definition: GenericJoint.hpp:404
Eigen::VectorXd getSpatialToGeneralized(const Eigen::Vector6d &spatial) override
Definition: GenericJoint.hpp:2602
typename ConfigSpaceT::JacobianMatrix JacobianMatrix
Definition: GenericJoint.hpp:60
void getInvAugMassMatrixSegment(Eigen::MatrixXd &invMassMat, const size_t col, const Eigen::Matrix6d &artInertia, const Eigen::Vector6d &spatialAcc) override
Definition: GenericJoint.hpp:2569
double getVelocityLowerLimit(std::size_t index) const override
Definition: GenericJoint.hpp:850
void updateImpulseID(const Eigen::Vector6d &bodyImpulse) override
Definition: GenericJoint.hpp:2419
void setVelocityLowerLimit(std::size_t index, double velocity) override
Definition: GenericJoint.hpp:836
double getInitialPosition(std::size_t index) const override
Definition: GenericJoint.hpp:686
void updateAcceleration(const Eigen::Matrix6d &artInertia, const Eigen::Vector6d &spatialAcc) override
Definition: GenericJoint.hpp:2263
void addChildBiasForceToKinematic(Eigen::Vector6d &parentBiasForce, const Eigen::Matrix6d &childArtInertia, const Eigen::Vector6d &childBiasForce, const Eigen::Vector6d &childPartialAcc)
Definition: GenericJoint.hpp:2050
void setVelocityUpperLimit(std::size_t index, double velocity) override
Definition: GenericJoint.hpp:884
typename ConfigSpaceT::Point Point
Definition: GenericJoint.hpp:57
void updateInvProjArtInertiaKinematic(const Eigen::Matrix6d &artInertia)
Definition: GenericJoint.hpp:1924
bool hasPositionLimit(std::size_t index) const override
Definition: GenericJoint.hpp:638
void setInitialPositions(const Eigen::VectorXd &initial) override
Definition: GenericJoint.hpp:699
virtual ~GenericJoint()
Destructor.
Definition: GenericJoint.hpp:90
void addChildBiasForceTo(Eigen::Vector6d &parentBiasForce, const Eigen::Matrix6d &childArtInertia, const Eigen::Vector6d &childBiasForce, const Eigen::Vector6d &childPartialAcc) override
Definition: GenericJoint.hpp:1988
double getCoulombFriction(std::size_t index) const override
Definition: GenericJoint.hpp:1552
void addInvMassMatrixSegmentTo(Eigen::Vector6d &acc) override
Definition: GenericJoint.hpp:2593
void setConstraintImpulse(std::size_t index, double impulse) override
Definition: GenericJoint.hpp:1359
void resetPosition(std::size_t index) override
Definition: GenericJoint.hpp:652
double getForceUpperLimit(size_t index) const override
Definition: GenericJoint.hpp:1280
void registerDofs() override
Definition: GenericJoint.hpp:1653
void addVelocityChangeTo(Eigen::Vector6d &velocityChange) override
Definition: GenericJoint.hpp:1738
const std::string & setDofName(std::size_t index, const std::string &name, bool preserveName=true) override
Definition: GenericJoint.hpp:222
void setAccelerationUpperLimit(std::size_t index, double acceleration) override
Definition: GenericJoint.hpp:1110
double getDampingCoefficient(std::size_t index) const override
Definition: GenericJoint.hpp:1523
void setPositionUpperLimits(const Eigen::VectorXd &upperLimits) override
Definition: GenericJoint.hpp:617
Eigen::VectorXd getAccelerationLowerLimits() const override
Definition: GenericJoint.hpp:1103
void updateTotalForceDynamic(const Eigen::Vector6d &bodyForce, double timeStep)
Definition: GenericJoint.hpp:2180
void setVelocitiesStatic(const Vector &velocities)
Fixed-size version of setVelocities()
Definition: GenericJoint.hpp:739
void updateRelativeSpatialAcceleration() const override
Definition: GenericJoint.hpp:1684
void updateRelativeSpatialVelocity() const override
Definition: GenericJoint.hpp:1676
void setForceUpperLimit(size_t index, double force) override
Definition: GenericJoint.hpp:1267
size_t getIndexInTree(size_t index) const override
Definition: GenericJoint.hpp:313
Eigen::VectorXd getVelocityUpperLimits() const override
Definition: GenericJoint.hpp:926
void setAccelerationLowerLimit(size_t index, double acceleration) override
Definition: GenericJoint.hpp:1060
double getPosition(std::size_t index) const override
Definition: GenericJoint.hpp:508
void addChildArtInertiaImplicitToDynamic(Eigen::Matrix6d &parentArtInertia, const Eigen::Matrix6d &childArtInertia)
Definition: GenericJoint.hpp:1854
double getAccelerationLowerLimit(std::size_t index) const override
Definition: GenericJoint.hpp:1075
void addChildBiasImpulseTo(Eigen::Vector6d &parentBiasImpulse, const Eigen::Matrix6d &childArtInertia, const Eigen::Vector6d &childBiasImpulse) override
Definition: GenericJoint.hpp:2077
double getPositionLowerLimit(std::size_t index) const override
Definition: GenericJoint.hpp:556
void updateAccelerationDynamic(const Eigen::Matrix6d &artInertia, const Eigen::Vector6d &spatialAcc)
Definition: GenericJoint.hpp:2288
void resetPositions() override
Definition: GenericJoint.hpp:665
void addChildBiasForceForInvMassMatrix(Eigen::Vector6d &parentBiasForce, const Eigen::Matrix6d &childArtInertia, const Eigen::Vector6d &childBiasForce) override
Definition: GenericJoint.hpp:2495
void getInvMassMatrixSegment(Eigen::MatrixXd &invMassMat, const size_t col, const Eigen::Matrix6d &artInertia, const Eigen::Vector6d &spatialAcc) override
Definition: GenericJoint.hpp:2545
Properties getGenericJointProperties() const
Get the Properties of this GenericJoint.
Definition: GenericJoint.hpp:151
const Matrix & getInvProjArtInertia() const
Get the inverse of the projected articulated inertia.
Definition: GenericJoint.hpp:1751
void setForces(const Eigen::VectorXd &forces) override
Definition: GenericJoint.hpp:1196
void updateTotalForceForInvMassMatrix(const Eigen::Vector6d &bodyForce) override
Definition: GenericJoint.hpp:2535
void resetAccelerations() override
Definition: GenericJoint.hpp:1160
void setAcceleration(std::size_t index, double acceleration) override
Definition: GenericJoint.hpp:1001
void addChildArtInertiaToKinematic(Eigen::Matrix6d &parentArtInertia, const Eigen::Matrix6d &childArtInertia)
Definition: GenericJoint.hpp:1815
double getConstraintImpulse(std::size_t index) const override
Definition: GenericJoint.hpp:1373
size_t getIndexInSkeleton(size_t index) const override
Definition: GenericJoint.hpp:300
void resetVelocityChanges() override
Definition: GenericJoint.hpp:1352
static constexpr ActuatorType PASSIVE
Definition: Joint.hpp:67
static constexpr ActuatorType SERVO
Definition: Joint.hpp:68
static constexpr ActuatorType ACCELERATION
Definition: Joint.hpp:70
void updateArticulatedInertia() const
Tells the Skeleton to update the articulated inertia if it needs updating.
Definition: Joint.cpp:563
static constexpr ActuatorType LOCKED
Definition: Joint.hpp:72
static constexpr ActuatorType FORCE
Definition: Joint.hpp:66
static constexpr ActuatorType MIMIC
Definition: Joint.hpp:69
void setProperties(const Properties &properties)
Set the Properties of this Joint.
Definition: Joint.cpp:110
static constexpr ActuatorType VELOCITY
Definition: Joint.hpp:71
#define GenericJoint_REPORT_UNSUPPORTED_ACTUATOR(func)
Definition: GenericJoint.hpp:61
#define GenericJoint_REPORT_DIM_MISMATCH(func, arg)
Definition: GenericJoint.hpp:44
#define GenericJoint_REPORT_OUT_OF_RANGE(func, index)
Definition: GenericJoint.hpp:53
#define GenericJoint_SET_IF_DIFFERENT(mField, value)
Definition: GenericJoint.hpp:69
Matrix< double, 6, 1 > Vector6d
Definition: MathTypes.hpp:49
Matrix< double, 6, 6 > Matrix6d
Definition: MathTypes.hpp:50
std::shared_ptr< Skeleton > SkeletonPtr
Definition: SmartPointer.hpp:60
SpaceT::Matrix inverse(const typename SpaceT::Matrix &mat)
Definition: ConfigurationSpace.hpp:188
T clip(const T &val, const T &lower, const T &upper)
Definition: Helpers.hpp:147
Eigen::Matrix< double, 6, Eigen::Dynamic > Jacobian
Definition: MathTypes.hpp:108
Eigen::Vector6d AdInvT(const Eigen::Isometry3d &_T, const Eigen::Vector6d &_V)
fast version of Ad(Inv(T), V)
Definition: Geometry.cpp:714
Eigen::Vector6d dAdInvT(const Eigen::Isometry3d &_T, const Eigen::Vector6d &_F)
fast version of dAd(Inv(T), F)
Definition: Geometry.cpp:784
Eigen::Vector6d ad(const Eigen::Vector6d &_X, const Eigen::Vector6d &_Y)
adjoint mapping
Definition: Geometry.cpp:744
Inertia transformInertia(const Eigen::Isometry3d &_T, const Inertia &_I)
Definition: Geometry.cpp:1311
bool isNan(double _v)
Returns whether _v is a NaN (Not-A-Number) value.
Definition: Helpers.hpp:173
Definition: BulletCollisionDetector.cpp:63
Definition: GenericJointAspect.hpp:178
Definition: GenericJointAspect.hpp:87
EuclideanPoint mInitialPositions
Initial positions.
Definition: GenericJointAspect.hpp:101
Vector mInitialVelocities
Initial velocities.
Definition: GenericJointAspect.hpp:110
Definition: JointAspect.hpp:112