DART 6.10.1
Loading...
Searching...
No Matches
Skeleton.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2021, The DART development contributors
3 * All rights reserved.
4 *
5 * The list of contributors can be found at:
6 * https://github.com/dartsim/dart/blob/master/LICENSE
7 *
8 * This file is provided under the following "BSD-style" License:
9 * Redistribution and use in source and binary forms, with or
10 * without modification, are permitted provided that the following
11 * conditions are met:
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer in the documentation and/or other materials provided
17 * with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#ifndef DART_DYNAMICS_SKELETON_HPP_
34#define DART_DYNAMICS_SKELETON_HPP_
35
36#include <mutex>
49
50namespace dart {
51namespace dynamics {
52
55class Skeleton : public virtual common::VersionCounter,
56 public MetaSkeleton,
57 public SkeletonSpecializedFor<ShapeNode, EndEffector, Marker>,
59{
60public:
61 // Some of non-virtual functions of MetaSkeleton are hidden because of the
62 // functions of the same name in this class. We expose those functions as
63 // follows.
71
74
77
88
95 {
97 const Eigen::VectorXd& positions = Eigen::VectorXd(),
98 const Eigen::VectorXd& velocities = Eigen::VectorXd(),
99 const Eigen::VectorXd& accelerations = Eigen::VectorXd(),
100 const Eigen::VectorXd& forces = Eigen::VectorXd(),
101 const Eigen::VectorXd& commands = Eigen::VectorXd());
102
104 const std::vector<std::size_t>& indices,
105 const Eigen::VectorXd& positions = Eigen::VectorXd(),
106 const Eigen::VectorXd& velocities = Eigen::VectorXd(),
107 const Eigen::VectorXd& accelerations = Eigen::VectorXd(),
108 const Eigen::VectorXd& forces = Eigen::VectorXd(),
109 const Eigen::VectorXd& commands = Eigen::VectorXd());
110
113 std::vector<std::size_t> mIndices;
114
116 Eigen::VectorXd mPositions;
117
119 Eigen::VectorXd mVelocities;
120
122 Eigen::VectorXd mAccelerations;
123
125 Eigen::VectorXd mForces;
126
128 Eigen::VectorXd mCommands;
129
131 bool operator==(const Configuration& other) const;
132
134 bool operator!=(const Configuration& other) const;
135 };
136
137 //----------------------------------------------------------------------------
139 //----------------------------------------------------------------------------
140
142 static SkeletonPtr create(const std::string& _name = "Skeleton");
143
146
149
151 ConstSkeletonPtr getPtr() const;
152
156
160
162 std::mutex& getMutex() const;
163
165 std::unique_ptr<common::LockableReference> getLockableReference()
166 const override;
167
168 Skeleton(const Skeleton&) = delete;
169
171 virtual ~Skeleton();
172
174 Skeleton& operator=(const Skeleton& _other) = delete;
175
178 DART_DEPRECATED(6.7)
179 SkeletonPtr clone() const;
180 // TODO: In DART 7, change this function to override MetaSkeleton::clone()
181 // that returns MetaSkeletonPtr
182
185 DART_DEPRECATED(6.7)
186 SkeletonPtr clone(const std::string& cloneName) const;
187 // TODO: In DART 7, change this function to override MetaSkeleton::clone()
188 // that returns MetaSkeletonPtr
189
192
194 SkeletonPtr cloneSkeleton(const std::string& cloneName) const;
195
196 // Documentation inherited
198 const std::string& cloneName) const override;
199
201
202 //----------------------------------------------------------------------------
204 //----------------------------------------------------------------------------
205
207 void setConfiguration(const Configuration& configuration);
208
210 Configuration getConfiguration(int flags = CONFIG_ALL) const;
211
214 const std::vector<std::size_t>& indices, int flags = CONFIG_ALL) const;
215
217
218 //----------------------------------------------------------------------------
220 //----------------------------------------------------------------------------
221
223 void setState(const State& state);
224
226 State getState() const;
227
229
230 //----------------------------------------------------------------------------
232 //----------------------------------------------------------------------------
233
236
239
242
244 DART_DEPRECATED(6.0)
246
249
251 const std::string& setName(const std::string& _name) override;
252
254 const std::string& getName() const override;
255
258 DART_DEPRECATED(6.0)
260
262 DART_DEPRECATED(6.0)
264
266 void setSelfCollisionCheck(bool enable);
267
269 bool getSelfCollisionCheck() const;
270
273
276
278 bool isEnabledSelfCollisionCheck() const;
279
282 void setAdjacentBodyCheck(bool enable);
283
285 bool getAdjacentBodyCheck() const;
286
290
294
296 bool isEnabledAdjacentBodyCheck() const;
297
300 void setMobile(bool _isMobile);
301
304 bool isMobile() const;
305
308 void setTimeStep(double _timeStep);
309
311 double getTimeStep() const;
312
315 void setGravity(const Eigen::Vector3d& _gravity);
316
318 const Eigen::Vector3d& getGravity() const;
319
321
322 //----------------------------------------------------------------------------
324 //----------------------------------------------------------------------------
325
328 template <class JointType, class NodeType = BodyNode>
329 std::pair<JointType*, NodeType*> createJointAndBodyNodePair(
330 BodyNode* _parent = nullptr,
331 const typename JointType::Properties& _jointProperties
332 = typename JointType::Properties(),
333 const typename NodeType::Properties& _bodyProperties
334 = typename NodeType::Properties());
335
336 // Documentation inherited
337 std::size_t getNumBodyNodes() const override;
338
340 std::size_t getNumRigidBodyNodes() const;
341
343 std::size_t getNumSoftBodyNodes() const;
344
346 std::size_t getNumTrees() const;
347
349 BodyNode* getRootBodyNode(std::size_t _treeIdx = 0);
350
353 const BodyNode* getRootBodyNode(std::size_t _treeIdx = 0) const;
354
356 Joint* getRootJoint(std::size_t treeIdx = 0u);
357
360 const Joint* getRootJoint(std::size_t treeIdx = 0u) const;
361
362 // Documentation inherited
363 BodyNode* getBodyNode(std::size_t _idx) override;
364
365 // Documentation inherited
366 const BodyNode* getBodyNode(std::size_t _idx) const override;
367
369 SoftBodyNode* getSoftBodyNode(std::size_t _idx);
370
372 const SoftBodyNode* getSoftBodyNode(std::size_t _idx) const;
373
374 // Documentation inherited
375 BodyNode* getBodyNode(const std::string& name) override;
376
377 // Documentation inherited
378 const BodyNode* getBodyNode(const std::string& name) const override;
379
381 SoftBodyNode* getSoftBodyNode(const std::string& _name);
382
384 const SoftBodyNode* getSoftBodyNode(const std::string& _name) const;
385
386 // Documentation inherited
387 const std::vector<BodyNode*>& getBodyNodes() override;
388
389 // Documentation inherited
390 const std::vector<const BodyNode*>& getBodyNodes() const override;
391
397 std::vector<BodyNode*> getBodyNodes(const std::string& name) override;
398
404 std::vector<const BodyNode*> getBodyNodes(
405 const std::string& name) const override;
406
407 // Documentation inherited
408 bool hasBodyNode(const BodyNode* bodyNode) const override;
409
410 // Documentation inherited
411 std::size_t getIndexOf(
412 const BodyNode* _bn, bool _warning = true) const override;
413
415 const std::vector<BodyNode*>& getTreeBodyNodes(std::size_t _treeIdx);
416
418 std::vector<const BodyNode*> getTreeBodyNodes(std::size_t _treeIdx) const;
419
420 // Documentation inherited
421 std::size_t getNumJoints() const override;
422
423 // Documentation inherited
424 Joint* getJoint(std::size_t _idx) override;
425
426 // Documentation inherited
427 const Joint* getJoint(std::size_t _idx) const override;
428
429 // Documentation inherited
430 Joint* getJoint(const std::string& name) override;
431
432 // Documentation inherited
433 const Joint* getJoint(const std::string& name) const override;
434
435 // Documentation inherited
436 std::vector<Joint*> getJoints() override;
437
438 // Documentation inherited
439 std::vector<const Joint*> getJoints() const override;
440
445 std::vector<Joint*> getJoints(const std::string& name) override;
446
451 std::vector<const Joint*> getJoints(const std::string& name) const override;
452
453 // Documentation inherited
454 bool hasJoint(const Joint* joint) const override;
455
456 // Documentation inherited
457 std::size_t getIndexOf(
458 const Joint* _joint, bool _warning = true) const override;
459
460 // Documentation inherited
461 std::size_t getNumDofs() const override;
462
463 // Documentation inherited
464 DegreeOfFreedom* getDof(std::size_t _idx) override;
465
466 // Documentation inherited
467 const DegreeOfFreedom* getDof(std::size_t _idx) const override;
468
470 DegreeOfFreedom* getDof(const std::string& _name);
471
473 const DegreeOfFreedom* getDof(const std::string& _name) const;
474
475 // Documentation inherited
476 const std::vector<DegreeOfFreedom*>& getDofs() override;
477
478 // Documentation inherited
479 std::vector<const DegreeOfFreedom*> getDofs() const override;
480
481 // Documentation inherited
482 std::size_t getIndexOf(
483 const DegreeOfFreedom* _dof, bool _warning = true) const override;
484
486 const std::vector<DegreeOfFreedom*>& getTreeDofs(std::size_t _treeIdx);
487
489 const std::vector<const DegreeOfFreedom*>& getTreeDofs(
490 std::size_t _treeIdx) const;
491
495 bool checkIndexingConsistency() const;
496
500 const std::shared_ptr<WholeBodyIK>& getIK(bool _createIfNull = false);
501
505 const std::shared_ptr<WholeBodyIK>& getOrCreateIK();
506
510 std::shared_ptr<const WholeBodyIK> getIK() const;
511
515 const std::shared_ptr<WholeBodyIK>& createIK();
516
519 void clearIK();
520
522
524
526
528
529 //----------------------------------------------------------------------------
530 // Integration and finite difference
531 //----------------------------------------------------------------------------
532
533 // Documentation inherited
534 void integratePositions(double _dt);
535
536 // Documentation inherited
537 void integrateVelocities(double _dt);
538
544 const Eigen::VectorXd& _q2, const Eigen::VectorXd& _q1) const;
545
550 const Eigen::VectorXd& _dq2, const Eigen::VectorXd& _dq1) const;
551
552 //----------------------------------------------------------------------------
554 //----------------------------------------------------------------------------
555
559 const math::SupportPolygon& getSupportPolygon() const;
560
563 const math::SupportPolygon& getSupportPolygon(std::size_t _treeIdx) const;
564
567 const std::vector<std::size_t>& getSupportIndices() const;
568
571 const std::vector<std::size_t>& getSupportIndices(std::size_t _treeIdx) const;
572
577 const std::pair<Eigen::Vector3d, Eigen::Vector3d>& getSupportAxes() const;
578
581 const std::pair<Eigen::Vector3d, Eigen::Vector3d>& getSupportAxes(
582 std::size_t _treeIdx) const;
583
586 const Eigen::Vector2d& getSupportCentroid() const;
587
591 const Eigen::Vector2d& getSupportCentroid(std::size_t _treeIdx) const;
592
598 std::size_t getSupportVersion() const;
599
602 std::size_t getSupportVersion(std::size_t _treeIdx) const;
603
605
606 //----------------------------------------------------------------------------
607 // Kinematics algorithms
608 //----------------------------------------------------------------------------
609
639 bool _updateTransforms = true,
640 bool _updateVels = true,
641 bool _updateAccs = true);
642
643 //----------------------------------------------------------------------------
644 // Dynamics algorithms
645 //----------------------------------------------------------------------------
646
649
677 bool _withExternalForces = false,
678 bool _withDampingForces = false,
679 bool _withSpringForces = false);
680
681 //----------------------------------------------------------------------------
682 // Impulse-based dynamics algorithms
683 //----------------------------------------------------------------------------
684
689
691 void updateBiasImpulse(BodyNode* _bodyNode);
692
696 void updateBiasImpulse(BodyNode* _bodyNode, const Eigen::Vector6d& _imp);
697
704 BodyNode* _bodyNode1,
705 const Eigen::Vector6d& _imp1,
706 BodyNode* _bodyNode2,
707 const Eigen::Vector6d& _imp2);
708
711 SoftBodyNode* _softBodyNode,
712 PointMass* _pointMass,
713 const Eigen::Vector3d& _imp);
714
718
719 // TODO(JS): Better naming
722 void setImpulseApplied(bool _val);
723
725 bool isImpulseApplied() const;
726
729
730 //----------------------------------------------------------------------------
732 //----------------------------------------------------------------------------
733
734 // Documentation inherited
735 math::Jacobian getJacobian(const JacobianNode* _node) const override;
736
737 // Documentation inherited
738 math::Jacobian getJacobian(
739 const JacobianNode* _node, const Frame* _inCoordinatesOf) const override;
740
741 // Documentation inherited
742 math::Jacobian getJacobian(
743 const JacobianNode* _node,
744 const Eigen::Vector3d& _localOffset) const override;
745
746 // Documentation inherited
747 math::Jacobian getJacobian(
748 const JacobianNode* _node,
749 const Eigen::Vector3d& _localOffset,
750 const Frame* _inCoordinatesOf) const override;
751
752 // Documentation inherited
753 math::Jacobian getWorldJacobian(const JacobianNode* _node) const override;
754
755 // Documentation inherited
756 math::Jacobian getWorldJacobian(
757 const JacobianNode* _node,
758 const Eigen::Vector3d& _localOffset) const override;
759
760 // Documentation inherited
761 math::LinearJacobian getLinearJacobian(
762 const JacobianNode* _node,
763 const Frame* _inCoordinatesOf = Frame::World()) const override;
764
765 // Documentation inherited
766 math::LinearJacobian getLinearJacobian(
767 const JacobianNode* _node,
768 const Eigen::Vector3d& _localOffset,
769 const Frame* _inCoordinatesOf = Frame::World()) const override;
770
771 // Documentation inherited
772 math::AngularJacobian getAngularJacobian(
773 const JacobianNode* _node,
774 const Frame* _inCoordinatesOf = Frame::World()) const override;
775
776 // Documentation inherited
777 math::Jacobian getJacobianSpatialDeriv(
778 const JacobianNode* _node) const override;
779
780 // Documentation inherited
781 math::Jacobian getJacobianSpatialDeriv(
782 const JacobianNode* _node, const Frame* _inCoordinatesOf) const override;
783
784 // Documentation inherited
785 math::Jacobian getJacobianSpatialDeriv(
786 const JacobianNode* _node,
787 const Eigen::Vector3d& _localOffset) const override;
788
789 // Documentation inherited
790 math::Jacobian getJacobianSpatialDeriv(
791 const JacobianNode* _node,
792 const Eigen::Vector3d& _localOffset,
793 const Frame* _inCoordinatesOf) const override;
794
795 // Documentation inherited
796 math::Jacobian getJacobianClassicDeriv(
797 const JacobianNode* _node) const override;
798
799 // Documentation inherited
800 math::Jacobian getJacobianClassicDeriv(
801 const JacobianNode* _node, const Frame* _inCoordinatesOf) const override;
802
803 // Documentation inherited
804 math::Jacobian getJacobianClassicDeriv(
805 const JacobianNode* _node,
806 const Eigen::Vector3d& _localOffset,
807 const Frame* _inCoordinatesOf = Frame::World()) const override;
808
809 // Documentation inherited
810 math::LinearJacobian getLinearJacobianDeriv(
811 const JacobianNode* _node,
812 const Frame* _inCoordinatesOf = Frame::World()) const override;
813
814 // Documentation inherited
815 math::LinearJacobian getLinearJacobianDeriv(
816 const JacobianNode* _node,
817 const Eigen::Vector3d& _localOffset,
818 const Frame* _inCoordinatesOf = Frame::World()) const override;
819
820 // Documentation inherited
821 math::AngularJacobian getAngularJacobianDeriv(
822 const JacobianNode* _node,
823 const Frame* _inCoordinatesOf = Frame::World()) const override;
824
826
827 //----------------------------------------------------------------------------
829 //----------------------------------------------------------------------------
830
834 double getMass() const override;
835
837 const Eigen::MatrixXd& getMassMatrix(std::size_t _treeIdx) const;
838
839 // Documentation inherited
840 const Eigen::MatrixXd& getMassMatrix() const override;
841
843 const Eigen::MatrixXd& getAugMassMatrix(std::size_t _treeIdx) const;
844
845 // Documentation inherited
846 const Eigen::MatrixXd& getAugMassMatrix() const override;
847
849 const Eigen::MatrixXd& getInvMassMatrix(std::size_t _treeIdx) const;
850
851 // Documentation inherited
852 const Eigen::MatrixXd& getInvMassMatrix() const override;
853
855 const Eigen::MatrixXd& getInvAugMassMatrix(std::size_t _treeIdx) const;
856
857 // Documentation inherited
858 const Eigen::MatrixXd& getInvAugMassMatrix() const override;
859
861 const Eigen::VectorXd& getCoriolisForces(std::size_t _treeIdx) const;
862
863 // Documentation inherited
864 const Eigen::VectorXd& getCoriolisForces() const override;
865
867 const Eigen::VectorXd& getGravityForces(std::size_t _treeIdx) const;
868
869 // Documentation inherited
870 const Eigen::VectorXd& getGravityForces() const override;
871
873 const Eigen::VectorXd& getCoriolisAndGravityForces(
874 std::size_t _treeIdx) const;
875
876 // Documentation inherited
877 const Eigen::VectorXd& getCoriolisAndGravityForces() const override;
878
880 const Eigen::VectorXd& getExternalForces(std::size_t _treeIdx) const;
881
882 // Documentation inherited
883 const Eigen::VectorXd& getExternalForces() const override;
884
886 // const Eigen::VectorXd& getDampingForceVector();
887
889 const Eigen::VectorXd& getConstraintForces(std::size_t _treeIdx) const;
890
892 const Eigen::VectorXd& getConstraintForces() const override;
893
894 // Documentation inherited
895 void clearExternalForces() override;
896
897 // Documentation inherited
898 void clearInternalForces() override;
899
902 DART_DEPRECATED(6.2)
903 void notifyArticulatedInertiaUpdate(std::size_t _treeIdx);
904
907 void dirtyArticulatedInertia(std::size_t _treeIdx);
908
910 DART_DEPRECATED(6.2)
911 void notifySupportUpdate(std::size_t _treeIdx);
912
914 void dirtySupportPolygon(std::size_t _treeIdx);
915
916 // Documentation inherited
917 double computeKineticEnergy() const override;
918
919 // Documentation inherited
920 double computePotentialEnergy() const override;
921
922 // Documentation inherited
923 DART_DEPRECATED(6.0)
924 void clearCollidingBodies() override;
925
927
928 //----------------------------------------------------------------------------
930 //----------------------------------------------------------------------------
931
933 Eigen::Vector3d getCOM(
934 const Frame* _withRespectTo = Frame::World()) const override;
935
939 const Frame* _relativeTo = Frame::World(),
940 const Frame* _inCoordinatesOf = Frame::World()) const override;
941
944 Eigen::Vector3d getCOMLinearVelocity(
945 const Frame* _relativeTo = Frame::World(),
946 const Frame* _inCoordinatesOf = Frame::World()) const override;
947
951 const Frame* _relativeTo = Frame::World(),
952 const Frame* _inCoordinatesOf = Frame::World()) const override;
953
957 const Frame* _relativeTo = Frame::World(),
958 const Frame* _inCoordinatesOf = Frame::World()) const override;
959
962 math::Jacobian getCOMJacobian(
963 const Frame* _inCoordinatesOf = Frame::World()) const override;
964
967 math::LinearJacobian getCOMLinearJacobian(
968 const Frame* _inCoordinatesOf = Frame::World()) const override;
969
976 math::Jacobian getCOMJacobianSpatialDeriv(
977 const Frame* _inCoordinatesOf = Frame::World()) const override;
978
985 math::LinearJacobian getCOMLinearJacobianDeriv(
986 const Frame* _inCoordinatesOf = Frame::World()) const override;
987
989
990 //----------------------------------------------------------------------------
991 // Friendship
992 //----------------------------------------------------------------------------
993 friend class BodyNode;
994 friend class SoftBodyNode;
995 friend class Joint;
996 template <class>
997 friend class GenericJoint;
998 friend class DegreeOfFreedom;
999 friend class Node;
1000 friend class ShapeNode;
1001 friend class EndEffector;
1002
1003protected:
1004 struct DataCache;
1005
1007 Skeleton(const AspectPropertiesData& _properties);
1008
1010 void setPtr(const SkeletonPtr& _ptr);
1011
1013 void constructNewTree();
1014
1016 void registerBodyNode(BodyNode* _newBodyNode);
1017
1019 void registerJoint(Joint* _newJoint);
1020
1022 void registerNode(NodeMap& nodeMap, Node* _newNode, std::size_t& _index);
1023
1025 void registerNode(Node* _newNode);
1026
1028 void destructOldTree(std::size_t tree);
1029
1031 void unregisterBodyNode(BodyNode* _oldBodyNode);
1032
1034 void unregisterJoint(Joint* _oldJoint);
1035
1037 void unregisterNode(NodeMap& nodeMap, Node* _oldNode, std::size_t& _index);
1038
1040 void unregisterNode(Node* _oldNode);
1041
1043 bool moveBodyNodeTree(
1044 Joint* _parentJoint,
1045 BodyNode* _bodyNode,
1046 SkeletonPtr _newSkeleton,
1047 BodyNode* _parentNode);
1048
1053 template <class JointType>
1054 JointType* moveBodyNodeTree(
1055 BodyNode* _bodyNode,
1056 const SkeletonPtr& _newSkeleton,
1057 BodyNode* _parentNode,
1058 const typename JointType::Properties& _joint);
1059
1063 Joint* _parentJoint,
1064 const BodyNode* _bodyNode,
1065 const SkeletonPtr& _newSkeleton,
1066 BodyNode* _parentNode,
1067 bool _recursive) const;
1068
1071 template <class JointType>
1072 std::pair<JointType*, BodyNode*> cloneBodyNodeTree(
1073 const BodyNode* _bodyNode,
1074 const SkeletonPtr& _newSkeleton,
1075 BodyNode* _parentNode,
1076 const typename JointType::Properties& _joint,
1077 bool _recursive) const;
1078
1080 std::vector<const BodyNode*> constructBodyNodeTree(
1081 const BodyNode* _bodyNode) const;
1082
1083 std::vector<BodyNode*> constructBodyNodeTree(BodyNode* _bodyNode);
1084
1087 std::vector<BodyNode*> extractBodyNodeTree(BodyNode* _bodyNode);
1088
1090 void receiveBodyNodeTree(const std::vector<BodyNode*>& _tree);
1091
1093 void updateTotalMass();
1094
1096 void updateCacheDimensions(DataCache& _cache);
1097
1099 void updateCacheDimensions(std::size_t _treeIdx);
1100
1102 void updateArticulatedInertia(std::size_t _tree) const;
1103
1105 void updateArticulatedInertia() const;
1106
1108 void updateMassMatrix(std::size_t _treeIdx) const;
1109
1111 void updateMassMatrix() const;
1112
1113 void updateAugMassMatrix(std::size_t _treeIdx) const;
1114
1116 void updateAugMassMatrix() const;
1117
1119 void updateInvMassMatrix(std::size_t _treeIdx) const;
1120
1122 void updateInvMassMatrix() const;
1123
1125 void updateInvAugMassMatrix(std::size_t _treeIdx) const;
1126
1128 void updateInvAugMassMatrix() const;
1129
1131 void updateCoriolisForces(std::size_t _treeIdx) const;
1132
1134 void updateCoriolisForces() const;
1135
1137 void updateGravityForces(std::size_t _treeIdx) const;
1138
1140 void updateGravityForces() const;
1141
1143 void updateCoriolisAndGravityForces(std::size_t _treeIdx) const;
1144
1146 void updateCoriolisAndGravityForces() const;
1147
1149 void updateExternalForces(std::size_t _treeIdx) const;
1150
1151 // TODO(JS): Not implemented yet
1153 void updateExternalForces() const;
1154
1156 const Eigen::VectorXd& computeConstraintForces(DataCache& cache) const;
1157
1158 // /// Update damping force vector.
1159 // virtual void updateDampingForceVector();
1160
1162 const std::string& addEntryToBodyNodeNameMgr(BodyNode* _newNode);
1163
1165 const std::string& addEntryToJointNameMgr(
1166 Joint* _newJoint, bool _updateDofNames = true);
1167
1170
1172
1173protected:
1175 std::weak_ptr<Skeleton> mPtr;
1176
1179
1181 dart::common::NameManager<BodyNode*> mNameMgrForBodyNodes;
1182
1184 dart::common::NameManager<Joint*> mNameMgrForJoints;
1185
1187 dart::common::NameManager<DegreeOfFreedom*> mNameMgrForDofs;
1188
1191
1194
1196 {
1198 DirtyFlags();
1199
1202
1205
1208
1211
1214
1217
1220
1223
1226
1229
1232
1235 std::size_t mSupportVersion;
1236 };
1237
1239 {
1241
1243 std::vector<BodyNode*> mBodyNodes;
1244
1246 std::vector<const BodyNode*> mConstBodyNodes;
1247
1249 std::vector<DegreeOfFreedom*> mDofs;
1250
1252 std::vector<const DegreeOfFreedom*> mConstDofs;
1253
1255 Eigen::MatrixXd mM;
1256
1258 Eigen::MatrixXd mAugM;
1259
1261 Eigen::MatrixXd mInvM;
1262
1264 Eigen::MatrixXd mInvAugM;
1265
1267 Eigen::VectorXd mCvec;
1268
1271 Eigen::VectorXd mG;
1272
1274 Eigen::VectorXd mCg;
1275
1277 Eigen::VectorXd mFext;
1278
1280 Eigen::VectorXd mFc;
1281
1284
1287 std::vector<std::size_t> mSupportIndices;
1288
1291 std::pair<Eigen::Vector3d, Eigen::Vector3d> mSupportAxes;
1292
1295
1297 Eigen::Vector2d mSupportCentroid;
1298
1299 // To get byte-aligned Eigen vectors
1300 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
1301 };
1302
1304
1306
1308 = std::map<std::type_index, std::vector<NodeMap::iterator>*>;
1309
1311
1314
1315 // TODO(JS): Better naming
1318
1319 mutable std::mutex mMutex;
1320
1321public:
1322 //--------------------------------------------------------------------------
1323 // Union finding
1324 //--------------------------------------------------------------------------
1327 {
1329 mUnionSize = 1;
1330 }
1331
1333 std::weak_ptr<Skeleton> mUnionRootSkeleton;
1334
1336 std::size_t mUnionSize;
1337
1339 std::size_t mUnionIndex;
1340};
1342
1343} // namespace dynamics
1344} // namespace dart
1345
1347
1348#endif // DART_DYNAMICS_SKELETON_HPP_
#define DART_BAKE_SPECIALIZED_NODE_SKEL_DECLARATIONS(AspectName)
Definition BasicNodeManager.hpp:349
#define DART_DECLARE_CLASS_WITH_VIRTUAL_BASE_END
Definition ClassWithVirtualBase.hpp:44
#define DART_DECLARE_CLASS_WITH_VIRTUAL_BASE_BEGIN
Definition ClassWithVirtualBase.hpp:43
#define DART_DEPRECATED(version)
Definition Deprecated.hpp:51
BodyPropPtr properties
Definition SdfParser.cpp:80
std::string * name
Definition SkelParser.cpp:1697
detail::CompositeState State
Definition Composite.hpp:55
detail::CompositeProperties Properties
Definition Composite.hpp:56
This is an alternative to EmbedProperties which allows your class to also inherit other Composite obj...
Definition EmbeddedAspect.hpp:240
The MakeCloneable class is used to easily create an Cloneable (such as Node::State) which simply take...
Definition Cloneable.hpp:84
VersionCounter is an interface for objects that count their versions.
Definition VersionCounter.hpp:43
Definition CompositeData.hpp:107
BodyNode class represents a single node of the skeleton.
Definition BodyNode.hpp:79
DegreeOfFreedom class is a proxy class for accessing single degrees of freedom (aka generalized coord...
Definition DegreeOfFreedom.hpp:55
Definition EndEffector.hpp:81
The Frame class serves as the backbone of DART's kinematic tree structure.
Definition Frame.hpp:58
Definition GenericJoint.hpp:48
The JacobianNode class serves as a common interface for BodyNodes and EndEffectors to both be used as...
Definition JacobianNode.hpp:55
class Joint
Definition Joint.hpp:60
Definition Marker.hpp:50
MetaSkeleton is a pure abstract base class that provides a common interface for obtaining data (such ...
Definition MetaSkeleton.hpp:62
virtual math::LinearJacobian getLinearJacobianDeriv(const JacobianNode *_node, const Frame *_inCoordinatesOf=Frame::World()) const =0
of a BodyNode.
virtual math::LinearJacobian getLinearJacobian(const JacobianNode *_node, const Frame *_inCoordinatesOf=Frame::World()) const =0
Get the linear Jacobian targeting the origin of a BodyNode.
virtual math::AngularJacobian getAngularJacobianDeriv(const JacobianNode *_node, const Frame *_inCoordinatesOf=Frame::World()) const =0
Get the angular Jacobian time derivative of a BodyNode.
virtual math::Jacobian getJacobianClassicDeriv(const JacobianNode *_node) const =0
Get the spatial Jacobian (classical) time derivative targeting the origin of a BodyNode.
virtual math::Jacobian getJacobian(const JacobianNode *_node) const =0
Get the spatial Jacobian targeting the origin of a BodyNode.
MetaSkeletonPtr cloneMetaSkeleton() const
Creates an identical clone of this MetaSkeleton.
Definition MetaSkeleton.cpp:328
virtual math::AngularJacobian getAngularJacobian(const JacobianNode *_node, const Frame *_inCoordinatesOf=Frame::World()) const =0
Get the angular Jacobian of a BodyNode.
virtual math::Jacobian getJacobianSpatialDeriv(const JacobianNode *_node) const =0
Get the spatial Jacobian time derivative targeting the origin of a BodyNode.
The Node class is a base class for BodyNode and any object that attaches to a BodyNode.
Definition Node.hpp:81
Definition PointMass.hpp:51
Definition ShapeNode.hpp:49
Declaration of the variadic template.
Definition SpecializedNodeManager.hpp:124
class Skeleton
Definition Skeleton.hpp:59
Skeleton(const Skeleton &)=delete
void computeForwardDynamics()
Compute forward dynamics.
Definition Skeleton.cpp:3728
const std::vector< BodyNode * > & getBodyNodes() override
Get all the BodyNodes that are held by this MetaSkeleton.
Definition Skeleton.cpp:984
void updateInvAugMassMatrix() const
Update inverse of augmented mass matrix of the skeleton.
Definition Skeleton.cpp:3198
SoftBodyNode * getSoftBodyNode(std::size_t _idx)
Get SoftBodyNode whose index is _idx.
Definition Skeleton.cpp:935
State getState() const
Get the State of this Skeleton [alias for getCompositeState()].
Definition Skeleton.cpp:619
dart::common::NameManager< BodyNode * > mNameMgrForBodyNodes
NameManager for tracking BodyNodes.
Definition Skeleton.hpp:1181
const Eigen::MatrixXd & getMassMatrix() const override
Get the Mass Matrix of the MetaSkeleton.
Definition Skeleton.cpp:1978
SpecializedTreeNodes mSpecializedTreeNodes
Definition Skeleton.hpp:1310
dart::common::NameManager< SoftBodyNode * > mNameMgrForSoftBodyNodes
NameManager for tracking SoftBodyNodes.
Definition Skeleton.hpp:1190
void registerJoint(Joint *_newJoint)
Register a Joint with the Skeleton. Internal use only.
Definition Skeleton.cpp:2276
ConfigFlags
Definition Skeleton.hpp:79
@ CONFIG_FORCES
Definition Skeleton.hpp:84
@ CONFIG_VELOCITIES
Definition Skeleton.hpp:82
@ CONFIG_COMMANDS
Definition Skeleton.hpp:85
@ CONFIG_NOTHING
Definition Skeleton.hpp:80
@ CONFIG_ALL
Definition Skeleton.hpp:86
@ CONFIG_POSITIONS
Definition Skeleton.hpp:81
@ CONFIG_ACCELERATIONS
Definition Skeleton.hpp:83
void updateCoriolisAndGravityForces() const
Update combined vector of the skeleton.
Definition Skeleton.cpp:3378
double getMass() const override
Get total mass of the skeleton.
Definition Skeleton.cpp:1964
DegreeOfFreedom * getDof(std::size_t _idx) override
Get degree of freedom (aka generalized coordinate) whose index is _idx.
Definition Skeleton.cpp:1207
std::pair< JointType *, NodeType * > createJointAndBodyNodePair(BodyNode *_parent=nullptr, const typename JointType::Properties &_jointProperties=typename JointType::Properties(), const typename NodeType::Properties &_bodyProperties=typename NodeType::Properties())
Create a Joint and child BodyNode pair of the given types.
Definition Skeleton.hpp:77
void disableSelfCollisionCheck()
Disable self-collision check.
Definition Skeleton.cpp:766
bool isEnabledAdjacentBodyCheck() const
Return true if self-collision check is enabled including adjacent bodies.
Definition Skeleton.cpp:802
void setProperties(const Properties &properties)
Set all properties of this Skeleton.
Definition Skeleton.cpp:625
std::shared_ptr< const WholeBodyIK > getIK() const
Get a pointer to a WholeBodyIK module for this Skeleton.
Definition Skeleton.cpp:1531
void dirtyArticulatedInertia(std::size_t _treeIdx)
Notify that the articulated inertia and everything that depends on it needs to be updated.
Definition Skeleton.cpp:3789
std::size_t getIndexOf(const BodyNode *_bn, bool _warning=true) const override
Get the index of a specific BodyNode within this ReferentialSkeleton.
Definition Skeleton.cpp:1065
bool isMobile() const
Get whether this skeleton will be updated by forward dynamics.
Definition Skeleton.cpp:814
void updateCoriolisForces() const
Update Coriolis force vector of the skeleton.
Definition Skeleton.cpp:3265
void clearExternalForces() override
Clear the external forces of the BodyNodes in this MetaSkeleton.
Definition Skeleton.cpp:3769
void setImpulseApplied(bool _val)
Set whether this skeleton is constrained.
Definition Skeleton.cpp:3991
SkeletonPtr getSkeleton()
Same as getPtr(), but this allows Skeleton to have a similar interface as BodyNode and Joint for temp...
Definition Skeleton.cpp:410
bool getSelfCollisionCheck() const
Return whether self-collision check is enabled.
Definition Skeleton.cpp:754
void updateArticulatedInertia() const
Update the articulated inertias of the skeleton.
Definition Skeleton.cpp:2815
void updateAugMassMatrix() const
Update augmented mass matrix of the skeleton.
Definition Skeleton.cpp:2994
void notifyArticulatedInertiaUpdate(std::size_t _treeIdx)
Notify that the articulated inertia and everything that depends on it needs to be updated.
Definition Skeleton.cpp:3783
std::pair< Joint *, BodyNode * > cloneBodyNodeTree(Joint *_parentJoint, const BodyNode *_bodyNode, const SkeletonPtr &_newSkeleton, BodyNode *_parentNode, bool _recursive) const
Copy a subtree of BodyNodes onto another Skeleton while leaving the originals intact.
Definition Skeleton.cpp:2667
std::weak_ptr< Skeleton > mPtr
The resource-managing pointer to this Skeleton.
Definition Skeleton.hpp:1175
void constructNewTree()
Construct a new tree in the Skeleton.
Definition Skeleton.cpp:2150
math::AngularJacobian getAngularJacobianDeriv(const JacobianNode *_node, const Frame *_inCoordinatesOf=Frame::World()) const override
Get the angular Jacobian time derivative of a BodyNode.
Definition Skeleton.cpp:1957
std::size_t getNumBodyNodes() const override
Get number of body nodes.
Definition Skeleton.cpp:851
std::size_t getNumJoints() const override
Get number of Joints.
Definition Skeleton.cpp:1098
void setMobile(bool _isMobile)
Set whether this skeleton will be updated by forward dynamics.
Definition Skeleton.cpp:808
void unregisterJoint(Joint *_oldJoint)
Remove a Joint from the Skeleton. Internal use only.
Definition Skeleton.cpp:2453
void unregisterBodyNode(BodyNode *_oldBodyNode)
Remove a BodyNode from the Skeleton. Internal use only.
Definition Skeleton.cpp:2381
void registerNode(NodeMap &nodeMap, Node *_newNode, std::size_t &_index)
Register a Node with the Skeleton. Internal use only.
Definition Skeleton.cpp:2305
math::LinearJacobian getCOMLinearJacobianDeriv(const Frame *_inCoordinatesOf=Frame::World()) const override
Get the Skeleton's COM Linear Jacobian time derivative in terms of any Frame (default is World Frame)...
Definition Skeleton.cpp:4221
const Eigen::Vector2d & getSupportCentroid() const
Get the centroid of the support polygon for this Skeleton.
Definition Skeleton.cpp:3660
bool hasBodyNode(const BodyNode *bodyNode) const override
Returns whether this Skeleton contains bodyNode.
Definition Skeleton.cpp:1020
double mTotalMass
Total mass.
Definition Skeleton.hpp:1313
bool getAdjacentBodyCheck() const
Return whether adjacent body check is enabled.
Definition Skeleton.cpp:784
void computeInverseDynamics(bool _withExternalForces=false, bool _withDampingForces=false, bool _withSpringForces=false)
Computes inverse dynamics.
Definition Skeleton.cpp:3749
void updateMassMatrix() const
Update mass matrix of the skeleton.
Definition Skeleton.cpp:2893
static SkeletonPtr create(const std::string &_name="Skeleton")
Create a new Skeleton inside of a shared_ptr.
Definition Skeleton.cpp:384
const Eigen::MatrixXd & getAugMassMatrix() const override
Get augmented mass matrix of the skeleton.
Definition Skeleton.cpp:1995
void setSelfCollisionCheck(bool enable)
Set whether to check self-collision.
Definition Skeleton.cpp:748
double computeKineticEnergy() const override
Get the kinetic energy of this MetaSkeleton.
Definition Skeleton.cpp:4030
void updateInvMassMatrix() const
Update inverse of mass matrix of the skeleton.
Definition Skeleton.cpp:3095
void setTimeStep(double _timeStep)
Set time step.
Definition Skeleton.cpp:820
BodyNode * getBodyNode(std::size_t _idx) override
Get BodyNode whose index is _idx.
Definition Skeleton.cpp:921
math::Jacobian getWorldJacobian(const JacobianNode *_node) const override
Get the spatial Jacobian targeting the origin of a BodyNode.
Definition Skeleton.cpp:1744
void clearCollidingBodies() override
Clear collision flags of the BodyNodes in this MetaSkeleton.
Definition Skeleton.cpp:4056
void enableSelfCollision(bool enableAdjacentBodyCheck=false)
Deprecated.
Definition Skeleton.cpp:734
bool hasJoint(const Joint *joint) const override
Returns whether this Skeleton contains join.
Definition Skeleton.cpp:1182
const std::string & getName() const override
Get name.
Definition Skeleton.cpp:677
void setGravity(const Eigen::Vector3d &_gravity)
Set 3-dim gravitational acceleration.
Definition Skeleton.cpp:836
void updateExternalForces() const
update external force vector to generalized forces.
Definition Skeleton.cpp:3463
const Eigen::Vector3d & getGravity() const
Get 3-dim gravitational acceleration.
Definition Skeleton.cpp:845
const Eigen::VectorXd & getConstraintForces() const override
Get constraint force vector.
Definition Skeleton.cpp:2119
Eigen::VectorXd getVelocityDifferences(const Eigen::VectorXd &_dq2, const Eigen::VectorXd &_dq1) const
Return the difference of two generalized velocities or accelerations which are measured in the tangen...
Definition Skeleton.cpp:1617
std::size_t getNumSoftBodyNodes() const
Get number of soft body nodes.
Definition Skeleton.cpp:863
math::Jacobian getCOMJacobianSpatialDeriv(const Frame *_inCoordinatesOf=Frame::World()) const override
Get the Skeleton's COM Jacobian spatial time derivative in terms of any Frame (default is World Frame...
Definition Skeleton.cpp:4211
void setPtr(const SkeletonPtr &_ptr)
Setup this Skeleton with its shared_ptr.
Definition Skeleton.cpp:2143
const std::string & setName(const std::string &_name) override
Set name.
Definition Skeleton.cpp:660
math::LinearJacobian getLinearJacobianDeriv(const JacobianNode *_node, const Frame *_inCoordinatesOf=Frame::World()) const override
of a BodyNode.
Definition Skeleton.cpp:1921
std::mutex mMutex
Definition Skeleton.hpp:1319
Configuration getConfiguration(int flags=CONFIG_ALL) const
Get the configuration of this Skeleton.
Definition Skeleton.cpp:577
Eigen::Vector3d getCOMLinearVelocity(const Frame *_relativeTo=Frame::World(), const Frame *_inCoordinatesOf=Frame::World()) const override
Get the Skeleton's COM linear velocity in terms of any Frame (default is World Frame)
Definition Skeleton.cpp:4127
std::vector< BodyNode * > extractBodyNodeTree(BodyNode *_bodyNode)
Create a vector representation of a subtree of BodyNodes and remove that subtree from this Skeleton w...
Definition Skeleton.cpp:2744
std::vector< SoftBodyNode * > mSoftBodyNodes
List of Soft body node list in the skeleton.
Definition Skeleton.hpp:1178
math::LinearJacobian getLinearJacobian(const JacobianNode *_node, const Frame *_inCoordinatesOf=Frame::World()) const override
Get the linear Jacobian targeting the origin of a BodyNode.
Definition Skeleton.cpp:1774
virtual ~Skeleton()
Destructor.
Definition Skeleton.cpp:436
math::AngularJacobian getAngularJacobian(const JacobianNode *_node, const Frame *_inCoordinatesOf=Frame::World()) const override
Get the angular Jacobian of a BodyNode.
Definition Skeleton.cpp:1807
void integrateVelocities(double _dt)
Definition Skeleton.cpp:1572
math::Jacobian getJacobianSpatialDeriv(const JacobianNode *_node) const override
Get the spatial Jacobian time derivative targeting the origin of a BodyNode.
Definition Skeleton.cpp:1831
SkeletonPtr cloneSkeleton() const
Creates and returns a clone of this Skeleton.
Definition Skeleton.cpp:455
void unregisterNode(NodeMap &nodeMap, Node *_oldNode, std::size_t &_index)
Remove a Node from the Skeleton. Internal use only.
Definition Skeleton.cpp:2500
const std::vector< DegreeOfFreedom * > & getTreeDofs(std::size_t _treeIdx)
Get the DegreesOfFreedom belonging to a tree in this Skeleton.
Definition Skeleton.cpp:1256
SkeletonPtr getPtr()
Get the shared_ptr that manages this Skeleton.
Definition Skeleton.cpp:398
void computeForwardKinematics(bool _updateTransforms=true, bool _updateVels=true, bool _updateAccs=true)
Compute forward kinematics.
Definition Skeleton.cpp:3692
Properties getProperties() const
Get all properties of this Skeleton.
Definition Skeleton.cpp:631
const std::shared_ptr< WholeBodyIK > & getOrCreateIK()
Get a pointer to a WholeBodyIK module for this Skeleton.
Definition Skeleton.cpp:1525
const Eigen::VectorXd & getCoriolisForces() const override
Get Coriolis force vector of the MetaSkeleton's BodyNodes.
Definition Skeleton.cpp:2049
void updateBiasImpulse(BodyNode *_bodyNode)
Update bias impulses.
Definition Skeleton.cpp:3821
void setAspectProperties(const AspectProperties &properties)
Set the AspectProperties of this Skeleton.
Definition Skeleton.cpp:643
void disableSelfCollision()
Deprecated. Please use disableSelfCollisionCheck() instead.
Definition Skeleton.cpp:741
const Eigen::MatrixXd & getInvAugMassMatrix() const override
Get inverse of augmented Mass Matrix of the MetaSkeleton.
Definition Skeleton.cpp:2031
void resetUnion()
Definition Skeleton.hpp:1326
void enableSelfCollisionCheck()
Enable self-collision check.
Definition Skeleton.cpp:760
BodyNode * getRootBodyNode(std::size_t _treeIdx=0)
Get the root BodyNode of the tree whose index in this Skeleton is _treeIdx.
Definition Skeleton.cpp:875
Eigen::Vector6d getCOMSpatialAcceleration(const Frame *_relativeTo=Frame::World(), const Frame *_inCoordinatesOf=Frame::World()) const override
Get the Skeleton's COM spatial acceleration in terms of any Frame (default is World Frame)
Definition Skeleton.cpp:4136
std::size_t getNumRigidBodyNodes() const
Get number of rigid body nodes.
Definition Skeleton.cpp:857
bool mIsImpulseApplied
Flag for status of impulse testing.
Definition Skeleton.hpp:1317
void setAdjacentBodyCheck(bool enable)
Set whether to check adjacent bodies.
Definition Skeleton.cpp:778
void dirtySupportPolygon(std::size_t _treeIdx)
Notify that the support polygon of a tree needs to be updated.
Definition Skeleton.cpp:3808
std::shared_ptr< WholeBodyIK > mWholeBodyIK
WholeBodyIK module for this Skeleton.
Definition Skeleton.hpp:1193
Eigen::Vector3d getCOM(const Frame *_withRespectTo=Frame::World()) const override
Get the Skeleton's COM with respect to any Frame (default is World Frame)
Definition Skeleton.cpp:4077
void updateGravityForces() const
Update gravity force vector of the skeleton.
Definition Skeleton.cpp:3318
std::unique_ptr< common::LockableReference > getLockableReference() const override
Get the mutex that protects the state of this Skeleton.
Definition Skeleton.cpp:428
const math::SupportPolygon & getSupportPolygon() const
Get the support polygon of this Skeleton, which is computed based on the gravitational projection of ...
Definition Skeleton.cpp:3582
void updateNameManagerNames()
Definition Skeleton.cpp:714
void computeImpulseForwardDynamics()
Compute impulse-based forward dynamics.
Definition Skeleton.cpp:4003
void updateVelocityChange()
Update velocity changes in body nodes and joints due to applied impulse.
Definition Skeleton.cpp:3984
Eigen::Vector6d getCOMSpatialVelocity(const Frame *_relativeTo=Frame::World(), const Frame *_inCoordinatesOf=Frame::World()) const override
Get the Skeleton's COM spatial velocity in terms of any Frame (default is World Frame)
Definition Skeleton.cpp:4118
double getTimeStep() const
Get time step.
Definition Skeleton.cpp:830
Joint * getJoint(std::size_t _idx) override
Get Joint whose index is _idx.
Definition Skeleton.cpp:1105
std::map< std::type_index, std::vector< NodeMap::iterator > * > SpecializedTreeNodes
Definition Skeleton.hpp:1308
void clearConstraintImpulses()
Clear constraint impulses and cache data used for impulse-based forward dynamics algorithm,...
Definition Skeleton.cpp:3814
bool isEnabledSelfCollisionCheck() const
Return true if self-collision check is enabled.
Definition Skeleton.cpp:772
math::LinearJacobian getCOMLinearJacobian(const Frame *_inCoordinatesOf=Frame::World()) const override
Get the Skeleton's COM Linear Jacobian in terms of any Frame (default is World Frame)
Definition Skeleton.cpp:4201
void disableAdjacentBodyCheck()
Disable collision check for adjacent bodies.
Definition Skeleton.cpp:796
const std::pair< Eigen::Vector3d, Eigen::Vector3d > & getSupportAxes() const
Get the axes that correspond to each component in the support polygon.
Definition Skeleton.cpp:3644
const std::vector< std::size_t > & getSupportIndices() const
Get a list of the EndEffector indices that correspond to each of the points in the support polygon.
Definition Skeleton.cpp:3629
void enableAdjacentBodyCheck()
Enable collision check for adjacent bodies.
Definition Skeleton.cpp:790
void receiveBodyNodeTree(const std::vector< BodyNode * > &_tree)
Take in and register a subtree of BodyNodes.
Definition Skeleton.cpp:2761
void notifySupportUpdate(std::size_t _treeIdx)
Notify that the support polygon of a tree needs to be updated.
Definition Skeleton.cpp:3802
bool checkIndexingConsistency() const
This function is only meant for debugging purposes.
Definition Skeleton.cpp:1270
const Eigen::VectorXd & getGravityForces() const override
Get gravity force vector of the MetaSkeleton.
Definition Skeleton.cpp:2067
const Eigen::VectorXd & getExternalForces() const override
Get external force vector of the MetaSkeleton.
Definition Skeleton.cpp:2104
std::vector< Joint * > getJoints() override
Returns all the joints that are held by this MetaSkeleton.
Definition Skeleton.cpp:1134
Eigen::VectorXd getPositionDifferences(const Eigen::VectorXd &_q2, const Eigen::VectorXd &_q1) const
Return the difference of two generalized positions which are measured in the configuration space of t...
Definition Skeleton.cpp:1585
void destructOldTree(std::size_t tree)
Remove an old tree from the Skeleton.
Definition Skeleton.cpp:2358
std::vector< const BodyNode * > constructBodyNodeTree(const BodyNode *_bodyNode) const
Create a vector representation of a subtree of BodyNodes.
Definition Skeleton.cpp:2725
std::size_t getNumTrees() const
Get the number of independent trees that this Skeleton contains.
Definition Skeleton.cpp:869
std::size_t getNumDofs() const override
Return the number of degrees of freedom in this skeleton.
Definition Skeleton.cpp:1201
const std::string & addEntryToJointNameMgr(Joint *_newJoint, bool _updateDofNames=true)
Add a Joint to to the Joint NameManager.
Definition Skeleton.cpp:692
SkeletonPtr clone() const
Create an identical clone of this Skeleton.
Definition Skeleton.cpp:443
bool moveBodyNodeTree(Joint *_parentJoint, BodyNode *_bodyNode, SkeletonPtr _newSkeleton, BodyNode *_parentNode)
Move a subtree of BodyNodes from this Skeleton to another Skeleton.
Definition Skeleton.cpp:2557
void updateCacheDimensions(DataCache &_cache)
Update the dimensions for a specific cache.
Definition Skeleton.cpp:2776
Joint * getRootJoint(std::size_t treeIdx=0u)
Get the root Joint of the tree whose index in this Skeleton is treeIdx.
Definition Skeleton.cpp:904
const Eigen::MatrixXd & getInvMassMatrix() const override
Get inverse of Mass Matrix of the MetaSkeleton.
Definition Skeleton.cpp:2013
std::mutex & getMutex() const
Get the mutex that protects the state of this Skeleton.
Definition Skeleton.cpp:422
void setState(const State &state)
Set the State of this Skeleton [alias for setCompositeState(~)].
Definition Skeleton.cpp:613
const std::shared_ptr< WholeBodyIK > & createIK()
Create a new WholeBodyIK module for this Skeleton.
Definition Skeleton.cpp:1537
void integratePositions(double _dt)
Definition Skeleton.cpp:1559
dart::common::NameManager< DegreeOfFreedom * > mNameMgrForDofs
NameManager for tracking DegreesOfFreedom.
Definition Skeleton.hpp:1187
void setConfiguration(const Configuration &configuration)
Set the configuration of this Skeleton.
Definition Skeleton.cpp:567
const AspectProperties & getSkeletonProperties() const
Get the Properties of this Skeleton.
Definition Skeleton.cpp:654
void updateTotalMass()
Update the computation for total mass.
Definition Skeleton.cpp:2768
common::aligned_vector< DataCache > mTreeCache
Definition Skeleton.hpp:1303
const std::string & addEntryToBodyNodeNameMgr(BodyNode *_newNode)
Add a BodyNode to the BodyNode NameManager.
Definition Skeleton.cpp:683
std::size_t mUnionSize
Definition Skeleton.hpp:1336
std::size_t mUnionIndex
Definition Skeleton.hpp:1339
const std::vector< BodyNode * > & getTreeBodyNodes(std::size_t _treeIdx)
Get the BodyNodes belonging to a tree in this Skeleton.
Definition Skeleton.cpp:1072
void registerBodyNode(BodyNode *_newBodyNode)
Register a BodyNode with the Skeleton. Internal use only.
Definition Skeleton.cpp:2171
void addEntryToSoftBodyNodeNameMgr(SoftBodyNode *_newNode)
Add a SoftBodyNode to the SoftBodyNode NameManager.
Definition Skeleton.cpp:705
void clearInternalForces() override
Clear the internal forces of the BodyNodes in this MetaSkeleton.
Definition Skeleton.cpp:3776
std::weak_ptr< Skeleton > mUnionRootSkeleton
Definition Skeleton.hpp:1333
Skeleton & operator=(const Skeleton &_other)=delete
Remove copy operator.
const Eigen::VectorXd & getCoriolisAndGravityForces() const override
Get combined vector of Coriolis force and gravity force of the MetaSkeleton.
Definition Skeleton.cpp:2086
bool isImpulseApplied() const
Get whether this skeleton is constrained.
Definition Skeleton.cpp:3997
std::size_t getSupportVersion() const
The version number of a support polygon will be incremented each time the support polygon needs to be...
Definition Skeleton.cpp:3674
double computePotentialEnergy() const override
Get the potential energy of this MetaSkeleton.
Definition Skeleton.cpp:4042
void clearIK()
Wipe away the WholeBodyIK module for this Skeleton, leaving it as a nullptr.
Definition Skeleton.cpp:1544
dart::common::NameManager< Joint * > mNameMgrForJoints
NameManager for tracking Joints.
Definition Skeleton.hpp:1184
math::Jacobian getCOMJacobian(const Frame *_inCoordinatesOf=Frame::World()) const override
Get the Skeleton's COM Jacobian in terms of any Frame (default is World Frame)
Definition Skeleton.cpp:4193
Eigen::Vector3d getCOMLinearAcceleration(const Frame *_relativeTo=Frame::World(), const Frame *_inCoordinatesOf=Frame::World()) const override
Get the Skeleton's COM linear acceleration in terms of any Frame (default is World Frame)
Definition Skeleton.cpp:4146
const Eigen::VectorXd & computeConstraintForces(DataCache &cache) const
Compute the constraint force vector for a tree.
Definition Skeleton.cpp:3491
math::Jacobian getJacobianClassicDeriv(const JacobianNode *_node) const override
Get the spatial Jacobian (classical) time derivative targeting the origin of a BodyNode.
Definition Skeleton.cpp:1879
const std::vector< DegreeOfFreedom * > & getDofs() override
Get the vector of DegreesOfFreedom for this MetaSkeleton.
Definition Skeleton.cpp:1233
math::Jacobian getJacobian(const JacobianNode *_node) const override
Get the spatial Jacobian targeting the origin of a BodyNode.
Definition Skeleton.cpp:1698
DataCache mSkelCache
Definition Skeleton.hpp:1305
SoftBodyNode represent a soft body that has one deformable skin.
Definition SoftBodyNode.hpp:46
The WholeBodyIK class provides an interface for simultaneously solving all the IK constraints of all ...
Definition HierarchicalIK.hpp:395
Definition Random-impl.hpp:92
std::vector< _Tp, Eigen::aligned_allocator< _Tp > > aligned_vector
Definition Memory.hpp:71
std::shared_ptr< const Skeleton > ConstSkeletonPtr
Definition SmartPointer.hpp:60
std::shared_ptr< MetaSkeleton > MetaSkeletonPtr
Definition SmartPointer.hpp:68
std::shared_ptr< Skeleton > SkeletonPtr
Definition SmartPointer.hpp:60
std::vector< Eigen::Vector3d > SupportGeometry
Definition Geometry.hpp:504
common::aligned_vector< Eigen::Vector2d > SupportPolygon
Definition Geometry.hpp:506
Definition BulletCollisionDetector.cpp:65
Definition SharedLibraryManager.hpp:46
The Configuration struct represents the joint configuration of a Skeleton.
Definition Skeleton.hpp:95
Eigen::VectorXd mPositions
Joint positions.
Definition Skeleton.hpp:116
bool operator!=(const Configuration &other) const
Inequality comparison operator.
Definition Skeleton.cpp:378
std::vector< std::size_t > mIndices
A list of degree of freedom indices that each entry in the Eigen::VectorXd members correspond to.
Definition Skeleton.hpp:113
Eigen::VectorXd mVelocities
Joint velocities.
Definition Skeleton.hpp:119
Eigen::VectorXd mAccelerations
Joint accelerations.
Definition Skeleton.hpp:122
bool operator==(const Configuration &other) const
Equality comparison operator.
Definition Skeleton.cpp:363
Eigen::VectorXd mCommands
Joint commands.
Definition Skeleton.hpp:128
Eigen::VectorXd mForces
Joint forces.
Definition Skeleton.hpp:125
Definition Skeleton.hpp:1239
std::vector< std::size_t > mSupportIndices
A map of which EndEffectors correspond to the individual points in the support polygon.
Definition Skeleton.hpp:1287
Eigen::VectorXd mFext
External force vector for the skeleton.
Definition Skeleton.hpp:1277
std::vector< const DegreeOfFreedom * > mConstDofs
Cache for const Degrees of Freedom, for the sake of the API.
Definition Skeleton.hpp:1252
Eigen::VectorXd mCvec
Coriolis vector for the skeleton which is C(q,dq)*dq.
Definition Skeleton.hpp:1267
Eigen::MatrixXd mInvM
Inverse of mass matrix for the skeleton.
Definition Skeleton.hpp:1261
Eigen::MatrixXd mAugM
Mass matrix for the skeleton.
Definition Skeleton.hpp:1258
Eigen::MatrixXd mInvAugM
Inverse of augmented mass matrix for the skeleton.
Definition Skeleton.hpp:1264
Eigen::VectorXd mG
Gravity vector for the skeleton; computed in nonrecursive dynamics only.
Definition Skeleton.hpp:1271
math::SupportPolygon mSupportPolygon
Support polygon.
Definition Skeleton.hpp:1283
DirtyFlags mDirty
Definition Skeleton.hpp:1240
std::vector< const BodyNode * > mConstBodyNodes
Cache for const BodyNodes, for the sake of the API.
Definition Skeleton.hpp:1246
std::vector< DegreeOfFreedom * > mDofs
Degrees of Freedom belonging to this tree.
Definition Skeleton.hpp:1249
math::SupportGeometry mSupportGeometry
Support geometry – only used for temporary storage purposes.
Definition Skeleton.hpp:1294
Eigen::Vector2d mSupportCentroid
Centroid of the support polygon.
Definition Skeleton.hpp:1297
std::pair< Eigen::Vector3d, Eigen::Vector3d > mSupportAxes
A pair of vectors which map the 2D coordinates of the support polygon into 3D space.
Definition Skeleton.hpp:1291
std::vector< BodyNode * > mBodyNodes
BodyNodes belonging to this tree.
Definition Skeleton.hpp:1243
Eigen::VectorXd mFc
Constraint force vector.
Definition Skeleton.hpp:1280
Eigen::MatrixXd mM
Mass matrix cache.
Definition Skeleton.hpp:1255
Eigen::VectorXd mCg
Combined coriolis and gravity vector which is C(q, dq)*dq + g(q).
Definition Skeleton.hpp:1274
Definition Skeleton.hpp:1196
bool mCoriolisForces
Dirty flag for the Coriolis force vector.
Definition Skeleton.hpp:1219
bool mExternalForces
Dirty flag for the external force vector.
Definition Skeleton.hpp:1225
bool mArticulatedInertia
Dirty flag for articulated body inertia.
Definition Skeleton.hpp:1201
bool mInvAugMassMatrix
Dirty flag for the inverse of augmented mass matrix.
Definition Skeleton.hpp:1213
bool mMassMatrix
Dirty flag for the mass matrix.
Definition Skeleton.hpp:1204
bool mAugMassMatrix
Dirty flag for the mass matrix.
Definition Skeleton.hpp:1207
std::size_t mSupportVersion
Increments each time a new support polygon is computed to help keep track of changes in the support p...
Definition Skeleton.hpp:1235
bool mSupport
Dirty flag for the support polygon.
Definition Skeleton.hpp:1231
bool mGravityForces
Dirty flag for the gravity force vector.
Definition Skeleton.hpp:1216
bool mDampingForces
Dirty flag for the damping force vector.
Definition Skeleton.hpp:1228
bool mCoriolisAndGravityForces
Dirty flag for the combined vector of Coriolis and gravity.
Definition Skeleton.hpp:1222
bool mInvMassMatrix
Dirty flag for the inverse of mass matrix.
Definition Skeleton.hpp:1210
The Properties of this Skeleton which are independent of the components within the Skeleton,...
Definition SkeletonAspect.hpp:54