33 #ifndef DART_DYNAMICS_BODYNODE_HPP_ 34 #define DART_DYNAMICS_BODYNODE_HPP_ 39 #include <Eigen/Dense> 40 #include <Eigen/StdVector> 42 #include "dart/common/Deprecated.hpp" 43 #include "dart/common/EmbeddedAspect.hpp" 44 #include "dart/common/Signal.hpp" 45 #include "dart/config.hpp" 46 #include "dart/dynamics/Frame.hpp" 47 #include "dart/dynamics/Node.hpp" 48 #include "dart/dynamics/Skeleton.hpp" 49 #include "dart/dynamics/SmartPointer.hpp" 50 #include "dart/dynamics/SpecializedNodeManager.hpp" 51 #include "dart/dynamics/TemplatedJacobianNode.hpp" 52 #include "dart/dynamics/detail/BodyNodeAspect.hpp" 53 #include "dart/math/Geometry.hpp" 61 class DegreeOfFreedom;
73 DART_DECLARE_CLASS_WITH_VIRTUAL_BASE_BEGIN
90 using NodeStateMap = detail::NodeStateMap;
93 using NodePropertiesMap = detail::NodePropertiesMap;
156 const std::string&
setName(
const std::string& _name)
override;
159 const std::string&
getName()
const override;
225 Eigen::Vector3d
getCOM(
const Frame* _withRespectTo = Frame::World())
const;
230 const Frame* _relativeTo = Frame::World(),
231 const Frame* _inCoordinatesOf = Frame::World())
const;
240 const Frame* _relativeTo,
const Frame* _inCoordinatesOf)
const;
245 const Frame* _relativeTo = Frame::World(),
246 const Frame* _inCoordinatesOf = Frame::World())
const;
255 const Frame* _relativeTo,
const Frame* _inCoordinatesOf)
const;
261 DART_DEPRECATED(6.10)
268 DART_DEPRECATED(6.10)
275 DART_DEPRECATED(6.10)
282 DART_DEPRECATED(6.10)
307 SkeletonPtr
remove(
const std::string& _name =
"temporary");
325 bool moveTo(
const SkeletonPtr& _newSkeleton,
BodyNode* _newParent);
335 template <
class Jo
intType>
338 const typename JointType::Properties& _joint
339 =
typename JointType::Properties());
344 template <
class Jo
intType>
346 const SkeletonPtr& _newSkeleton,
348 const typename JointType::Properties& _joint
349 =
typename JointType::Properties());
361 SkeletonPtr
split(
const std::string& _skeletonName);
365 template <
class Jo
intType>
367 const std::string& _skeletonName,
368 const typename JointType::Properties& _joint
369 =
typename JointType::Properties());
375 template <
class Jo
intType>
377 const typename JointType::Properties& _joint
378 =
typename JointType::Properties());
388 std::pair<Joint*, BodyNode*>
copyTo(
389 BodyNode* _newParent,
bool _recursive =
true);
401 std::pair<Joint*, BodyNode*>
copyTo(
402 const SkeletonPtr& _newSkeleton,
404 bool _recursive =
true)
const;
408 template <
class Jo
intType>
409 std::pair<JointType*, BodyNode*>
copyTo(
411 const typename JointType::Properties& _joint
412 =
typename JointType::Properties(),
413 bool _recursive =
true);
417 template <
class Jo
intType>
418 std::pair<JointType*, BodyNode*>
copyTo(
419 const SkeletonPtr& _newSkeleton,
421 const typename JointType::Properties& _joint
422 =
typename JointType::Properties(),
423 bool _recursive =
true)
const;
430 const std::string& _skeletonName,
bool _recursive =
true)
const;
434 template <
class Jo
intType>
436 const std::string& _skeletonName,
437 const typename JointType::Properties& _joint
438 =
typename JointType::Properties(),
439 bool _recursive =
true)
const;
460 template <
class Jo
intType,
class NodeType = BodyNode>
462 const typename JointType::Properties& _jointProperties
463 =
typename JointType::Properties(),
464 const typename NodeType::Properties& _bodyProperties
465 =
typename NodeType::Properties());
486 template <
class NodeType,
typename... Args>
489 DART_BAKE_SPECIALIZED_NODE_DECLARATIONS(
ShapeNode)
492 template <
class ShapeNodeProperties>
498 ShapeNodeProperties properties,
bool automaticName =
true);
502 template <
class ShapeType>
506 template <
class ShapeType,
class StringType>
508 const std::shared_ptr<ShapeType>& shape, StringType&& name);
521 template <
class... Aspects>
525 template <
class... Aspects>
527 const ShapePtr& shape,
const std::string& name);
530 template <
class Aspect>
534 template <
class Aspect>
538 template <
class Aspect>
542 template <
class Aspect>
545 DART_BAKE_SPECIALIZED_NODE_DECLARATIONS(
EndEffector)
558 DART_BAKE_SPECIALIZED_NODE_DECLARATIONS(
Marker)
562 const std::string& name =
"marker",
563 const Eigen::Vector3d& position = Eigen::Vector3d::Zero(),
564 const Eigen::Vector4d& color = Eigen::Vector4d::Constant(1.0));
570 bool dependsOn(std::size_t _genCoordIndex)
const override;
594 const std::vector<const DegreeOfFreedom*>&
getDependentDofs()
const override;
597 const std::vector<const DegreeOfFreedom*>
getChainDofs()
const override;
621 const math::Jacobian&
getJacobian()
const override final;
681 const Eigen::Vector3d& _force,
682 const Eigen::Vector3d& _offset = Eigen::Vector3d::Zero(),
683 bool _isForceLocal =
false,
684 bool _isOffsetLocal =
true);
688 const Eigen::Vector3d& _force,
689 const Eigen::Vector3d& _offset = Eigen::Vector3d::Zero(),
690 bool _isForceLocal =
false,
691 bool _isOffsetLocal =
true);
696 void addExtTorque(
const Eigen::Vector3d& _torque,
bool _isLocal =
false);
701 void setExtTorque(
const Eigen::Vector3d& _torque,
bool _isLocal =
false);
715 const Eigen::Vector6d& getExternalForceLocal()
const;
718 Eigen::Vector6d getExternalForceGlobal()
const;
748 const Eigen::Vector3d& _constImp,
749 const Eigen::Vector3d& _offset,
750 bool _isImpulseLocal =
false,
751 bool _isOffsetLocal =
true);
786 const Eigen::Vector3d& _pivot = Eigen::Vector3d::Zero());
843 BodyNode(
const std::tuple<BodyNode*, Joint*, Properties>& args);
848 BodyNode* _parentBodyNode,
Joint* _parentJoint,
bool cloneNodes)
const;
854 virtual void init(
const SkeletonPtr& _skeleton);
888 const Eigen::Vector3d& _gravity,
double _timeStep);
910 const Eigen::Vector3d& _gravity,
bool _withExternalForces =
false);
930 double _timeStep,
bool _withDampingForces,
bool _withSpringForces);
934 double _timeStep,
bool _withDampingForces,
bool _withSpringForces);
950 virtual void updateMassMatrix();
951 virtual void aggregateMassMatrix(Eigen::MatrixXd& _MCol, std::size_t _col);
952 virtual void aggregateAugMassMatrix(
953 Eigen::MatrixXd& _MCol, std::size_t _col,
double _timeStep);
956 virtual void updateInvMassMatrix();
957 virtual void updateInvAugMassMatrix();
958 virtual void aggregateInvMassMatrix(
959 Eigen::MatrixXd& _InvMCol, std::size_t _col);
960 virtual void aggregateInvAugMassMatrix(
961 Eigen::MatrixXd& _InvMCol, std::size_t _col,
double _timeStep);
964 virtual void aggregateCoriolisForceVector(Eigen::VectorXd& _C);
967 virtual void aggregateGravityForceVector(
968 Eigen::VectorXd& _g,
const Eigen::Vector3d& _gravity);
971 virtual void updateCombinedVector();
972 virtual void aggregateCombinedVector(
973 Eigen::VectorXd& _Cg,
const Eigen::Vector3d& _gravity);
980 virtual void aggregateSpatialToGeneralized(
981 Eigen::VectorXd& _generalized,
const Eigen::Vector6d& _spatial);
1109 Eigen::Vector6d mCg_F;
1119 Eigen::Vector6d mM_F;
1123 Eigen::Vector6d mInvM_U;
1155 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
1176 std::shared_ptr<NodeDestructor> mSelfDestructor;
1178 DART_DECLARE_CLASS_WITH_VIRTUAL_BASE_END
1183 #include "dart/dynamics/detail/BodyNode.hpp" 1185 #endif // DART_DYNAMICS_BODYNODE_HPP_ ColShapeAddedSignal mColShapeAddedSignal
Collision shape added signal.
Definition: BodyNode.hpp:1145
Joint * mParentJoint
Parent joint.
Definition: BodyNode.hpp:1032
void setCollidable(bool _isCollidable)
Set whether this body node will collide with others in the world.
Definition: BodyNode.cpp:491
std::size_t getIndexInSkeleton() const
Return the index of this BodyNode within its Skeleton.
Definition: BodyNode.cpp:729
void setLocalCOM(const Eigen::Vector3d &_com)
Set center of mass expressed in body frame.
Definition: BodyNode.cpp:610
const Eigen::Isometry3d & getRelativeTransform() const override
Get the transform of this BodyNode with respect to its parent BodyNode, which is also its parent Fram...
Definition: BodyNode.cpp:1126
math::Jacobian mBodyJacobianSpatialDeriv
Spatial time derivative of body Jacobian.
Definition: BodyNode.hpp:1071
Eigen::Vector6d mM_dV
Cache data for mass matrix of the system.
Definition: BodyNode.hpp:1118
const math::Jacobian & getJacobianClassicDeriv() const override final
Return the classical time derivative of the generalized Jacobian targeting the origin of this BodyNod...
Definition: BodyNode.cpp:1186
virtual void updatePartialAcceleration() const
Update partial spatial body acceleration due to parent joint's velocity.
Definition: BodyNode.cpp:1639
math::Jacobian mBodyJacobian
Body Jacobian.
Definition: BodyNode.hpp:1061
std::vector< DegreeOfFreedom * > mDependentDofs
A version of mDependentGenCoordIndices that holds DegreeOfFreedom pointers instead of indices...
Definition: BodyNode.hpp:1049
Eigen::Vector6d mInvM_c
Cache data for inverse mass matrix of the system.
Definition: BodyNode.hpp:1122
class Joint
Definition: Joint.hpp:57
DegreeOfFreedom * getDependentDof(std::size_t _index) override
Get a pointer to the _indexth dependent DegreeOfFreedom for this BodyNode.
Definition: BodyNode.cpp:1077
Eigen::Vector6d mCg_dV
Cache data for combined vector of the system.
Definition: BodyNode.hpp:1108
const math::Inertia & getArticulatedInertiaImplicit() const
Return the articulated body inertia for implicit joint damping and spring forces. ...
Definition: BodyNode.cpp:600
virtual void updateAccelerationID()
Update spatial body acceleration with the partial spatial body acceleration for inverse dynamics...
Definition: BodyNode.cpp:1648
Eigen::Vector6d mFext_F
Cache data for external force vector of the system.
Definition: BodyNode.hpp:1115
SoftBodyNode represent a soft body that has one deformable skin.
Definition: SoftBodyNode.hpp:45
std::vector< std::size_t > mDependentGenCoordIndices
A increasingly sorted list of dependent dof indices.
Definition: BodyNode.hpp:1045
const Eigen::Vector6d & getPrimaryRelativeAcceleration() const override
The Featherstone ABI algorithm exploits a component of the spatial acceleration which we refer to as ...
Definition: BodyNode.cpp:1144
virtual BodyNode * clone(BodyNode *_parentBodyNode, Joint *_parentJoint, bool cloneNodes) const
Create a clone of this BodyNode.
Definition: BodyNode.cpp:1349
Eigen::Vector6d mPartialAcceleration
Partial spatial body acceleration due to parent joint's velocity.
Definition: BodyNode.hpp:1081
std::size_t getDependentGenCoordIndex(std::size_t _arrayIndex) const override
Return a generalized coordinate index from the array index (< getNumDependentDofs) ...
Definition: BodyNode.cpp:1057
JointType * changeParentJointType(const typename JointType::Properties &_joint=typename JointType::Properties())
Change the Joint type of this BodyNode's parent Joint.
Definition: BodyNode.hpp:81
BodyNode & operator=(const BodyNode &_otherBodyNode)
Same as copy(const BodyNode&)
Definition: BodyNode.cpp:379
virtual void updateAccelerationFD()
Update spatial body acceleration for forward dynamics.
Definition: BodyNode.cpp:1813
ShapeNode * createShapeNodeWith(const ShapePtr &shape)
Create a ShapeNode with the specified Aspects and an automatically assigned name: <BodyNodeName>_Shap...
Definition: BodyNode.hpp:185
void notifyArticulatedInertiaUpdate()
Notify the Skeleton that the tree of this BodyNode needs an articulated inertia update.
Definition: BodyNode.cpp:1584
Properties getBodyNodeProperties() const
Get the Properties of this BodyNode.
Definition: BodyNode.cpp:355
virtual void updateVelocity()
Update spatial body velocity.
Definition: BodyNode.cpp:1631
bool isReactive() const
Return true if the body can react to force or constraint impulse.
Definition: BodyNode.cpp:2040
virtual void updateTransform()
Update transformation.
Definition: BodyNode.cpp:1623
The Node class is a base class for BodyNode and any object that attaches to a BodyNode.
Definition: Node.hpp:79
BodyNode * mParentBodyNode
Parent body node.
Definition: BodyNode.hpp:1035
Definition: CompositeData.hpp:106
virtual void updateBiasImpulse()
Update bias impulse associated with the articulated body inertia for impulse-based forward dynamics...
Definition: BodyNode.cpp:1771
const Eigen::Vector6d & getRelativeSpatialVelocity() const override
Get the spatial velocity of this Frame relative to its parent Frame, in its own coordinates.
Definition: BodyNode.cpp:1132
virtual void clearConstraintImpulse()
Clear constraint impulses and cache data used for impulse-based forward dynamics algorithm.
Definition: BodyNode.cpp:1952
void dirtyArticulatedInertia()
Notify the Skeleton that the tree of this BodyNode needs an articulated inertia update.
Definition: BodyNode.cpp:1590
bool mIsColliding
Whether the node is currently in collision with another node.
Definition: BodyNode.hpp:1016
virtual void aggregateExternalForces(Eigen::VectorXd &_Fext)
Aggregate the external forces mFext in the generalized coordinates recursively.
Definition: BodyNode.cpp:2150
math::Jacobian mWorldJacobianClassicDeriv
Classic time derivative of Body Jacobian.
Definition: BodyNode.hpp:1076
const Eigen::Vector6d & getBodyVelocityChange() const
Return the velocity change due to the constraint impulse.
Definition: BodyNode.cpp:1195
const std::string & getName() const override
Get the name of this Node.
Definition: BodyNode.cpp:459
void notifyCoriolisUpdate()
Tell the Skeleton that the coriolis forces need to be update.
Definition: BodyNode.cpp:1610
The Frame class serves as the backbone of DART's kinematic tree structure.
Definition: Frame.hpp:57
std::vector< const DegreeOfFreedom * > mConstDependentDofs
Same as mDependentDofs, but holds const pointers.
Definition: BodyNode.hpp:1052
math::Jacobian mWorldJacobian
Cached World Jacobian.
Definition: BodyNode.hpp:1066
const math::Inertia & getArticulatedInertia() const
Return the articulated body inertia.
Definition: BodyNode.cpp:590
const Eigen::Vector6d & getPartialAcceleration() const override
Return the partial acceleration of this body.
Definition: BodyNode.cpp:1150
void dirtyVelocity() override
Notify the velocity updates of this Frame and all its children are needed.
Definition: BodyNode.cpp:1541
AllNodeProperties getAllNodeProperties() const
Get the Node::Properties of all Nodes attached to this BodyNode.
Definition: BodyNode.cpp:310
This is an alternative to EmbedStateAndProperties which allows your class to also inherit other Compo...
Definition: EmbeddedAspect.hpp:431
Entity class is a base class for any objects that exist in the kinematic tree structure of DART...
Definition: Entity.hpp:60
Eigen::Vector6d getCOMSpatialAcceleration() const
Return the acceleration of the center of mass expressed in coordinates of this BodyNode Frame and rel...
Definition: BodyNode.cpp:657
virtual void updateJointImpulseFD()
Update the joint impulse for forward dynamics.
Definition: BodyNode.cpp:1882
virtual void updateVelocityChangeFD()
Update spatical body velocity change for impluse-based forward dynamics.
Definition: BodyNode.cpp:1834
std::vector< BodyNode * > mChildBodyNodes
Array of child body nodes.
Definition: BodyNode.hpp:1038
const Eigen::Vector6d & getBodyForce() const
Get spatial body force transmitted from the parent joint.
Definition: BodyNode.cpp:1965
void setFrictionCoeff(double _coeff)
Set coefficient of friction in range of [0, ~].
Definition: BodyNode.cpp:670
double computeLagrangian(const Eigen::Vector3d &gravity) const
Return Lagrangian of this body.
Definition: BodyNode.cpp:1991
std::size_t getNumChildJoints() const
Return the number of child Joints.
Definition: BodyNode.cpp:934
virtual void clearExternalForces()
Clean up structures that store external forces: mContacts, mFext, mExtForceBody and mExtTorqueBody...
Definition: BodyNode.cpp:1901
const std::string & setName(const std::string &_name) override
Set name.
Definition: BodyNode.cpp:422
TemplatedJacobianNode provides a curiously recurring template pattern implementation of the various J...
Definition: TemplatedJacobianNode.hpp:50
Definition: Inertia.hpp:43
bool dependsOn(std::size_t _genCoordIndex) const override
Return true if _genCoordIndex-th generalized coordinate.
Definition: BodyNode.cpp:1042
bool mIsPartialAccelerationDirty
Is the partial acceleration vector dirty.
Definition: BodyNode.hpp:1085
virtual void updateTransmittedForceID(const Eigen::Vector3d &_gravity, bool _withExternalForces=false)
Update spatial body force for inverse dynamics.
Definition: BodyNode.cpp:1657
std::size_t getNumDependentDofs() const override
Same as getNumDependentGenCoords()
Definition: BodyNode.cpp:1071
common::SlotRegister< ColShapeAddedSignal > onColShapeAdded
Slot register for collision shape added signal.
Definition: BodyNode.hpp:1162
void updateWorldJacobian() const
Update the World Jacobian.
Definition: BodyNode.cpp:2441
std::size_t mTreeIndex
Index of this BodyNode's tree.
Definition: BodyNode.hpp:1029
void getMomentOfInertia(double &_Ixx, double &_Iyy, double &_Izz, double &_Ixy, double &_Ixz, double &_Iyz) const
Return moment of inertia defined around the center of mass.
Definition: BodyNode.cpp:542
virtual void updateTransmittedImpulse()
Update spatial body force for impulse-based forward dynamics.
Definition: BodyNode.cpp:1804
void setAllNodeProperties(const AllNodeProperties &properties)
Set the Node::Properties of all Nodes attached to this BodyNode.
Definition: BodyNode.cpp:303
Definition: Aspect.cpp:40
std::size_t getIndexInTree() const
Return the index of this BodyNode within its tree.
Definition: BodyNode.cpp:735
const std::vector< ShapeNode * > getShapeNodesWith()
Return the list of ShapeNodes containing given Aspect.
Definition: BodyNode.hpp:221
Eigen::Vector6d mBiasImpulse
Impulsive bias force due to external impulsive force exerted on bodies of the parent skeleton...
Definition: BodyNode.hpp:1135
void setMomentOfInertia(double _Ixx, double _Iyy, double _Izz, double _Ixy=0.0, double _Ixz=0.0, double _Iyz=0.0)
Set moment of inertia defined around the center of mass.
Definition: BodyNode.cpp:528
const std::vector< const DegreeOfFreedom * > getChainDofs() const override
Returns a DegreeOfFreedom vector containing the dofs that form a Chain leading up to this JacobianNod...
Definition: BodyNode.cpp:1103
bool isColliding()
Return whether this body node is set to be colliding with other objects.
Definition: BodyNode.cpp:1207
double getMass() const
Return the mass of the bodynode.
Definition: BodyNode.cpp:522
void removeAllShapeNodes()
Remove all ShapeNodes from this BodyNode.
Definition: BodyNode.cpp:986
void processNewEntity(Entity *_newChildEntity) override
Separate generic child Entities from child BodyNodes for more efficient update notices.
Definition: BodyNode.cpp:1445
common::SlotRegister< ColShapeRemovedSignal > onColShapeRemoved
Slot register for collision shape removed signal.
Definition: BodyNode.hpp:1165
void setMass(double mass)
Set the mass of the bodynode.
Definition: BodyNode.cpp:509
BodyNode * getChildBodyNode(std::size_t _index)
Return the _index-th child BodyNode of this BodyNode.
Definition: BodyNode.cpp:922
const Eigen::Vector3d & getLocalCOM() const
Return center of mass expressed in body frame.
Definition: BodyNode.cpp:618
ShapeNode * createShapeNode(ShapeNodeProperties properties, bool automaticName=true)
Create an ShapeNode attached to this BodyNode.
Definition: BodyNode.hpp:149
Eigen::Vector3d getLinearMomentum() const
Return linear momentum.
Definition: BodyNode.cpp:2024
void setAspectProperties(const AspectProperties &properties)
Set the AspectProperties of this BodyNode.
Definition: BodyNode.cpp:343
std::size_t getTreeIndex() const
Return the index of the tree that this BodyNode belongs to.
Definition: BodyNode.cpp:741
StructuralChangeSignal mStructuralChangeSignal
Structural change signal.
Definition: BodyNode.hpp:1151
void processRemovedEntity(Entity *_oldChildEntity) override
Remove this Entity from mChildBodyNodes or mNonBodyNodeEntities.
Definition: BodyNode.cpp:1490
Eigen::Vector6d mG_F
Cache data for gravity force vector of the system.
Definition: BodyNode.hpp:1112
virtual SoftBodyNode * asSoftBodyNode()
Convert 'this' into a SoftBodyNode pointer if this BodyNode is a SoftBodyNode, otherwise return nullp...
Definition: BodyNode.cpp:275
void addChildBodyNode(BodyNode *_body)
Add a child bodynode into the bodynode.
Definition: BodyNode.cpp:897
std::size_t mIndexInSkeleton
Index of this BodyNode in its Skeleton.
Definition: BodyNode.hpp:1023
void notifyExternalForcesUpdate()
Tell the Skeleton that the external forces need to be updated.
Definition: BodyNode.cpp:1598
const std::vector< ShapeNode * > getShapeNodes()
Return the list of ShapeNodes.
Definition: BodyNode.cpp:960
Definition: PointMass.hpp:50
Joint * getParentJoint()
Return the parent Joint of this BodyNode.
Definition: BodyNode.cpp:873
void copy(const BodyNode &otherBodyNode)
Copy the Properties of another BodyNode.
Definition: BodyNode.cpp:361
BodyNode * getParentBodyNode()
Return the parent BodyNdoe of this BodyNode.
Definition: BodyNode.cpp:885
virtual void updateConstrainedTerms(double _timeStep)
Update constrained terms due to the constraint impulses for foward dynamics.
Definition: BodyNode.cpp:1889
void setInertia(const Inertia &inertia)
Set the inertia data for this BodyNode.
Definition: BodyNode.cpp:566
double computePotentialEnergy(const Eigen::Vector3d &gravity) const
Return potential energy.
Definition: BodyNode.cpp:2018
SkeletonPtr split(const std::string &_skeletonName)
Remove this BodyNode and all of its children (recursively) from their current Skeleton and move them ...
Definition: BodyNode.cpp:812
bool isCollidable() const
Return true if this body can collide with others bodies.
Definition: BodyNode.cpp:485
void matchNodes(const BodyNode *otherBodyNode)
Make the Nodes of this BodyNode match the Nodes of otherBodyNode.
Definition: BodyNode.cpp:405
std::size_t getNumShapeNodesWith() const
Return the number of ShapeNodes containing given Aspect in this BodyNode.
Definition: BodyNode.hpp:205
void dirtyExternalForces()
Tell the Skeleton that the external forces need to be updated.
Definition: BodyNode.cpp:1604
std::pair< Joint *, BodyNode * > copyTo(BodyNode *_newParent, bool _recursive=true)
Create clones of this BodyNode and all of its children recursively (unless _recursive is set to false...
Definition: BodyNode.cpp:822
Marker * createMarker(const std::string &name="marker", const Eigen::Vector3d &position=Eigen::Vector3d::Zero(), const Eigen::Vector4d &color=Eigen::Vector4d::Constant(1.0))
Create a Marker with the given fields.
Definition: BodyNode.cpp:1022
virtual void updateBiasForce(const Eigen::Vector3d &_gravity, double _timeStep)
Update bias force associated with the articulated body inertia for forward dynamics.
Definition: BodyNode.cpp:1730
const math::Jacobian & getWorldJacobian() const override final
Return the generalized Jacobian targeting the origin of this BodyNode.
Definition: BodyNode.cpp:1168
Eigen::Vector3d getAngularMomentum(const Eigen::Vector3d &_pivot=Eigen::Vector3d::Zero())
Return angular momentum.
Definition: BodyNode.cpp:2031
SkeletonPtr copyAs(const std::string &_skeletonName, bool _recursive=true) const
Create clones of this BodyNode and all of its children (recursively) and create a new Skeleton with t...
Definition: BodyNode.cpp:850
Definition: ShapeNode.hpp:48
NodeType * createNode(Args &&... args)
Create some Node type and attach it to this BodyNode.
Definition: BodyNode.hpp:139
Eigen::Vector6d mBiasForce
Bias force.
Definition: BodyNode.hpp:1105
Eigen::Vector6d mDelV
Velocity change due to to external impulsive force exerted on bodies of the parent skeleton...
Definition: BodyNode.hpp:1131
Eigen::Vector6d mConstraintImpulse
Constraint impulse: contact impulse, dynamic joint impulse.
Definition: BodyNode.hpp:1138
EndEffector * createEndEffector(const EndEffector::BasicProperties &_properties)
Create an EndEffector attached to this BodyNode.
Definition: BodyNode.cpp:997
void setRestitutionCoeff(double _coeff)
Set coefficient of restitution in range of [0, 1].
Definition: BodyNode.cpp:699
void setGravityMode(bool _gravityMode)
Set whether gravity affects this body.
Definition: BodyNode.cpp:465
bool moveTo(BodyNode *_newParent)
Remove this BodyNode and all of its children (recursively) from their current parent BodyNode...
Definition: BodyNode.cpp:788
static std::size_t msBodyNodeCount
Counts the number of nodes globally.
Definition: BodyNode.hpp:1012
void addExtForce(const Eigen::Vector3d &_force, const Eigen::Vector3d &_offset=Eigen::Vector3d::Zero(), bool _isForceLocal=false, bool _isOffsetLocal=true)
Add applying linear Cartesian forces to this node.
Definition: BodyNode.cpp:1213
BodyNode class represents a single node of the skeleton.
Definition: BodyNode.hpp:74
DegreeOfFreedom class is a proxy class for accessing single degrees of freedom (aka generalized coord...
Definition: DegreeOfFreedom.hpp:54
Eigen::Vector6d getCOMSpatialVelocity() const
Return the spatial velocity of the center of mass, expressed in coordinates of this Frame and relativ...
Definition: BodyNode.cpp:637
std::set< Entity * > mNonBodyNodeEntities
Array of child Entities that are not BodyNodes.
Definition: BodyNode.hpp:1042
math::Inertia mArtInertia
Articulated body inertia.
Definition: BodyNode.hpp:1097
int mID
A unique ID of this node globally.
Definition: BodyNode.hpp:1009
common::SlotRegister< StructuralChangeSignal > onStructuralChange
Raised when (1) parent BodyNode is changed, (2) moved between Skeletons, (3) parent Joint is changed...
Definition: BodyNode.hpp:1169
Definition: Marker.hpp:46
Eigen::Vector6d mFgravity
Spatial gravity force.
Definition: BodyNode.hpp:1092
AllNodeStates getAllNodeStates() const
Get the Node::State of all Nodes attached to this BodyNode.
Definition: BodyNode.cpp:294
Joint * getChildJoint(std::size_t _index)
Return the _index-th child Joint of this BodyNode.
Definition: BodyNode.cpp:940
virtual void updateJointForceID(double _timeStep, bool _withDampingForces, bool _withSpringForces)
Update the joint force for inverse dynamics.
Definition: BodyNode.cpp:1864
Eigen::Vector6d mArbitrarySpatial
Cache data for arbitrary spatial value.
Definition: BodyNode.hpp:1126
void setExtForce(const Eigen::Vector3d &_force, const Eigen::Vector3d &_offset=Eigen::Vector3d::Zero(), bool _isForceLocal=false, bool _isOffsetLocal=true)
Set Applying linear Cartesian forces to this node.
Definition: BodyNode.cpp:1239
Eigen::Vector6d mF
Transmitted wrench from parent to the bodynode expressed in body-fixed frame.
Definition: BodyNode.hpp:1089
Declaration of the variadic template.
Definition: SpecializedNodeManager.hpp:49
std::pair< JointType *, NodeType * > createChildJointAndBodyNodePair(const typename JointType::Properties &_jointProperties=typename JointType::Properties(), const typename NodeType::Properties &_bodyProperties=typename NodeType::Properties())
Create a Joint and BodyNode pair as a child of this BodyNode.
Definition: BodyNode.hpp:129
const Inertia & getInertia() const
Get the inertia data for this BodyNode.
Definition: BodyNode.cpp:584
SlotRegister can be used as a public member for connecting slots to a private Signal member...
Definition: Signal.hpp:228
void removeAllShapeNodesWith()
Remove all ShapeNodes containing given Aspect from this BodyNode.
Definition: BodyNode.hpp:259
double getFrictionCoeff() const
Return frictional coefficient.
Definition: BodyNode.cpp:693
void setConstraintImpulse(const Eigen::Vector6d &_constImp)
Set constraint impulse.
Definition: BodyNode.cpp:1971
Definition: BodyNodePtr.hpp:53
void dirtyAcceleration() override
Notify the acceleration updates of this Frame and all its children are needed.
Definition: BodyNode.cpp:1568
const Eigen::Matrix6d & getSpatialInertia() const
Return spatial inertia.
Definition: BodyNode.cpp:560
const Eigen::Vector6d & getConstraintImpulse() const
Return constraint impulse.
Definition: BodyNode.cpp:1985
void setProperties(const CompositeProperties &_properties)
Same as setCompositeProperties()
Definition: BodyNode.cpp:321
double getRestitutionCoeff() const
Return coefficient of restitution.
Definition: BodyNode.cpp:723
math::Inertia mArtInertiaImplicit
Articulated body inertia for implicit joint damping and spring forces.
Definition: BodyNode.hpp:1102
const Eigen::Vector6d & getRelativeSpatialAcceleration() const override
Get the spatial acceleration of this Frame relative to its parent Frame, in the coordinates of this F...
Definition: BodyNode.cpp:1138
void dirtyCoriolisForces()
Tell the Skeleton that the coriolis forces need to be update.
Definition: BodyNode.cpp:1616
Eigen::Vector3d getCOMLinearVelocity(const Frame *_relativeTo=Frame::World(), const Frame *_inCoordinatesOf=Frame::World()) const
Return the linear velocity of the center of mass, expressed in terms of arbitrary Frames...
Definition: BodyNode.cpp:630
void duplicateNodes(const BodyNode *otherBodyNode)
Give this BodyNode a copy of each Node from otherBodyNode.
Definition: BodyNode.cpp:386
MapHolder is a templated wrapper class that is used to allow maps of Aspect::State and Aspect::Proper...
Definition: Cloneable.hpp:220
void updateWorldJacobianClassicDeriv() const
Update classic time derivative of body Jacobian.
Definition: BodyNode.cpp:2495
virtual void init(const SkeletonPtr &_skeleton)
Initialize the vector members with proper sizes.
Definition: BodyNode.cpp:1373
virtual double getKineticEnergy() const
Return kinetic energy.
Definition: BodyNode.cpp:1997
void setAllNodeStates(const AllNodeStates &states)
Set the Node::State of all Nodes attached to this BodyNode.
Definition: BodyNode.cpp:287
virtual void updateTransmittedForceFD()
Update spatial body force for forward dynamics.
Definition: BodyNode.cpp:1795
void addExtTorque(const Eigen::Vector3d &_torque, bool _isLocal=false)
Add applying Cartesian torque to the node.
Definition: BodyNode.cpp:1265
double computeKineticEnergy() const
Return kinetic energy.
Definition: BodyNode.cpp:2003
void updateBodyJacobianSpatialDeriv() const
Update spatial time derivative of body Jacobian.
Definition: BodyNode.cpp:2449
Node * cloneNode(BodyNode *bn) const override final
This is needed in order to inherit the Node class, but it does nothing.
Definition: BodyNode.cpp:1364
std::size_t getNumChildBodyNodes() const
Return the number of child BodyNodes.
Definition: BodyNode.cpp:916
class Skeleton
Definition: Skeleton.hpp:55
Definition: EndEffector.hpp:77
virtual void clearInternalForces()
Clear out the generalized forces of the parent Joint and any other forces related to this BodyNode th...
Definition: BodyNode.cpp:1908
virtual double getPotentialEnergy(const Eigen::Vector3d &_gravity) const
Return potential energy.
Definition: BodyNode.cpp:2012
virtual void updateJointForceFD(double _timeStep, bool _withDampingForces, bool _withSpringForces)
Update the joint force for forward dynamics.
Definition: BodyNode.cpp:1873
const math::Jacobian & getJacobianSpatialDeriv() const override final
Return the spatial time derivative of the generalized Jacobian targeting the origin of this BodyNode...
Definition: BodyNode.cpp:1177
Eigen::Vector6d mImpF
Generalized impulsive body force w.r.t. body frame.
Definition: BodyNode.hpp:1142
bool getGravityMode() const
Return true if gravity mode is enabled.
Definition: BodyNode.cpp:479
SkeletonPtr getSkeleton() override
Return the Skeleton that this Node is attached to.
Definition: BodyNode.cpp:861
void setExtTorque(const Eigen::Vector3d &_torque, bool _isLocal=false)
Set applying Cartesian torque to the node.
Definition: BodyNode.cpp:1277
const std::vector< DegreeOfFreedom * > & getDependentDofs() override
Return a std::vector of DegreeOfFreedom pointers that this Node depends on.
Definition: BodyNode.cpp:1091
Eigen::Vector3d getCOM(const Frame *_withRespectTo=Frame::World()) const
Return the center of mass with respect to an arbitrary Frame.
Definition: BodyNode.cpp:624
ColShapeRemovedSignal mColShapeRemovedSignal
Collision shape removed signal.
Definition: BodyNode.hpp:1148
virtual ~BodyNode()
Destructor.
Definition: BodyNode.cpp:265
Definition: CompositeData.hpp:185
const math::Jacobian & getJacobian() const override final
Return the generalized Jacobian targeting the origin of this BodyNode.
Definition: BodyNode.cpp:1159
std::size_t getNumDependentGenCoords() const override
The number of the generalized coordinates which affect this JacobianNode.
Definition: BodyNode.cpp:1051
const std::vector< std::size_t > & getDependentGenCoordIndices() const override
Indices of the generalized coordinates which affect this JacobianNode.
Definition: BodyNode.cpp:1065
void setColliding(bool _isColliding)
Set whether this body node is colliding with other objects.
Definition: BodyNode.cpp:1201
virtual void updateArtInertia(double _timeStep) const
Update articulated body inertia for forward dynamics.
Definition: BodyNode.cpp:1700
void dirtyTransform() override
Notify the transformation updates of this Frame and all its children are needed.
Definition: BodyNode.cpp:1509
std::size_t mIndexInTree
Index of this BodyNode in its Tree.
Definition: BodyNode.hpp:1026
void addConstraintImpulse(const Eigen::Vector6d &_constImp)
Add constraint impulse.
Definition: BodyNode.cpp:1978
void setAspectState(const AspectState &state)
Set the AspectState of this BodyNode.
Definition: BodyNode.cpp:333
Definition: BodyNodeAspect.hpp:64
void updateBodyJacobian() const
Update body Jacobian.
Definition: BodyNode.cpp:2400
Eigen::Vector3d getCOMLinearAcceleration(const Frame *_relativeTo=Frame::World(), const Frame *_inCoordinatesOf=Frame::World()) const
Return the linear acceleration of the center of mass, expressed in terms of arbitary Frames...
Definition: BodyNode.cpp:650