DART 6.13.2
Loading...
Searching...
No Matches
MetaSkeleton.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2022, 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_METASKELETON_HPP_
34#define DART_DYNAMICS_METASKELETON_HPP_
35
36#include <string>
37#include <vector>
38
39#include <Eigen/Dense>
40
47
48namespace dart {
49namespace dynamics {
50
51class BodyNode;
52class SoftBodyNode;
53class PointMass;
54class Joint;
55class DegreeOfFreedom;
56
61{
62public:
64 std::shared_ptr<const MetaSkeleton> _skeleton,
65 const std::string& _oldName,
66 const std::string& _newName)>;
67
68 MetaSkeleton(const MetaSkeleton&) = delete;
69
71 virtual ~MetaSkeleton() = default;
72
75 const std::string& cloneName) const = 0;
76 // TODO: In DART7, rename this to clone() and change the current
77 // Skeleton::clone() to override it.
78
81
83 virtual std::unique_ptr<common::LockableReference> getLockableReference()
84 const = 0;
85 // TODO: In DART7, rename this to getMutex() and change the current
86 // Skeleton::getMutex() to override it.
87
88 //----------------------------------------------------------------------------
90 //----------------------------------------------------------------------------
91
93 virtual const std::string& setName(const std::string& _name) = 0;
94
96 virtual const std::string& getName() const = 0;
97
99
100 //----------------------------------------------------------------------------
102 //----------------------------------------------------------------------------
103
105 virtual std::size_t getNumBodyNodes() const = 0;
106
108 virtual BodyNode* getBodyNode(std::size_t _idx) = 0;
109
111 virtual const BodyNode* getBodyNode(std::size_t _idx) const = 0;
112
117 virtual BodyNode* getBodyNode(const std::string& name) = 0;
118
123 virtual const BodyNode* getBodyNode(const std::string& name) const = 0;
124
128 DART_DEPRECATED(6.13)
129 virtual const std::vector<BodyNode*>& getBodyNodes() = 0;
130
134 DART_DEPRECATED(6.13)
135 virtual const std::vector<const BodyNode*>& getBodyNodes() const = 0;
136
140 virtual std::vector<BodyNode*> getBodyNodes(const std::string& name) = 0;
141
145 virtual std::vector<const BodyNode*> getBodyNodes(
146 const std::string& name) const = 0;
147
149 virtual bool hasBodyNode(const BodyNode* bodyNode) const = 0;
150
155 virtual std::size_t getIndexOf(
156 const BodyNode* _bn, bool _warning = true) const = 0;
157
159 virtual std::size_t getNumJoints() const = 0;
160
162 virtual Joint* getJoint(std::size_t _idx) = 0;
163
165 virtual const Joint* getJoint(std::size_t _idx) const = 0;
166
170 virtual Joint* getJoint(const std::string& name) = 0;
171
175 virtual const Joint* getJoint(const std::string& name) const = 0;
176
180 DART_DEPRECATED(6.13)
181 virtual std::vector<Joint*> getJoints() = 0;
182
186 DART_DEPRECATED(6.13)
187 virtual std::vector<const Joint*> getJoints() const = 0;
188
196 virtual std::vector<Joint*> getJoints(const std::string& name) = 0;
197
205 virtual std::vector<const Joint*> getJoints(
206 const std::string& name) const = 0;
207
209 virtual bool hasJoint(const Joint* joint) const = 0;
210
215 virtual std::size_t getIndexOf(
216 const Joint* _joint, bool _warning = true) const = 0;
217
219 virtual std::size_t getNumDofs() const = 0;
220
222 virtual DegreeOfFreedom* getDof(std::size_t _idx) = 0;
223
225 virtual const DegreeOfFreedom* getDof(std::size_t _idx) const = 0;
226
230 DART_DEPRECATED(6.13)
231 virtual const std::vector<DegreeOfFreedom*>& getDofs() = 0;
232
236 DART_DEPRECATED(6.13)
237 virtual std::vector<const DegreeOfFreedom*> getDofs() const = 0;
238
243 virtual std::size_t getIndexOf(
244 const DegreeOfFreedom* _dof, bool _warning = true) const = 0;
245
247
248 //----------------------------------------------------------------------------
250 //----------------------------------------------------------------------------
251
253 void setCommand(std::size_t _index, double _command);
254
256 double getCommand(std::size_t _index) const;
257
259 void setCommands(const Eigen::VectorXd& _commands);
260
262 void setCommands(
263 const std::vector<std::size_t>& _indices,
264 const Eigen::VectorXd& _commands);
265
267 Eigen::VectorXd getCommands() const;
268
270 Eigen::VectorXd getCommands(const std::vector<std::size_t>& _indices) const;
271
273 void resetCommands();
274
276
277 //----------------------------------------------------------------------------
279 //----------------------------------------------------------------------------
280
282 void setPosition(std::size_t index, double _position);
283
285 double getPosition(std::size_t _index) const;
286
288 void setPositions(const Eigen::VectorXd& _positions);
289
291 void setPositions(
292 const std::vector<std::size_t>& _indices,
293 const Eigen::VectorXd& _positions);
294
296 Eigen::VectorXd getPositions() const;
297
299 Eigen::VectorXd getPositions(const std::vector<std::size_t>& _indices) const;
300
302 void resetPositions();
303
305 void setPositionLowerLimit(std::size_t _index, double _position);
306
308 void setPositionLowerLimits(const Eigen::VectorXd& positions);
309
312 const std::vector<std::size_t>& indices,
313 const Eigen::VectorXd& positions);
314
316 double getPositionLowerLimit(std::size_t _index) const;
317
319 Eigen::VectorXd getPositionLowerLimits() const;
320
323 const std::vector<std::size_t>& indices) const;
324
326 void setPositionUpperLimit(std::size_t _index, double _position);
327
329 void setPositionUpperLimits(const Eigen::VectorXd& positions);
330
333 const std::vector<std::size_t>& indices,
334 const Eigen::VectorXd& positions);
335
337 double getPositionUpperLimit(std::size_t _index) const;
338
340 Eigen::VectorXd getPositionUpperLimits() const;
341
344 const std::vector<std::size_t>& indices) const;
345
347
348 //----------------------------------------------------------------------------
350 //----------------------------------------------------------------------------
351
353 void setVelocity(std::size_t _index, double _velocity);
354
356 double getVelocity(std::size_t _index) const;
357
359 void setVelocities(const Eigen::VectorXd& _velocities);
360
362 void setVelocities(
363 const std::vector<std::size_t>& _indices,
364 const Eigen::VectorXd& _velocities);
365
367 Eigen::VectorXd getVelocities() const;
368
370 Eigen::VectorXd getVelocities(const std::vector<std::size_t>& _indices) const;
371
373 void resetVelocities();
374
376 void setVelocityLowerLimit(std::size_t _index, double _velocity);
377
379 void setVelocityLowerLimits(const Eigen::VectorXd& velocities);
380
384 const std::vector<std::size_t>& indices,
385 const Eigen::VectorXd& velocities);
386
388 double getVelocityLowerLimit(std::size_t _index);
389
391 Eigen::VectorXd getVelocityLowerLimits() const;
392
396 const std::vector<std::size_t>& indices) const;
397
399 void setVelocityUpperLimit(std::size_t _index, double _velocity);
400
402 void setVelocityUpperLimits(const Eigen::VectorXd& velocities);
403
407 const std::vector<std::size_t>& indices,
408 const Eigen::VectorXd& velocities);
409
411 double getVelocityUpperLimit(std::size_t _index);
412
414 Eigen::VectorXd getVelocityUpperLimits() const;
415
419 const std::vector<std::size_t>& indices) const;
420
422
423 //----------------------------------------------------------------------------
425 //----------------------------------------------------------------------------
426
428 void setAcceleration(std::size_t _index, double _acceleration);
429
431 double getAcceleration(std::size_t _index) const;
432
434 void setAccelerations(const Eigen::VectorXd& _accelerations);
435
437 void setAccelerations(
438 const std::vector<std::size_t>& _indices,
439 const Eigen::VectorXd& _accelerations);
440
442 Eigen::VectorXd getAccelerations() const;
443
445 Eigen::VectorXd getAccelerations(
446 const std::vector<std::size_t>& _indices) const;
447
449 void resetAccelerations();
450
452 void setAccelerationLowerLimit(std::size_t _index, double _acceleration);
453
455 void setAccelerationLowerLimits(const Eigen::VectorXd& accelerations);
456
460 const std::vector<std::size_t>& indices,
461 const Eigen::VectorXd& accelerations);
462
464 double getAccelerationLowerLimit(std::size_t _index) const;
465
467 Eigen::VectorXd getAccelerationLowerLimits() const;
468
472 const std::vector<std::size_t>& indices) const;
473
475 void setAccelerationUpperLimit(std::size_t _index, double _acceleration);
476
478 void setAccelerationUpperLimits(const Eigen::VectorXd& accelerations);
479
483 const std::vector<std::size_t>& indices,
484 const Eigen::VectorXd& accelerations);
485
487 double getAccelerationUpperLimit(std::size_t _index) const;
488
490 Eigen::VectorXd getAccelerationUpperLimits() const;
491
495 const std::vector<std::size_t>& indices) const;
496
498
499 //----------------------------------------------------------------------------
501 //----------------------------------------------------------------------------
502
504 void setForce(std::size_t _index, double _force);
505
507 double getForce(std::size_t _index) const;
508
510 void setForces(const Eigen::VectorXd& _forces);
511
513 void setForces(
514 const std::vector<std::size_t>& _index, const Eigen::VectorXd& _forces);
515
517 Eigen::VectorXd getForces() const;
518
520 Eigen::VectorXd getForces(const std::vector<std::size_t>& _indices) const;
521
524
526 void setForceLowerLimit(std::size_t _index, double _force);
527
529 void setForceLowerLimits(const Eigen::VectorXd& forces);
530
533 const std::vector<std::size_t>& indices, const Eigen::VectorXd& forces);
534
536 double getForceLowerLimit(std::size_t _index) const;
537
539 Eigen::VectorXd getForceLowerLimits() const;
540
542 Eigen::VectorXd getForceLowerLimits(
543 const std::vector<std::size_t>& indices) const;
544
546 void setForceUpperLimit(std::size_t _index, double _force);
547
549 void setForceUpperLimits(const Eigen::VectorXd& forces);
550
553 const std::vector<std::size_t>& indices, const Eigen::VectorXd& forces);
554
556 double getForceUpperLimit(std::size_t _index) const;
557
559 Eigen::VectorXd getForceUpperLimits() const;
560
562 Eigen::VectorXd getForceUpperLimits(
563 const std::vector<std::size_t>& indices) const;
564
566
567 //----------------------------------------------------------------------------
569 //----------------------------------------------------------------------------
570
572 Eigen::VectorXd getVelocityChanges() const;
573
574 //----------------------------------------------------------------------------
576 //----------------------------------------------------------------------------
577
579 void setJointConstraintImpulses(const Eigen::VectorXd& _impulses);
580
582 Eigen::VectorXd getJointConstraintImpulses() const;
583
584 //----------------------------------------------------------------------------
586 //----------------------------------------------------------------------------
587
590 virtual math::Jacobian getJacobian(const JacobianNode* _node) const = 0;
591
594 virtual math::Jacobian getJacobian(
595 const JacobianNode* _node, const Frame* _inCoordinatesOf) const = 0;
596
600 math::Jacobian getJacobian(
601 const JacobianNode* _node,
602 const JacobianNode* _relativeTo,
603 const Frame* _inCoordinatesOf) const;
604
608 virtual math::Jacobian getJacobian(
609 const JacobianNode* _node, const Eigen::Vector3d& _localOffset) const = 0;
610
614 virtual math::Jacobian getJacobian(
615 const JacobianNode* _node,
616 const Eigen::Vector3d& _localOffset,
617 const Frame* _inCoordinatesOf) const = 0;
618
623 math::Jacobian getJacobian(
624 const JacobianNode* _node,
625 const Eigen::Vector3d& _localOffset,
626 const JacobianNode* _relativeTo,
627 const Frame* _inCoordinatesOf) const;
628
631 virtual math::Jacobian getWorldJacobian(const JacobianNode* _node) const = 0;
632
636 virtual math::Jacobian getWorldJacobian(
637 const JacobianNode* _node, const Eigen::Vector3d& _localOffset) const = 0;
638
641 virtual math::LinearJacobian getLinearJacobian(
642 const JacobianNode* _node,
643 const Frame* _inCoordinatesOf = Frame::World()) const = 0;
644
648 virtual math::LinearJacobian getLinearJacobian(
649 const JacobianNode* _node,
650 const Eigen::Vector3d& _localOffset,
651 const Frame* _inCoordinatesOf = Frame::World()) const = 0;
652
656 math::LinearJacobian getLinearJacobian(
657 const JacobianNode* _node,
658 const JacobianNode* _relativeTo,
659 const Frame* _inCoordinatesOf = Frame::World()) const;
660
665 math::LinearJacobian getLinearJacobian(
666 const JacobianNode* _node,
667 const Eigen::Vector3d& _localOffset,
668 const JacobianNode* _relativeTo,
669 const Frame* _inCoordinatesOf = Frame::World()) const;
670
672
673 //----------------------------------------------------------------------------
675 //----------------------------------------------------------------------------
676
679 virtual math::AngularJacobian getAngularJacobian(
680 const JacobianNode* _node,
681 const Frame* _inCoordinatesOf = Frame::World()) const = 0;
682
686 math::AngularJacobian getAngularJacobian(
687 const JacobianNode* _node,
688 const JacobianNode* _relativeTo,
689 const Frame* _inCoordinatesOf = Frame::World()) const;
690
693 virtual math::Jacobian getJacobianSpatialDeriv(
694 const JacobianNode* _node) const = 0;
695
698 virtual math::Jacobian getJacobianSpatialDeriv(
699 const JacobianNode* _node, const Frame* _inCoordinatesOf) const = 0;
700
704 virtual math::Jacobian getJacobianSpatialDeriv(
705 const JacobianNode* _node, const Eigen::Vector3d& _localOffset) const = 0;
706
710 virtual math::Jacobian getJacobianSpatialDeriv(
711 const JacobianNode* _node,
712 const Eigen::Vector3d& _localOffset,
713 const Frame* _inCoordinatesOf) const = 0;
714
718 math::Jacobian getJacobianSpatialDeriv(
719 const JacobianNode* _node,
720 const JacobianNode* _relativeTo,
721 const Frame* _inCoordinatesOf) const;
722
727 math::Jacobian getJacobianSpatialDeriv(
728 const JacobianNode* _node,
729 const Eigen::Vector3d& _localOffset,
730 const JacobianNode* _relativeTo,
731 const Frame* _inCoordinatesOf) const;
732
735 virtual math::Jacobian getJacobianClassicDeriv(
736 const JacobianNode* _node) const = 0;
737
741 virtual math::Jacobian getJacobianClassicDeriv(
742 const JacobianNode* _node, const Frame* _inCoordinatesOf) const = 0;
743
747 virtual math::Jacobian getJacobianClassicDeriv(
748 const JacobianNode* _node,
749 const Eigen::Vector3d& _localOffset,
750 const Frame* _inCoordinatesOf = Frame::World()) const = 0;
751
754 virtual math::LinearJacobian getLinearJacobianDeriv(
755 const JacobianNode* _node,
756 const Frame* _inCoordinatesOf = Frame::World()) const = 0;
757
761 virtual math::LinearJacobian getLinearJacobianDeriv(
762 const JacobianNode* _node,
763 const Eigen::Vector3d& _localOffset,
764 const Frame* _inCoordinatesOf = Frame::World()) const = 0;
765
768 virtual math::AngularJacobian getAngularJacobianDeriv(
769 const JacobianNode* _node,
770 const Frame* _inCoordinatesOf = Frame::World()) const = 0;
771
773
774 //----------------------------------------------------------------------------
776 //----------------------------------------------------------------------------
777
781 virtual double getMass() const = 0;
782
784 virtual const Eigen::MatrixXd& getMassMatrix() const = 0;
785
790 virtual const Eigen::MatrixXd& getAugMassMatrix() const = 0;
791
793 virtual const Eigen::MatrixXd& getInvMassMatrix() const = 0;
794
796 virtual const Eigen::MatrixXd& getInvAugMassMatrix() const = 0;
797
799 virtual const Eigen::VectorXd& getCoriolisForces() const = 0;
800
802 virtual const Eigen::VectorXd& getGravityForces() const = 0;
803
806 virtual const Eigen::VectorXd& getCoriolisAndGravityForces() const = 0;
807
809 virtual const Eigen::VectorXd& getExternalForces() const = 0;
810
812 virtual const Eigen::VectorXd& getConstraintForces() const = 0;
813
815 virtual void clearExternalForces() = 0;
816
818 virtual void clearInternalForces() = 0;
819
821 double computeLagrangian() const;
822
824 DART_DEPRECATED(6.1)
825 double getKineticEnergy() const;
826
828 virtual double computeKineticEnergy() const = 0;
829
831 DART_DEPRECATED(6.1)
832 double getPotentialEnergy() const;
833
835 virtual double computePotentialEnergy() const = 0;
836
838 DART_DEPRECATED(6.0)
839 virtual void clearCollidingBodies() = 0;
840
842
843 //----------------------------------------------------------------------------
845 //----------------------------------------------------------------------------
846
849 virtual Eigen::Vector3d getCOM(
850 const Frame* _withRespectTo = Frame::World()) const = 0;
851
854 virtual Eigen::Vector6d getCOMSpatialVelocity(
855 const Frame* _relativeTo = Frame::World(),
856 const Frame* _inCoordinatesOf = Frame::World()) const = 0;
857
860 virtual Eigen::Vector3d getCOMLinearVelocity(
861 const Frame* _relativeTo = Frame::World(),
862 const Frame* _inCoordinatesOf = Frame::World()) const = 0;
863
867 const Frame* _relativeTo = Frame::World(),
868 const Frame* _inCoordinatesOf = Frame::World()) const = 0;
869
873 const Frame* _relativeTo = Frame::World(),
874 const Frame* _inCoordinatesOf = Frame::World()) const = 0;
875
878 virtual math::Jacobian getCOMJacobian(
879 const Frame* _inCoordinatesOf = Frame::World()) const = 0;
880
883 virtual math::LinearJacobian getCOMLinearJacobian(
884 const Frame* _inCoordinatesOf = Frame::World()) const = 0;
885
892 virtual math::Jacobian getCOMJacobianSpatialDeriv(
893 const Frame* _inCoordinatesOf = Frame::World()) const = 0;
894
901 virtual math::LinearJacobian getCOMLinearJacobianDeriv(
902 const Frame* _inCoordinatesOf = Frame::World()) const = 0;
903
905
913 void setColor(const Eigen::Vector3d& color);
914
922 void setColor(const Eigen::Vector4d& color);
923
931 void setAlpha(double alpha);
932
934
944 template <typename Func>
945 void eachBodyNode(Func func) const;
946
956 template <typename Func>
957 void eachBodyNode(Func func);
958
968 template <typename Func>
969 void eachJoint(Func func) const;
970
980 template <typename Func>
981 void eachJoint(Func func);
982
993 template <typename Func>
994 void eachDof(Func func) const;
995
1006 template <typename Func>
1007 void eachDof(Func func);
1008
1010
1011protected:
1013 MetaSkeleton();
1014
1015 //--------------------------------------------------------------------------
1016 // Signals
1017 //--------------------------------------------------------------------------
1019
1020public:
1021 //--------------------------------------------------------------------------
1022 // Slot registers
1023 //--------------------------------------------------------------------------
1024 common::SlotRegister<NameChangedSignal> onNameChanged;
1025};
1026
1027} // namespace dynamics
1028} // namespace dart
1029
1030#include "dart/dynamics/detail/MetaSkeleton-impl.hpp"
1031
1032#endif // DART_DYNAMICS_METASKELETON_HPP_
#define DART_DEPRECATED(version)
Definition Deprecated.hpp:51
std::string * name
Definition SkelParser.cpp:1698
std::size_t index
Definition SkelParser.cpp:1673
The Subject class is a base class for any object that wants to report when it gets destroyed.
Definition Subject.hpp:58
BodyNode class represents a single node of the skeleton.
Definition BodyNode.hpp:80
DegreeOfFreedom class is a proxy class for accessing single degrees of freedom (aka generalized coord...
Definition DegreeOfFreedom.hpp:56
The Frame class serves as the backbone of DART's kinematic tree structure.
Definition Frame.hpp:58
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:61
MetaSkeleton is a pure abstract base class that provides a common interface for obtaining data (such ...
Definition MetaSkeleton.hpp:61
Eigen::VectorXd getForces() const
Get the forces for all generalized coordinates.
Definition MetaSkeleton.cpp:845
void setAccelerationLowerLimits(const Eigen::VectorXd &accelerations)
Set the lower limits for all generalized coordinates's acceleration.
Definition MetaSkeleton.cpp:722
virtual math::LinearJacobian getLinearJacobianDeriv(const JacobianNode *_node, const Frame *_inCoordinatesOf=Frame::World()) const =0
of a BodyNode.
void resetCommands()
Set all commands to zero.
Definition MetaSkeleton.cpp:380
double getPotentialEnergy() const
Get the potential energy of this MetaSkeleton.
Definition MetaSkeleton.cpp:1112
Eigen::VectorXd getAccelerationUpperLimits() const
Get the upper limits for all generalized coordinates's acceleration.
Definition MetaSkeleton.cpp:801
void setVelocityLowerLimits(const Eigen::VectorXd &velocities)
Set the lower limits for all generalized coordinates's velocity.
Definition MetaSkeleton.cpp:582
double getPositionUpperLimit(std::size_t _index) const
Get the upper limit of a generalized coordinate's position.
Definition MetaSkeleton.cpp:502
void setVelocityUpperLimits(const Eigen::VectorXd &velocities)
Set the upper limits for all generalized coordinates's velocity.
Definition MetaSkeleton.cpp:626
double getAccelerationUpperLimit(std::size_t _index) const
Get the upper limit of a generalized coordinate's acceleration.
Definition MetaSkeleton.cpp:794
virtual Eigen::Vector3d getCOM(const Frame *_withRespectTo=Frame::World()) const =0
Get the MetaSkeleton's COM with respect to any Frame (default is World Frame)
void setForceUpperLimits(const Eigen::VectorXd &forces)
Set the upperlimits for all generalized coordinates's force.
Definition MetaSkeleton.cpp:918
virtual BodyNode * getBodyNode(std::size_t _idx)=0
Get BodyNode whose index is _idx.
double getKineticEnergy() const
Get the kinetic energy of this MetaSkeleton.
Definition MetaSkeleton.cpp:1106
virtual ~MetaSkeleton()=default
Default destructor.
void setAcceleration(std::size_t _index, double _acceleration)
Set the acceleration of a single generalized coordinate.
Definition MetaSkeleton.cpp:663
void setAccelerationUpperLimit(std::size_t _index, double _acceleration)
Set the upper limit of a generalized coordinate's acceleration.
Definition MetaSkeleton.cpp:765
virtual Eigen::Vector3d getCOMLinearVelocity(const Frame *_relativeTo=Frame::World(), const Frame *_inCoordinatesOf=Frame::World()) const =0
Get the Skeleton's COM linear velocity in terms of any Frame (default is World Frame)
virtual void clearCollidingBodies()=0
Clear collision flags of the BodyNodes in this MetaSkeleton.
Eigen::VectorXd getCommands() const
Get commands for all generalized coordinates.
Definition MetaSkeleton.cpp:365
void eachJoint(Func func) const
Iterates all the Joints in this MetaSkeleton and invokes the callback function.
Definition MetaSkeleton-impl.hpp:88
double getForce(std::size_t _index) const
Get the force of a single generalized coordinate.
Definition MetaSkeleton.cpp:823
void setForce(std::size_t _index, double _force)
Set the force of a single generalized coordinate.
Definition MetaSkeleton.cpp:816
void resetAccelerations()
Set all accelerations to zero.
Definition MetaSkeleton.cpp:708
NameChangedSignal mNameChangedSignal
Definition MetaSkeleton.hpp:1018
virtual math::LinearJacobian getLinearJacobian(const JacobianNode *_node, const Frame *_inCoordinatesOf=Frame::World()) const =0
Get the linear Jacobian targeting the origin of a BodyNode.
void resetPositions()
Set all positions to zero.
Definition MetaSkeleton.cpp:430
virtual bool hasBodyNode(const BodyNode *bodyNode) const =0
Returns whether this Skeleton contains bodyNode.
virtual const std::vector< BodyNode * > & getBodyNodes()=0
Get all the BodyNodes that are held by this MetaSkeleton.
virtual const Eigen::MatrixXd & getMassMatrix() const =0
Get the Mass Matrix of the MetaSkeleton.
virtual const std::vector< DegreeOfFreedom * > & getDofs()=0
Get the vector of DegreesOfFreedom for this MetaSkeleton.
virtual const Eigen::VectorXd & getGravityForces() const =0
Get gravity force vector of the MetaSkeleton.
virtual void clearExternalForces()=0
Clear the external forces of the BodyNodes in this MetaSkeleton.
virtual BodyNode * getBodyNode(const std::string &name)=0
Returns the BodyNode of given name.
virtual const BodyNode * getBodyNode(const std::string &name) const =0
Returns the BodyNode of given name.
virtual std::size_t getNumJoints() const =0
Get number of Joints.
Eigen::VectorXd getPositionUpperLimits() const
Get the upper limits for all generalized coordinates.
Definition MetaSkeleton.cpp:509
virtual math::AngularJacobian getAngularJacobianDeriv(const JacobianNode *_node, const Frame *_inCoordinatesOf=Frame::World()) const =0
Get the angular Jacobian time derivative of a BodyNode.
void setPosition(std::size_t index, double _position)
Set the position of a single generalized coordinate.
Definition MetaSkeleton.cpp:386
virtual double getMass() const =0
Get the total mass of all BodyNodes in this MetaSkeleton.
void setForceLowerLimits(const Eigen::VectorXd &forces)
Set the lower limits for all generalized coordinates's force.
Definition MetaSkeleton.cpp:874
virtual std::unique_ptr< common::LockableReference > getLockableReference() const =0
Returns mutex.
virtual Eigen::Vector3d getCOMLinearAcceleration(const Frame *_relativeTo=Frame::World(), const Frame *_inCoordinatesOf=Frame::World()) const =0
Get the MetaSkeleton's COM linear acceleration in terms of any Frame (default is World Frame)
double getAccelerationLowerLimit(std::size_t _index) const
Get the lower limit of a generalized coordinate's acceleration.
Definition MetaSkeleton.cpp:743
double getForceUpperLimit(std::size_t _index) const
Get the upper limit of a generalized coordinate's force.
Definition MetaSkeleton.cpp:933
virtual Joint * getJoint(std::size_t _idx)=0
Get Joint whose index is _idx.
Eigen::VectorXd getPositionLowerLimits() const
Get the lower limits for all generalized coordinates.
Definition MetaSkeleton.cpp:465
void setAccelerationUpperLimits(const Eigen::VectorXd &accelerations)
Set the upper limits for all generalized coordinates's acceleration.
Definition MetaSkeleton.cpp:773
double getVelocity(std::size_t _index) const
Get the velocity of a single generalized coordinate.
Definition MetaSkeleton.cpp:531
void eachBodyNode(Func func) const
Iterates all the BodyNodes in this MetaSkeleton and invokes the callback function.
Definition MetaSkeleton-impl.hpp:42
void eachDof(Func func) const
Iterates all the DegreeOfFreedoms in this MetaSkeleton and invokes the callback function.
Definition MetaSkeleton-impl.hpp:134
virtual const Eigen::MatrixXd & getInvMassMatrix() const =0
Get inverse of Mass Matrix of the MetaSkeleton.
void setPositionUpperLimits(const Eigen::VectorXd &positions)
Set the upper limits for all generalized coordinates.
Definition MetaSkeleton.cpp:487
virtual math::Jacobian getCOMJacobian(const Frame *_inCoordinatesOf=Frame::World()) const =0
Get the MetaSkeleton's COM Jacobian in terms of any Frame (default is World Frame)
void resetGeneralizedForces()
Set all forces of the generalized coordinates to zero.
Definition MetaSkeleton.cpp:859
void setCommand(std::size_t _index, double _command)
Set a single command.
Definition MetaSkeleton.cpp:336
void setVelocityUpperLimit(std::size_t _index, double _velocity)
Set the upper limit of a generalized coordinate's velocity.
Definition MetaSkeleton.cpp:619
virtual std::size_t getNumBodyNodes() const =0
Get number of body nodes.
void setAccelerationLowerLimit(std::size_t _index, double _acceleration)
Set the lower limit of a generalized coordinate's acceleration.
Definition MetaSkeleton.cpp:714
double getForceLowerLimit(std::size_t _index) const
Get the lower limit of a generalized coordinate's force.
Definition MetaSkeleton.cpp:889
void resetVelocities()
Set all velocities to zero.
Definition MetaSkeleton.cpp:569
virtual math::Jacobian getJacobianClassicDeriv(const JacobianNode *_node) const =0
Get the spatial Jacobian (classical) time derivative targeting the origin of a BodyNode.
Eigen::VectorXd getVelocityUpperLimits() const
Get the upper limits for all generalized coordinates's velocity.
Definition MetaSkeleton.cpp:648
virtual const Eigen::VectorXd & getConstraintForces() const =0
Get constraint force vector.
virtual DegreeOfFreedom * getDof(std::size_t _idx)=0
Get degree of freedom (aka generalized coordinate) whose index is _idx.
Eigen::VectorXd getVelocityLowerLimits() const
Get the lower limits for all generalized coordinates's velocity.
Definition MetaSkeleton.cpp:604
void setForces(const Eigen::VectorXd &_forces)
Set the forces of all generalized coordinates.
Definition MetaSkeleton.cpp:830
void setColor(const Eigen::Vector3d &color)
Sets the RGB color of the BodyNodes that are currently in this MetaSkeleton.
Definition MetaSkeleton.cpp:1118
void setVelocities(const Eigen::VectorXd &_velocities)
Set the velocities of all generalized coordinates.
Definition MetaSkeleton.cpp:538
Eigen::VectorXd getVelocities() const
Get the velocities for all generalized coordinates.
Definition MetaSkeleton.cpp:554
virtual const std::string & setName(const std::string &_name)=0
Set the name of this MetaSkeleton.
double getPositionLowerLimit(std::size_t _index) const
Get the lower limit of a generalized coordinate's position.
Definition MetaSkeleton.cpp:458
void setPositionLowerLimit(std::size_t _index, double _position)
Set the lower limit of a generalized coordinate's position.
Definition MetaSkeleton.cpp:436
void setPositions(const Eigen::VectorXd &_positions)
Set the positions for all generalized coordinates.
Definition MetaSkeleton.cpp:400
double getPosition(std::size_t _index) const
Get the position of a single generalized coordinate.
Definition MetaSkeleton.cpp:393
void setCommands(const Eigen::VectorXd &_commands)
Set commands for all generalized coordinates.
Definition MetaSkeleton.cpp:350
virtual void clearInternalForces()=0
Clear the internal forces of the BodyNodes in this MetaSkeleton.
virtual bool hasJoint(const Joint *joint) const =0
Returns whether this Skeleton contains join.
virtual Eigen::Vector6d getCOMSpatialVelocity(const Frame *_relativeTo=Frame::World(), const Frame *_inCoordinatesOf=Frame::World()) const =0
Get the Skeleton's COM spatial velocity in terms of any Frame (default is World Frame)
virtual const Eigen::VectorXd & getCoriolisAndGravityForces() const =0
Get combined vector of Coriolis force and gravity force of the MetaSkeleton.
virtual const Eigen::MatrixXd & getAugMassMatrix() const =0
Get augmented mass matrix of the skeleton.
virtual math::Jacobian getJacobian(const JacobianNode *_node) const =0
Get the spatial Jacobian targeting the origin of a BodyNode.
Eigen::VectorXd getForceLowerLimits() const
Get the lower limits for all generalized coordinates's force.
Definition MetaSkeleton.cpp:896
virtual math::Jacobian getCOMJacobianSpatialDeriv(const Frame *_inCoordinatesOf=Frame::World()) const =0
Get the Skeleton's COM Jacobian spatial time derivative in terms of any Frame (default is World Frame...
Eigen::VectorXd getForceUpperLimits() const
Get the upper limits for all generalized coordinates's force.
Definition MetaSkeleton.cpp:940
virtual const Eigen::VectorXd & getCoriolisForces() const =0
Get Coriolis force vector of the MetaSkeleton's BodyNodes.
virtual const Eigen::VectorXd & getExternalForces() const =0
Get external force vector of the MetaSkeleton.
void setAlpha(double alpha)
Sets the alpha component of the BodyNodes that are currently in this MetaSkeleton.
Definition MetaSkeleton.cpp:1130
Eigen::VectorXd getAccelerationLowerLimits() const
Get the lower limits for all generalized coordinates's acceleration.
Definition MetaSkeleton.cpp:750
Eigen::VectorXd getPositions() const
Get the positions for all generalized coordinates.
Definition MetaSkeleton.cpp:415
MetaSkeletonPtr cloneMetaSkeleton() const
Creates an identical clone of this MetaSkeleton.
Definition MetaSkeleton.cpp:330
double getAcceleration(std::size_t _index) const
Get the acceleration of a single generalized coordinate.
Definition MetaSkeleton.cpp:670
void setPositionLowerLimits(const Eigen::VectorXd &positions)
Set the lower limits for all generalized coordinates.
Definition MetaSkeleton.cpp:443
virtual std::size_t getIndexOf(const BodyNode *_bn, bool _warning=true) const =0
Get the index of a specific BodyNode within this ReferentialSkeleton.
double getVelocityUpperLimit(std::size_t _index)
Get the upper limit of a generalized coordinate's velocity.
Definition MetaSkeleton.cpp:641
void setForceUpperLimit(std::size_t _index, double _force)
Set the upper limit of a generalized coordinate's force.
Definition MetaSkeleton.cpp:911
void setForceLowerLimit(std::size_t _index, double _force)
Set the lower limit of a generalized coordinate's force.
Definition MetaSkeleton.cpp:867
void setAccelerations(const Eigen::VectorXd &_accelerations)
Set the accelerations of all generalized coordinates.
Definition MetaSkeleton.cpp:677
Eigen::VectorXd getVelocityChanges() const
Get the velocity changes for all the generalized coordinates.
Definition MetaSkeleton.cpp:955
void setPositionUpperLimit(std::size_t _index, double _position)
Set the upper limit of a generalized coordainte's position.
Definition MetaSkeleton.cpp:480
virtual math::AngularJacobian getAngularJacobian(const JacobianNode *_node, const Frame *_inCoordinatesOf=Frame::World()) const =0
Get the angular Jacobian of a BodyNode.
MetaSkeleton(const MetaSkeleton &)=delete
virtual math::LinearJacobian getCOMLinearJacobianDeriv(const Frame *_inCoordinatesOf=Frame::World()) const =0
Get the Skeleton's COM Linear Jacobian time derivative in terms of any Frame (default is World Frame)...
virtual math::Jacobian getWorldJacobian(const JacobianNode *_node) const =0
Get the spatial Jacobian targeting the origin of a BodyNode.
common::SlotRegister< NameChangedSignal > onNameChanged
Definition MetaSkeleton.hpp:1024
virtual double computeKineticEnergy() const =0
Get the kinetic energy of this MetaSkeleton.
void setVelocityLowerLimit(std::size_t _index, double _velocity)
Set the lower limit of a generalized coordinate's velocity.
Definition MetaSkeleton.cpp:575
virtual math::Jacobian getJacobianSpatialDeriv(const JacobianNode *_node) const =0
Get the spatial Jacobian time derivative targeting the origin of a BodyNode.
double getVelocityLowerLimit(std::size_t _index)
Get the lower limit of a generalized coordinate's velocity.
Definition MetaSkeleton.cpp:597
virtual double computePotentialEnergy() const =0
Get the potential energy of this MetaSkeleton.
double getCommand(std::size_t _index) const
Get a single command.
Definition MetaSkeleton.cpp:343
Eigen::VectorXd getAccelerations() const
Get the accelerations for all generalized coordinates.
Definition MetaSkeleton.cpp:693
virtual Eigen::Vector6d getCOMSpatialAcceleration(const Frame *_relativeTo=Frame::World(), const Frame *_inCoordinatesOf=Frame::World()) const =0
Get the Skeleton's COM spatial acceleration in terms of any Frame (default is World Frame)
double computeLagrangian() const
Compute and return Lagrangian of this MetaSkeleton.
Definition MetaSkeleton.cpp:1100
virtual math::LinearJacobian getCOMLinearJacobian(const Frame *_inCoordinatesOf=Frame::World()) const =0
Get the MetaSkeleton's COM Linear Jacobian in terms of any Frame (default is World Frame)
virtual MetaSkeletonPtr cloneMetaSkeleton(const std::string &cloneName) const =0
Creates an identical clone of this MetaSkeleton.
virtual std::vector< Joint * > getJoints()=0
Returns all the joints that are held by this MetaSkeleton.
virtual const std::string & getName() const =0
Get the name of this MetaSkeleton.
void setJointConstraintImpulses(const Eigen::VectorXd &_impulses)
Set the constraint impulses for the generalized coordinates.
Definition MetaSkeleton.cpp:962
Eigen::VectorXd getJointConstraintImpulses() const
Get the constraint impulses for the generalized coordinates.
Definition MetaSkeleton.cpp:969
virtual std::size_t getNumDofs() const =0
Return the number of degrees of freedom in this skeleton.
virtual const Eigen::MatrixXd & getInvAugMassMatrix() const =0
Get inverse of augmented Mass Matrix of the MetaSkeleton.
void setVelocity(std::size_t _index, double _velocity)
Set the velocity of a single generalized coordinate.
Definition MetaSkeleton.cpp:524
virtual const BodyNode * getBodyNode(std::size_t _idx) const =0
Get const BodyNode whose index is _idx.
Definition Random-impl.hpp:92
std::shared_ptr< MetaSkeleton > MetaSkeletonPtr
Definition SmartPointer.hpp:68
Definition BulletCollisionDetector.cpp:60