DART 6.12.2
Loading...
Searching...
No Matches
GenericJoint.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_DETAIL_GenericJoint_HPP_
34#define DART_DYNAMICS_DETAIL_GenericJoint_HPP_
35
36#include "dart/config.hpp"
41#include "dart/math/Helpers.hpp"
42
43#define GenericJoint_REPORT_DIM_MISMATCH(func, arg) \
44 { \
45 dterr << "[GenericJoint::" #func "] Mismatch beteween size of " \
46 << #arg " [" << arg.size() << "] and the number of " \
47 << "DOFs [" << getNumDofs() << "] for Joint named [" \
48 << this->getName() << "].\n"; \
49 assert(false); \
50 }
51
52#define GenericJoint_REPORT_OUT_OF_RANGE(func, index) \
53 { \
54 dterr << "[GenericJoint::" << #func << "] The index [" << index \
55 << "] is out of range for Joint named [" << this->getName() \
56 << "] which has " << this->getNumDofs() << " DOFs.\n"; \
57 assert(false); \
58 }
59
60#define GenericJoint_REPORT_UNSUPPORTED_ACTUATOR(func) \
61 { \
62 dterr << "[GenericJoint::" #func "] Unsupported actuator type (" \
63 << Joint::mAspectProperties.mActuatorType << ") for Joint [" \
64 << this->getName() << "].\n"; \
65 assert(false); \
66 }
67
68#define GenericJoint_SET_IF_DIFFERENT(mField, value) \
69 if (value == Base::mAspectProperties.mField) \
70 return; \
71 Base::mAspectProperties.mField = value; \
72 Joint::incrementVersion();
74namespace dart {
75namespace dynamics {
77//==============================================================================
78//
79// These namespace-level definitions are required to enable ODR-use of static
80// constexpr member variables.
81//
82// See this StackOverflow answer: http://stackoverflow.com/a/14396189/111426
83//
84template <class ConfigSpaceT>
86
87//==============================================================================
88template <class ConfigSpaceT>
90{
91 for (auto i = 0u; i < NumDofs; ++i)
92 delete mDofs[i];
93}
95//==============================================================================
96template <class ConfigSpaceT>
98{
100 setProperties(static_cast<const UniqueProperties&>(properties));
101}
102
103//==============================================================================
104template <class ConfigSpaceT>
107{
108 setAspectProperties(properties);
109}
111//==============================================================================
112template <class ConfigSpaceT>
114{
115 setCommands(state.mCommands);
116 setPositionsStatic(state.mPositions);
117 setVelocitiesStatic(state.mVelocities);
118 setAccelerationsStatic(state.mAccelerations);
119 setForces(state.mForces);
120}
121
122//==============================================================================
123template <class ConfigSpaceT>
126{
127 for (auto i = 0u; i < NumDofs; ++i)
129 setDofName(i, properties.mDofNames[i], properties.mPreserveDofNames[i]);
130 setPositionLowerLimit(i, properties.mPositionLowerLimits[i]);
131 setPositionUpperLimit(i, properties.mPositionUpperLimits[i]);
132 setInitialPosition(i, properties.mInitialPositions[i]);
133 setVelocityLowerLimit(i, properties.mVelocityLowerLimits[i]);
134 setVelocityUpperLimit(i, properties.mVelocityUpperLimits[i]);
135 setInitialVelocity(i, properties.mInitialVelocities[i]);
136 setAccelerationLowerLimit(i, properties.mAccelerationLowerLimits[i]);
137 setAccelerationUpperLimit(i, properties.mAccelerationUpperLimits[i]);
138 setForceLowerLimit(i, properties.mForceLowerLimits[i]);
139 setForceUpperLimit(i, properties.mForceUpperLimits[i]);
140 setSpringStiffness(i, properties.mSpringStiffnesses[i]);
141 setRestPosition(i, properties.mRestPositions[i]);
142 setDampingCoefficient(i, properties.mDampingCoefficients[i]);
143 setCoulombFriction(i, properties.mFrictions[i]);
144 }
145}
147//==============================================================================
148template <class ConfigSpaceT>
151{
153 Joint::mAspectProperties, Base::mAspectProperties);
154}
155
156//==============================================================================
157template <class ConfigSpaceT>
159{
160 if (this == &other)
161 return;
162
163 setProperties(other.getGenericJointProperties());
165
166//==============================================================================
167template <class ConfigSpaceT>
169{
170 if (nullptr == other)
171 return;
172
173 copy(*other);
174}
175
176//==============================================================================
177template <class ConfigSpaceT>
180{
181 copy(other);
182 return *this;
183}
184
185//==============================================================================
186template <class ConfigSpaceT>
189 if (index < NumDofs)
190 return mDofs[index];
193
194 return nullptr;
195}
196
197//==============================================================================
198template <class ConfigSpaceT>
201 if (index < NumDofs)
202 return mDofs[index];
205
206 return nullptr;
207}
208
209//==============================================================================
210template <class ConfigSpaceT>
213 return NumDofs;
214}
216//==============================================================================
217template <class ConfigSpaceT>
219 size_t index, const std::string& name, bool preserveName)
220{
221 if (NumDofs <= index)
222 {
223 dterr << "[GenericJoint::setDofName] Attempting to set the name of DOF "
224 << "index " << index << ", which is out of bounds for the Joint ["
225 << this->getName()
226 << "]. We will set the name of DOF index 0 instead.\n";
227 assert(false);
228 index = 0u;
229 }
231 preserveDofName(index, preserveName);
232
233 std::string& dofName = Base::mAspectProperties.mDofNames[index];
234
235 if (name == dofName)
236 return dofName;
237
238 const SkeletonPtr& skel
239 = this->mChildBodyNode ? this->mChildBodyNode->getSkeleton() : nullptr;
240 if (skel)
241 dofName = skel->mNameMgrForDofs.changeObjectName(mDofs[index], name);
242 else
243 dofName = name;
244
245 return dofName;
246}
247
248//==============================================================================
249template <class ConfigSpaceT>
251{
252 if (NumDofs <= index)
253 {
255 return;
256 }
258 GenericJoint_SET_IF_DIFFERENT(mPreserveDofNames[index], preserve);
259}
261//==============================================================================
262template <class ConfigSpaceT>
264{
265 if (NumDofs <= index)
267 GenericJoint_REPORT_OUT_OF_RANGE(isDofNamePreserved, index);
268 index = 0;
270
271 return Base::mAspectProperties.mPreserveDofNames[index];
273
274//==============================================================================
275template <class ConfigSpaceT>
276const std::string& GenericJoint<ConfigSpaceT>::getDofName(size_t index) const
277{
278 if (NumDofs <= index)
279 {
280 dterr << "[GenericJoint::getDofName] Requested name of DOF index [" << index
281 << "] in Joint [" << this->getName() << "], but that is "
282 << "out of bounds (max " << NumDofs - 1
283 << "). Returning name of DOF 0.\n";
284 assert(false);
285 return Base::mAspectProperties.mDofNames[0];
286 }
288 return Base::mAspectProperties.mDofNames[index];
289}
291//==============================================================================
292template <class ConfigSpaceT>
294{
295 if (index >= getNumDofs())
297 GenericJoint_REPORT_OUT_OF_RANGE(getIndexInSkeleton, index);
298 return 0;
300
301 return mDofs[index]->mIndexInSkeleton;
303
304//==============================================================================
305template <class ConfigSpaceT>
307{
308 if (index >= getNumDofs())
309 {
311 return 0;
312 }
313
314 return mDofs[index]->mIndexInTree;
315}
316
317//==============================================================================
318template <class ConfigSpaceT>
321 if (index >= getNumDofs())
324 switch (Joint::mAspectProperties.mActuatorType)
325 {
327 this->mAspectState.mCommands[index] = math::clip(
328 command,
329 Base::mAspectProperties.mForceLowerLimits[index],
330 Base::mAspectProperties.mForceUpperLimits[index]);
331 break;
333 if (0.0 != command)
334 {
335 dtwarn << "[GenericJoint::setCommand] Attempting to set a non-zero ("
336 << command << ") command for a PASSIVE joint ["
337 << this->getName() << "].\n";
339 this->mAspectState.mCommands[index] = command;
340 break;
341 case Joint::SERVO:
342 this->mAspectState.mCommands[index] = math::clip(
343 command,
344 Base::mAspectProperties.mVelocityLowerLimits[index],
345 Base::mAspectProperties.mVelocityUpperLimits[index]);
346 break;
347 case Joint::MIMIC:
348 if (0.0 != command)
349 {
350 dtwarn << "[GenericJoint::setCommand] Attempting to set a non-zero ("
351 << command << ") command for a MIMIC joint [" << this->getName()
352 << "].\n";
353 }
354 this->mAspectState.mCommands[index] = math::clip(
355 command,
356 Base::mAspectProperties.mVelocityLowerLimits[index],
357 Base::mAspectProperties.mVelocityUpperLimits[index]);
358 break;
360 this->mAspectState.mCommands[index] = math::clip(
361 command,
362 Base::mAspectProperties.mAccelerationLowerLimits[index],
363 Base::mAspectProperties.mAccelerationUpperLimits[index]);
364 break;
365 case Joint::VELOCITY:
366 this->mAspectState.mCommands[index] = math::clip(
367 command,
368 Base::mAspectProperties.mVelocityLowerLimits[index],
369 Base::mAspectProperties.mVelocityUpperLimits[index]);
370 // TODO: This possibly makes the acceleration to exceed the limits.
371 break;
373 if (0.0 != command)
374 {
375 dtwarn << "[GenericJoint::setCommand] Attempting to set a non-zero ("
376 << command << ") command for a LOCKED joint [" << this->getName()
377 << "].\n";
379 this->mAspectState.mCommands[index] = command;
380 break;
381 default:
382 assert(false);
383 break;
385}
386
387//==============================================================================
388template <class ConfigSpaceT>
391 if (index >= getNumDofs())
392 {
394 return 0.0;
395 }
397 return this->mAspectState.mCommands[index];
398}
399
400//==============================================================================
401template <class ConfigSpaceT>
402void GenericJoint<ConfigSpaceT>::setCommands(const Eigen::VectorXd& commands)
403{
404 if (static_cast<size_t>(commands.size()) != getNumDofs())
406 GenericJoint_REPORT_DIM_MISMATCH(setCommands, commands);
407 return;
409
410 switch (Joint::mAspectProperties.mActuatorType)
412 case Joint::FORCE:
413 this->mAspectState.mCommands = math::clip(
414 commands,
415 Base::mAspectProperties.mForceLowerLimits,
416 Base::mAspectProperties.mForceUpperLimits);
417 break;
418 case Joint::PASSIVE:
419 if (Vector::Zero() != commands)
421 dtwarn << "[GenericJoint::setCommands] Attempting to set a non-zero ("
422 << commands.transpose() << ") command for a PASSIVE joint ["
423 << this->getName() << "].\n";
424 }
425 this->mAspectState.mCommands = commands;
426 break;
427 case Joint::SERVO:
428 this->mAspectState.mCommands = math::clip(
429 commands,
430 Base::mAspectProperties.mVelocityLowerLimits,
431 Base::mAspectProperties.mVelocityUpperLimits);
432 break;
433 case Joint::MIMIC:
434 if (Vector::Zero() != commands)
436 dtwarn << "[GenericJoint::setCommands] Attempting to set a non-zero ("
437 << commands.transpose() << ") command for a MIMIC joint ["
438 << this->getName() << "].\n";
439 }
440 this->mAspectState.mCommands = math::clip(
441 commands,
442 Base::mAspectProperties.mVelocityLowerLimits,
443 Base::mAspectProperties.mVelocityUpperLimits);
444 break;
446 this->mAspectState.mCommands = math::clip(
447 commands,
448 Base::mAspectProperties.mAccelerationLowerLimits,
449 Base::mAspectProperties.mAccelerationUpperLimits);
450 break;
451 case Joint::VELOCITY:
452 this->mAspectState.mCommands = math::clip(
453 commands,
454 Base::mAspectProperties.mVelocityLowerLimits,
455 Base::mAspectProperties.mVelocityUpperLimits);
456 // TODO: This possibly makes the acceleration to exceed the limits.
457 break;
459 if (Vector::Zero() != commands)
460 {
461 dtwarn << "[GenericJoint::setCommands] Attempting to set a non-zero ("
462 << commands.transpose() << ") command for a LOCKED joint ["
463 << this->getName() << "].\n";
465 this->mAspectState.mCommands = commands;
466 break;
467 default:
468 assert(false);
469 break;
471}
472
473//==============================================================================
474template <class ConfigSpaceT>
477 return this->mAspectState.mCommands;
478}
479
480//==============================================================================
481template <class ConfigSpaceT>
483{
484 this->mAspectState.mCommands.setZero();
486
487//==============================================================================
488template <class ConfigSpaceT>
491 if (index >= getNumDofs())
492 {
494 return;
495 }
496
497 if (this->mAspectState.mPositions[index] == position)
498 return;
499 // TODO(JS): Above code should be changed something like:
500 // if (ConfigSpaceT::getEuclideanPoint(mPositions, index) == position)
501 // return;
502
503 // Note: It would not make much sense to use setPositionsStatic() here
504 this->mAspectState.mPositions[index] = position;
505 this->notifyPositionUpdated();
506}
507
508//==============================================================================
509template <class ConfigSpaceT>
511{
512 if (index >= getNumDofs())
513 {
515 return 0.0;
516 }
517
518 return getPositionsStatic()[index];
519}
521//==============================================================================
522template <class ConfigSpaceT>
523void GenericJoint<ConfigSpaceT>::setPositions(const Eigen::VectorXd& positions)
524{
525 if (static_cast<size_t>(positions.size()) != getNumDofs())
526 {
527 GenericJoint_REPORT_DIM_MISMATCH(setPositions, positions);
528 return;
529 }
531 setPositionsStatic(positions);
532}
533
534//==============================================================================
535template <class ConfigSpaceT>
538 return getPositionsStatic();
539}
541//==============================================================================
542template <class ConfigSpaceT>
544 size_t index, double position)
545{
546 if (index >= getNumDofs())
547 {
548 GenericJoint_REPORT_OUT_OF_RANGE(setPositionLowerLimit, index);
549 return;
550 }
551
552 GenericJoint_SET_IF_DIFFERENT(mPositionLowerLimits[index], position);
553}
555//==============================================================================
556template <class ConfigSpaceT>
558{
559 if (index >= getNumDofs())
561 GenericJoint_REPORT_OUT_OF_RANGE(getPositionLowerLimit, index);
562 return 0.0;
563 }
564
565 return Base::mAspectProperties.mPositionLowerLimits[index];
566}
567
568//==============================================================================
569template <class ConfigSpaceT>
571 const Eigen::VectorXd& lowerLimits)
572{
573 if (static_cast<size_t>(lowerLimits.size()) != getNumDofs())
574 {
575 GenericJoint_REPORT_DIM_MISMATCH(setPositionLowerLimits, lowerLimits);
576 return;
578
579 GenericJoint_SET_IF_DIFFERENT(mPositionLowerLimits, lowerLimits);
580}
581
582//==============================================================================
583template <class ConfigSpaceT>
585{
586 return Base::mAspectProperties.mPositionLowerLimits;
587}
588
589//==============================================================================
590template <class ConfigSpaceT>
592 size_t index, double position)
593{
594 if (index >= getNumDofs())
595 {
596 GenericJoint_REPORT_OUT_OF_RANGE(setPositionUpperLimit, index);
597 return;
598 }
599
601}
602
603//==============================================================================
604template <class ConfigSpaceT>
606{
607 if (index >= getNumDofs())
608 {
609 GenericJoint_REPORT_OUT_OF_RANGE(getPositionUpperLimit, index);
610 return 0.0;
611 }
612
613 return Base::mAspectProperties.mPositionUpperLimits[index];
614}
615
616//==============================================================================
617template <class ConfigSpaceT>
619 const Eigen::VectorXd& upperLimits)
620{
621 if (static_cast<size_t>(upperLimits.size()) != getNumDofs())
622 {
623 GenericJoint_REPORT_DIM_MISMATCH(setPositionUpperLimits, upperLimits);
624 return;
625 }
626
627 GenericJoint_SET_IF_DIFFERENT(mPositionUpperLimits, upperLimits);
628}
629
630//==============================================================================
631template <class ConfigSpaceT>
633{
634 return Base::mAspectProperties.mPositionUpperLimits;
635}
636
637//==============================================================================
638template <class ConfigSpaceT>
640{
641 if (index >= getNumDofs())
642 {
643 GenericJoint_REPORT_OUT_OF_RANGE(hasPositionLimit, index);
644 return true;
646
647 return std::isfinite(Base::mAspectProperties.mPositionUpperLimits[index])
648 || std::isfinite(Base::mAspectProperties.mPositionLowerLimits[index]);
649}
650
651//==============================================================================
652template <class ConfigSpaceT>
654{
655 if (index >= getNumDofs())
656 {
658 return;
659 }
660
661 setPosition(index, Base::mAspectProperties.mInitialPositions[index]);
663
664//==============================================================================
665template <class ConfigSpaceT>
667{
668 setPositionsStatic(Base::mAspectProperties.mInitialPositions);
670
671//==============================================================================
672template <class ConfigSpaceT>
674 size_t index, double initial)
675{
676 if (index >= getNumDofs())
677 {
678 GenericJoint_REPORT_OUT_OF_RANGE(setInitialPosition, index);
679 return;
680 }
681
682 GenericJoint_SET_IF_DIFFERENT(mInitialPositions[index], initial);
683}
684
685//==============================================================================
686template <class ConfigSpaceT>
688{
689 if (index >= getNumDofs())
690 {
691 GenericJoint_REPORT_OUT_OF_RANGE(getInitialPosition, index);
692 return 0.0;
693 }
694
695 return Base::mAspectProperties.mInitialPositions[index];
696}
697
698//==============================================================================
699template <class ConfigSpaceT>
701 const Eigen::VectorXd& initial)
702{
703 if (static_cast<size_t>(initial.size()) != getNumDofs())
704 {
705 GenericJoint_REPORT_DIM_MISMATCH(setInitialPositions, initial);
706 return;
707 }
708
709 GenericJoint_SET_IF_DIFFERENT(mInitialPositions, initial);
710}
711
712//==============================================================================
713template <class ConfigSpaceT>
715{
716 return Base::mAspectProperties.mInitialPositions;
717}
718
719//==============================================================================
720template <class ConfigSpaceT>
722{
723 if (this->mAspectState.mPositions == positions)
724 return;
725
726 this->mAspectState.mPositions = positions;
727 this->notifyPositionUpdated();
728}
729
730//==============================================================================
731template <class ConfigSpaceT>
734{
735 return this->mAspectState.mPositions;
736}
737
738//==============================================================================
739template <class ConfigSpaceT>
741{
742 if (this->mAspectState.mVelocities == velocities)
743 return;
744
745 this->mAspectState.mVelocities = velocities;
746 this->notifyVelocityUpdated();
748
749//==============================================================================
750template <class ConfigSpaceT>
753{
754 return this->mAspectState.mVelocities;
756
757//==============================================================================
758template <class ConfigSpaceT>
760{
761 if (this->mAspectState.mAccelerations == accels)
762 return;
764 this->mAspectState.mAccelerations = accels;
765 this->notifyAccelerationUpdated();
767
768//==============================================================================
769template <class ConfigSpaceT>
772{
773 return this->mAspectState.mAccelerations;
774}
776//==============================================================================
777template <class ConfigSpaceT>
779{
780 if (index >= getNumDofs())
783 return;
784 }
785
786 if (this->mAspectState.mVelocities[index] == velocity)
787 return;
788
789 // Note: It would not make much sense to use setVelocitiesStatic() here
790 this->mAspectState.mVelocities[index] = velocity;
791 this->notifyVelocityUpdated();
792
793 if (Joint::mAspectProperties.mActuatorType == Joint::VELOCITY)
794 this->mAspectState.mCommands[index] = this->getVelocitiesStatic()[index];
795}
796
797//==============================================================================
798template <class ConfigSpaceT>
800{
801 if (index >= getNumDofs())
802 {
804 return 0.0;
805 }
806
807 return getVelocitiesStatic()[index];
808}
809
810//==============================================================================
811template <class ConfigSpaceT>
813 const Eigen::VectorXd& velocities)
814{
815 if (static_cast<size_t>(velocities.size()) != getNumDofs())
816 {
817 GenericJoint_REPORT_DIM_MISMATCH(setVelocities, velocities);
818 return;
819 }
820
821 setVelocitiesStatic(velocities);
822
823 if (Joint::mAspectProperties.mActuatorType == Joint::VELOCITY)
824 this->mAspectState.mCommands = this->getVelocitiesStatic();
825}
826
827//==============================================================================
828template <class ConfigSpaceT>
830{
831 return getVelocitiesStatic();
832}
833
834//==============================================================================
835template <class ConfigSpaceT>
837 size_t index, double velocity)
838{
839 if (index >= getNumDofs())
840 {
841 GenericJoint_REPORT_OUT_OF_RANGE(setVelocityLowerLimit, index);
842 return;
843 }
844
845 GenericJoint_SET_IF_DIFFERENT(mVelocityLowerLimits[index], velocity);
846}
847
848//==============================================================================
849template <class ConfigSpaceT>
851{
852 if (index >= getNumDofs())
853 {
854 GenericJoint_REPORT_OUT_OF_RANGE(getVelocityLowerLimit, index);
855 return 0.0;
856 }
857
858 return Base::mAspectProperties.mVelocityLowerLimits[index];
859}
860
861//==============================================================================
862template <class ConfigSpaceT>
864 const Eigen::VectorXd& lowerLimits)
865{
866 if (static_cast<size_t>(lowerLimits.size()) != getNumDofs())
867 {
868 GenericJoint_REPORT_DIM_MISMATCH(setVelocityLowerLimits, lowerLimits);
869 return;
870 }
871
872 GenericJoint_SET_IF_DIFFERENT(mVelocityLowerLimits, lowerLimits);
873}
874
875//==============================================================================
876template <class ConfigSpaceT>
878{
879 return Base::mAspectProperties.mVelocityLowerLimits;
880}
881
882//==============================================================================
883template <class ConfigSpaceT>
885 size_t index, double velocity)
886{
887 if (index >= getNumDofs())
888 {
889 GenericJoint_REPORT_OUT_OF_RANGE(setVelocityUpperLimit, index);
890 return;
891 }
892
893 GenericJoint_SET_IF_DIFFERENT(mVelocityUpperLimits[index], velocity);
894}
895
896//==============================================================================
897template <class ConfigSpaceT>
899{
900 if (index >= getNumDofs())
901 {
902 GenericJoint_REPORT_OUT_OF_RANGE(getVelocityUpperLimit, index);
903 return 0.0;
904 }
905
906 return Base::mAspectProperties.mVelocityUpperLimits[index];
907}
908
909//==============================================================================
910template <class ConfigSpaceT>
912 const Eigen::VectorXd& upperLimits)
913{
914 if (static_cast<size_t>(upperLimits.size()) != getNumDofs())
915 {
916 GenericJoint_REPORT_DIM_MISMATCH(setVelocityUpperLimits, upperLimits);
917 return;
918 }
919
920 GenericJoint_SET_IF_DIFFERENT(mVelocityUpperLimits, upperLimits);
921}
922
923//==============================================================================
924template <class ConfigSpaceT>
926{
927 return Base::mAspectProperties.mVelocityUpperLimits;
928}
929
930//==============================================================================
931template <class ConfigSpaceT>
933{
934 if (index >= getNumDofs())
935 {
937 return;
938 }
939
940 setVelocity(index, Base::mAspectProperties.mInitialVelocities[index]);
941}
942
943//==============================================================================
944template <class ConfigSpaceT>
946{
947 setVelocitiesStatic(Base::mAspectProperties.mInitialVelocities);
948}
949
950//==============================================================================
951template <class ConfigSpaceT>
953 size_t index, double initial)
954{
955 if (index >= getNumDofs())
956 {
957 GenericJoint_REPORT_OUT_OF_RANGE(setInitialVelocity, index);
958 return;
959 }
960
961 GenericJoint_SET_IF_DIFFERENT(mInitialVelocities[index], initial);
962}
963
964//==============================================================================
965template <class ConfigSpaceT>
967{
968 if (index >= getNumDofs())
969 {
970 GenericJoint_REPORT_OUT_OF_RANGE(getInitialVelocity, index);
971 return 0.0;
972 }
973
974 return Base::mAspectProperties.mInitialVelocities[index];
975}
976
977//==============================================================================
978template <class ConfigSpaceT>
980 const Eigen::VectorXd& initial)
981{
982 if (static_cast<size_t>(initial.size()) != getNumDofs())
983 {
984 GenericJoint_REPORT_DIM_MISMATCH(setInitialVelocities, initial);
985 return;
986 }
987
988 GenericJoint_SET_IF_DIFFERENT(mInitialVelocities, initial);
989}
990
991//==============================================================================
992template <class ConfigSpaceT>
994{
995 return Base::mAspectProperties.mInitialVelocities;
996}
997
998//==============================================================================
999template <class ConfigSpaceT>
1001 size_t index, double acceleration)
1002{
1003 if (index >= getNumDofs())
1004 {
1005 GenericJoint_REPORT_OUT_OF_RANGE(setAcceleration, index);
1006 return;
1007 }
1008
1009 if (this->mAspectState.mAccelerations[index] == acceleration)
1010 return;
1011
1012 // Note: It would not make much sense to use setAccelerationsStatic() here
1013 this->mAspectState.mAccelerations[index] = acceleration;
1014 this->notifyAccelerationUpdated();
1015
1016 if (Joint::mAspectProperties.mActuatorType == Joint::ACCELERATION)
1017 this->mAspectState.mCommands[index] = this->getAccelerationsStatic()[index];
1018}
1019
1020//==============================================================================
1021template <class ConfigSpaceT>
1023{
1024 if (index >= getNumDofs())
1025 {
1026 GenericJoint_REPORT_OUT_OF_RANGE(getAcceleration, index);
1027 return 0.0;
1028 }
1029
1030 return getAccelerationsStatic()[index];
1031}
1032
1033//==============================================================================
1034template <class ConfigSpaceT>
1036 const Eigen::VectorXd& accelerations)
1037{
1038 if (static_cast<size_t>(accelerations.size()) != getNumDofs())
1039 {
1040 GenericJoint_REPORT_DIM_MISMATCH(setAccelerations, accelerations);
1041 return;
1042 }
1043
1044 setAccelerationsStatic(accelerations);
1045
1046 if (Joint::mAspectProperties.mActuatorType == Joint::ACCELERATION)
1047 this->mAspectState.mCommands = this->getAccelerationsStatic();
1048}
1049
1050//==============================================================================
1051template <class ConfigSpaceT>
1053{
1054 return getAccelerationsStatic();
1055}
1056
1057//==============================================================================
1058template <class ConfigSpaceT>
1060 size_t index, double acceleration)
1061{
1062 if (index >= getNumDofs())
1063 {
1064 GenericJoint_REPORT_OUT_OF_RANGE(setAccelerationLowerLimit, index);
1065 return;
1066 }
1067
1068 GenericJoint_SET_IF_DIFFERENT(mAccelerationLowerLimits[index], acceleration);
1069}
1070
1071//==============================================================================
1072template <class ConfigSpaceT>
1074{
1075 if (index >= getNumDofs())
1076 {
1077 GenericJoint_REPORT_OUT_OF_RANGE(getAccelerationLowerLimit, index);
1078 return 0.0;
1079 }
1080
1081 return Base::mAspectProperties.mAccelerationLowerLimits[index];
1082}
1083
1084//==============================================================================
1085template <class ConfigSpaceT>
1087 const Eigen::VectorXd& lowerLimits)
1088{
1089 if (static_cast<size_t>(lowerLimits.size()) != getNumDofs())
1090 {
1091 GenericJoint_REPORT_DIM_MISMATCH(setAccelerationLowerLimits, lowerLimits);
1092 return;
1093 }
1094
1095 GenericJoint_SET_IF_DIFFERENT(mAccelerationLowerLimits, lowerLimits);
1096}
1097
1098//==============================================================================
1099template <class ConfigSpaceT>
1101{
1102 return Base::mAspectProperties.mAccelerationLowerLimits;
1103}
1104
1105//==============================================================================
1106template <class ConfigSpaceT>
1108 size_t index, double acceleration)
1109{
1110 if (index >= getNumDofs())
1111 {
1112 GenericJoint_REPORT_OUT_OF_RANGE(setAccelerationUpperLimit, index) return;
1113 }
1114
1115 GenericJoint_SET_IF_DIFFERENT(mAccelerationUpperLimits[index], acceleration);
1116}
1117
1118//==============================================================================
1119template <class ConfigSpaceT>
1121{
1122 if (index >= getNumDofs())
1123 {
1124 GenericJoint_REPORT_OUT_OF_RANGE(getAccelerationUpperLimit, index);
1125 return 0.0;
1126 }
1127
1128 return Base::mAspectProperties.mAccelerationUpperLimits[index];
1129}
1130
1131//==============================================================================
1132template <class ConfigSpaceT>
1134 const Eigen::VectorXd& upperLimits)
1135{
1136 if (static_cast<size_t>(upperLimits.size()) != getNumDofs())
1137 {
1138 GenericJoint_REPORT_DIM_MISMATCH(setAccelerationUpperLimits, upperLimits);
1139 return;
1140 }
1141
1142 GenericJoint_SET_IF_DIFFERENT(mAccelerationUpperLimits, upperLimits);
1143}
1144
1145//==============================================================================
1146template <class ConfigSpaceT>
1148{
1149 return Base::mAspectProperties.mAccelerationUpperLimits;
1150}
1151
1152//==============================================================================
1153template <class ConfigSpaceT>
1155{
1156 setAccelerationsStatic(Vector::Zero());
1157}
1158
1159//==============================================================================
1160template <class ConfigSpaceT>
1162{
1163 if (index >= getNumDofs())
1164 {
1166 return;
1167 }
1168
1169 this->mAspectState.mForces[index] = force;
1170
1171 if (Joint::mAspectProperties.mActuatorType == Joint::FORCE)
1172 this->mAspectState.mCommands[index] = this->mAspectState.mForces[index];
1173}
1174
1175//==============================================================================
1176template <class ConfigSpaceT>
1178{
1179 if (index >= getNumDofs())
1180 {
1182 return 0.0;
1183 }
1184
1185 return this->mAspectState.mForces[index];
1186}
1187
1188//==============================================================================
1189template <class ConfigSpaceT>
1190void GenericJoint<ConfigSpaceT>::setForces(const Eigen::VectorXd& forces)
1191{
1192 if (static_cast<size_t>(forces.size()) != getNumDofs())
1193 {
1194 GenericJoint_REPORT_DIM_MISMATCH(setForces, forces);
1195 return;
1196 }
1197
1198 this->mAspectState.mForces = forces;
1199
1200 if (Joint::mAspectProperties.mActuatorType == Joint::FORCE)
1201 this->mAspectState.mCommands = this->mAspectState.mForces;
1202}
1203
1204//==============================================================================
1205template <class ConfigSpaceT>
1207{
1208 return this->mAspectState.mForces;
1209}
1210
1211//==============================================================================
1212template <class ConfigSpaceT>
1214{
1215 if (index >= getNumDofs())
1216 {
1217 GenericJoint_REPORT_OUT_OF_RANGE(setForceLowerLimit, index);
1218 return;
1219 }
1220
1221 GenericJoint_SET_IF_DIFFERENT(mForceLowerLimits[index], force);
1222}
1223
1224//==============================================================================
1225template <class ConfigSpaceT>
1227{
1228 if (index >= getNumDofs())
1229 {
1230 GenericJoint_REPORT_OUT_OF_RANGE(getForceLowerLimit, index);
1231 return 0.0;
1232 }
1233
1234 return Base::mAspectProperties.mForceLowerLimits[index];
1235}
1236
1237//==============================================================================
1238template <class ConfigSpaceT>
1240 const Eigen::VectorXd& lowerLimits)
1241{
1242 if (static_cast<size_t>(lowerLimits.size()) != getNumDofs())
1243 {
1244 GenericJoint_REPORT_DIM_MISMATCH(setForceLowerLimits, lowerLimits);
1245 return;
1246 }
1247
1248 GenericJoint_SET_IF_DIFFERENT(mForceLowerLimits, lowerLimits);
1249}
1250
1251//==============================================================================
1252template <class ConfigSpaceT>
1254{
1255 return Base::mAspectProperties.mForceLowerLimits;
1256}
1257
1258//==============================================================================
1259template <class ConfigSpaceT>
1261{
1262 if (index >= getNumDofs())
1263 {
1264 GenericJoint_REPORT_OUT_OF_RANGE(setForceUpperLimit, index);
1265 return;
1266 }
1267
1268 GenericJoint_SET_IF_DIFFERENT(mForceUpperLimits[index], force);
1269}
1270
1271//==============================================================================
1272template <class ConfigSpaceT>
1274{
1275 if (index >= getNumDofs())
1276 {
1277 GenericJoint_REPORT_OUT_OF_RANGE(getForceUpperLimit, index);
1278 return 0.0;
1279 }
1280
1281 return Base::mAspectProperties.mForceUpperLimits[index];
1282}
1283
1284//==============================================================================
1285template <class ConfigSpaceT>
1287 const Eigen::VectorXd& upperLimits)
1288{
1289 if (static_cast<size_t>(upperLimits.size()) != getNumDofs())
1290 {
1291 GenericJoint_REPORT_DIM_MISMATCH(setForceUpperLimits, upperLimits);
1292 return;
1293 }
1294
1295 GenericJoint_SET_IF_DIFFERENT(mForceUpperLimits, upperLimits);
1296}
1297
1298//==============================================================================
1299template <class ConfigSpaceT>
1301{
1302 return Base::mAspectProperties.mForceUpperLimits;
1303}
1304
1305//==============================================================================
1306template <class ConfigSpaceT>
1308{
1309 this->mAspectState.mForces.setZero();
1310
1311 if (Joint::mAspectProperties.mActuatorType == Joint::FORCE)
1312 this->mAspectState.mCommands = this->mAspectState.mForces;
1313}
1314
1315//==============================================================================
1316template <class ConfigSpaceT>
1318 size_t index, double velocityChange)
1319{
1320 if (index >= getNumDofs())
1321 {
1322 GenericJoint_REPORT_OUT_OF_RANGE(setVelocityChange, index);
1323 return;
1324 }
1325
1326 mVelocityChanges[index] = velocityChange;
1327}
1328
1329//==============================================================================
1330template <class ConfigSpaceT>
1332{
1333 if (index >= getNumDofs())
1334 {
1335 GenericJoint_REPORT_OUT_OF_RANGE(getVelocityChange, index);
1336 return 0.0;
1337 }
1338
1339 return mVelocityChanges[index];
1340}
1341
1342//==============================================================================
1343template <class ConfigSpaceT>
1345{
1346 mVelocityChanges.setZero();
1347}
1348
1349//==============================================================================
1350template <class ConfigSpaceT>
1352 size_t index, double impulse)
1353{
1354 if (index >= getNumDofs())
1355 {
1356 GenericJoint_REPORT_OUT_OF_RANGE(setConstraintImpulse, index);
1357 return;
1358 }
1359
1360 mConstraintImpulses[index] = impulse;
1361}
1362
1363//==============================================================================
1364template <class ConfigSpaceT>
1366{
1367 if (index >= getNumDofs())
1368 {
1369 GenericJoint_REPORT_OUT_OF_RANGE(getConstraintImpulse, index);
1370 return 0.0;
1371 }
1372
1373 return mConstraintImpulses[index];
1374}
1375
1376//==============================================================================
1377template <class ConfigSpaceT>
1379{
1380 mConstraintImpulses.setZero();
1381}
1382
1383//==============================================================================
1384template <class ConfigSpaceT>
1386{
1387 const Point& point = math::integratePosition<ConfigSpaceT>(
1388 math::toManifoldPoint<ConfigSpaceT>(getPositionsStatic()),
1389 getVelocitiesStatic(),
1390 dt);
1391
1392 setPositionsStatic(math::toEuclideanPoint<ConfigSpaceT>(point));
1393}
1394
1395//==============================================================================
1396template <class ConfigSpaceT>
1398{
1399 setVelocitiesStatic(math::integrateVelocity<ConfigSpaceT>(
1400 getVelocitiesStatic(), getAccelerationsStatic(), dt));
1401}
1402
1403//==============================================================================
1404template <class ConfigSpaceT>
1406 const Eigen::VectorXd& q2, const Eigen::VectorXd& q1) const
1407{
1408 if (static_cast<size_t>(q1.size()) != getNumDofs()
1409 || static_cast<size_t>(q2.size()) != getNumDofs())
1410 {
1411 dterr << "[GenericJoint::getPositionsDifference] q1's size [" << q1.size()
1412 << "] or q2's size [" << q2.size() << "] must both equal the dof ["
1413 << this->getNumDofs() << "] for Joint [" << this->getName() << "].\n";
1414 assert(false);
1415 return Eigen::VectorXd::Zero(getNumDofs());
1416 }
1417
1418 return getPositionDifferencesStatic(q2, q1);
1419}
1420
1421//==============================================================================
1422template <class ConfigSpaceT>
1423typename ConfigSpaceT::Vector
1425 const Vector& q2, const Vector& q1) const
1426{
1427 return q2 - q1;
1428 // TODO(JS): Move this implementation to each configuration space classes.
1429}
1430
1431//==============================================================================
1432template <class ConfigSpaceT>
1434{
1435 if (index >= getNumDofs())
1436 {
1437 GenericJoint_REPORT_OUT_OF_RANGE(setSpringStiffness, index);
1438 return;
1439 }
1440
1441 assert(k >= 0.0);
1442
1443 GenericJoint_SET_IF_DIFFERENT(mSpringStiffnesses[index], k);
1444}
1445
1446//==============================================================================
1447template <class ConfigSpaceT>
1449{
1450 if (index >= getNumDofs())
1451 {
1452 GenericJoint_REPORT_OUT_OF_RANGE(getSpringStiffness, index);
1453 return 0.0;
1454 }
1455
1456 return Base::mAspectProperties.mSpringStiffnesses[index];
1457}
1458
1459//==============================================================================
1460template <class ConfigSpaceT>
1462{
1463 if (index >= getNumDofs())
1464 {
1465 GenericJoint_REPORT_OUT_OF_RANGE(setRestPosition, index);
1466 return;
1467 }
1468
1469 GenericJoint_SET_IF_DIFFERENT(mRestPositions[index], q0);
1470}
1471
1472//==============================================================================
1473template <class ConfigSpaceT>
1475{
1476 if (index >= getNumDofs())
1477 {
1478 GenericJoint_REPORT_OUT_OF_RANGE(getRestPosition, index);
1479 return 0.0;
1480 }
1481
1482 return Base::mAspectProperties.mRestPositions[index];
1483}
1484
1485//==============================================================================
1486template <class ConfigSpaceT>
1488{
1489 if (index >= getNumDofs())
1490 {
1491 GenericJoint_REPORT_OUT_OF_RANGE(setDampingCoefficient, index);
1492 return;
1493 }
1494
1495 assert(d >= 0.0);
1496
1497 GenericJoint_SET_IF_DIFFERENT(mDampingCoefficients[index], d);
1498}
1499
1500//==============================================================================
1501template <class ConfigSpaceT>
1503{
1504 if (index >= getNumDofs())
1505 {
1506 GenericJoint_REPORT_OUT_OF_RANGE(getDampingCoefficient, index);
1507 return 0.0;
1508 }
1509
1510 return Base::mAspectProperties.mDampingCoefficients[index];
1511}
1512
1513//==============================================================================
1514template <class ConfigSpaceT>
1516 size_t index, double friction)
1517{
1518 if (index >= getNumDofs())
1519 {
1520 GenericJoint_REPORT_OUT_OF_RANGE(setCoulombFriction, index);
1521 return;
1522 }
1523
1524 assert(friction >= 0.0);
1525
1527}
1528
1529//==============================================================================
1530template <class ConfigSpaceT>
1532{
1533 if (index >= getNumDofs())
1534 {
1535 GenericJoint_REPORT_OUT_OF_RANGE(getCoulombFriction, index);
1536 return 0.0;
1537 }
1538
1539 return Base::mAspectProperties.mFrictions[index];
1540}
1541
1542//==============================================================================
1543template <class ConfigSpaceT>
1545{
1546 // Spring energy
1547 Vector displacement
1548 = getPositionsStatic() - Base::mAspectProperties.mRestPositions;
1549
1550 const double pe = 0.5
1551 * displacement.dot(
1552 Base::mAspectProperties.mSpringStiffnesses.cwiseProduct(
1553 displacement));
1554
1555 return pe;
1556}
1557
1558//==============================================================================
1559template <class ConfigSpaceT>
1561{
1562 return getRelativeJacobianStatic();
1563}
1564
1565//==============================================================================
1566template <class ConfigSpaceT>
1569{
1570 if (this->mIsRelativeJacobianDirty)
1571 {
1572 this->updateRelativeJacobian(false);
1573 this->mIsRelativeJacobianDirty = false;
1574 }
1575
1576 return mJacobian;
1577}
1578
1579//==============================================================================
1580template <class ConfigSpaceT>
1582 const Eigen::VectorXd& positions) const
1583{
1584 return getRelativeJacobianStatic(positions);
1585}
1586
1587//==============================================================================
1588template <class ConfigSpaceT>
1590 const
1591{
1592 return getRelativeJacobianTimeDerivStatic();
1593}
1594
1595//==============================================================================
1596template <class ConfigSpaceT>
1599{
1600 if (this->mIsRelativeJacobianTimeDerivDirty)
1601 {
1602 this->updateRelativeJacobianTimeDeriv();
1603 this->mIsRelativeJacobianTimeDerivDirty = false;
1604 }
1605
1606 return mJacobianDeriv;
1607}
1608
1609//==============================================================================
1610template <class ConfigSpaceT>
1612 : mVelocityChanges(Vector::Zero()),
1613 mImpulses(Vector::Zero()),
1614 mConstraintImpulses(Vector::Zero()),
1615 mJacobian(JacobianMatrix::Zero()),
1616 mJacobianDeriv(JacobianMatrix::Zero()),
1617 mInvProjArtInertia(Matrix::Zero()),
1618 mInvProjArtInertiaImplicit(Matrix::Zero()),
1619 mTotalForce(Vector::Zero()),
1620 mTotalImpulse(Vector::Zero())
1621{
1622 for (auto i = 0u; i < NumDofs; ++i)
1623 mDofs[i] = this->createDofPointer(i);
1624
1625 // Joint and GenericJoint Aspects must be created by the most derived class.
1626 this->mAspectState.mPositions = properties.mInitialPositions;
1627 this->mAspectState.mVelocities = properties.mInitialVelocities;
1628}
1629
1630//==============================================================================
1631template <class ConfigSpaceT>
1633{
1634 const SkeletonPtr& skel = this->mChildBodyNode->getSkeleton();
1635 for (auto i = 0u; i < NumDofs; ++i)
1636 {
1637 Base::mAspectProperties.mDofNames[i]
1638 = skel->mNameMgrForDofs.issueNewNameAndAdd(
1639 mDofs[i]->getName(), mDofs[i]);
1640 }
1641}
1642
1643//==============================================================================
1644template <class ConfigSpaceT>
1646{
1647 assert(this->mChildBodyNode);
1648 return this->mChildBodyNode->getBodyForce()
1649 - this->getRelativeJacobianStatic() * this->mAspectState.mForces;
1650}
1651
1652//==============================================================================
1653template <class ConfigSpaceT>
1655{
1656 this->mSpatialVelocity
1657 = this->getRelativeJacobianStatic() * this->getVelocitiesStatic();
1658}
1659
1660//==============================================================================
1661template <class ConfigSpaceT>
1663{
1664 this->mSpatialAcceleration = this->getRelativePrimaryAcceleration()
1665 + this->getRelativeJacobianTimeDerivStatic()
1666 * this->getVelocitiesStatic();
1667}
1668
1669//==============================================================================
1670template <class ConfigSpaceT>
1672{
1673 this->mPrimaryAcceleration
1674 = this->getRelativeJacobianStatic() * this->getAccelerationsStatic();
1675}
1676
1677//==============================================================================
1678template <class ConfigSpaceT>
1680{
1681 // Add joint velocity to _vel
1682 vel.noalias() += getRelativeJacobianStatic() * getVelocitiesStatic();
1683
1684 // Verification
1685 assert(!math::isNan(vel));
1686}
1687
1688//==============================================================================
1689template <class ConfigSpaceT>
1691 Eigen::Vector6d& partialAcceleration, const Eigen::Vector6d& childVelocity)
1692{
1693 // ad(V, S * dq) + dS * dq
1694 partialAcceleration
1695 = math::ad(
1696 childVelocity, getRelativeJacobianStatic() * getVelocitiesStatic())
1697 + getRelativeJacobianTimeDerivStatic() * getVelocitiesStatic();
1698 // Verification
1699 assert(!math::isNan(partialAcceleration));
1700}
1701
1702//==============================================================================
1703template <class ConfigSpaceT>
1705{
1706 // Add joint acceleration to _acc
1707 acc.noalias() += getRelativeJacobianStatic() * getAccelerationsStatic();
1708
1709 // Verification
1710 assert(!math::isNan(acc));
1711}
1712
1713//==============================================================================
1714template <class ConfigSpaceT>
1716 Eigen::Vector6d& velocityChange)
1717{
1718 // Add joint velocity change to velocityChange
1719 velocityChange.noalias() += getRelativeJacobianStatic() * mVelocityChanges;
1720
1721 // Verification
1722 assert(!math::isNan(velocityChange));
1723}
1724
1725//==============================================================================
1726template <class ConfigSpaceT>
1729{
1731
1732 return mInvProjArtInertia;
1733}
1734
1735//==============================================================================
1736template <class ConfigSpaceT>
1739{
1741
1742 return mInvProjArtInertiaImplicit;
1743}
1744
1745//==============================================================================
1746template <class ConfigSpaceT>
1748 Eigen::Matrix6d& parentArtInertia, const Eigen::Matrix6d& childArtInertia)
1749{
1750 switch (Joint::mAspectProperties.mActuatorType)
1751 {
1752 case Joint::FORCE:
1753 case Joint::PASSIVE:
1754 case Joint::SERVO:
1755 case Joint::MIMIC:
1756 addChildArtInertiaToDynamic(parentArtInertia, childArtInertia);
1757 break;
1759 case Joint::VELOCITY:
1760 case Joint::LOCKED:
1761 addChildArtInertiaToKinematic(parentArtInertia, childArtInertia);
1762 break;
1763 default:
1764 GenericJoint_REPORT_UNSUPPORTED_ACTUATOR(addChildArtInertiaTo);
1765 break;
1766 }
1767}
1768
1769//==============================================================================
1770template <class ConfigSpaceT>
1772 Eigen::Matrix6d& parentArtInertia, const Eigen::Matrix6d& childArtInertia)
1773{
1774 // Child body's articulated inertia
1775 JacobianMatrix AIS = childArtInertia * getRelativeJacobianStatic();
1776 Eigen::Matrix6d PI = childArtInertia;
1777 PI.noalias() -= AIS * mInvProjArtInertia * AIS.transpose();
1778 assert(!math::isNan(PI));
1779
1780 // Add child body's articulated inertia to parent body's articulated inertia.
1781 // Note that mT should be updated.
1782 parentArtInertia
1783 += math::transformInertia(this->getRelativeTransform().inverse(), PI);
1784}
1785
1786//==============================================================================
1787template <class ConfigSpaceT>
1789 Eigen::Matrix6d& parentArtInertia, const Eigen::Matrix6d& childArtInertia)
1790{
1791 // Add child body's articulated inertia to parent body's articulated inertia.
1792 // Note that mT should be updated.
1793 parentArtInertia += math::transformInertia(
1794 this->getRelativeTransform().inverse(), childArtInertia);
1795}
1796
1797//==============================================================================
1798template <class ConfigSpaceT>
1800 Eigen::Matrix6d& parentArtInertia, const Eigen::Matrix6d& childArtInertia)
1801{
1802 switch (Joint::mAspectProperties.mActuatorType)
1803 {
1804 case Joint::FORCE:
1805 case Joint::PASSIVE:
1806 case Joint::SERVO:
1807 case Joint::MIMIC:
1808 addChildArtInertiaImplicitToDynamic(parentArtInertia, childArtInertia);
1809 break;
1811 case Joint::VELOCITY:
1812 case Joint::LOCKED:
1813 addChildArtInertiaImplicitToKinematic(parentArtInertia, childArtInertia);
1814 break;
1815 default:
1816 GenericJoint_REPORT_UNSUPPORTED_ACTUATOR(addChildArtInertiaImplicitTo);
1817 break;
1818 }
1819}
1820
1821//==============================================================================
1822template <class ConfigSpaceT>
1824 Eigen::Matrix6d& parentArtInertia, const Eigen::Matrix6d& childArtInertia)
1825{
1826 // Child body's articulated inertia
1827 JacobianMatrix AIS = childArtInertia * getRelativeJacobianStatic();
1828 Eigen::Matrix6d PI = childArtInertia;
1829 PI.noalias() -= AIS * mInvProjArtInertiaImplicit * AIS.transpose();
1830 assert(!math::isNan(PI));
1831
1832 // Add child body's articulated inertia to parent body's articulated inertia.
1833 // Note that mT should be updated.
1834 parentArtInertia
1835 += math::transformInertia(this->getRelativeTransform().inverse(), PI);
1836}
1837
1838//==============================================================================
1839template <class ConfigSpaceT>
1841 Eigen::Matrix6d& parentArtInertia, const Eigen::Matrix6d& childArtInertia)
1842{
1843 // Add child body's articulated inertia to parent body's articulated inertia.
1844 // Note that mT should be updated.
1845 parentArtInertia += math::transformInertia(
1846 this->getRelativeTransform().inverse(), childArtInertia);
1847}
1848
1849//==============================================================================
1850template <class ConfigSpaceT>
1852 const Eigen::Matrix6d& artInertia)
1853{
1854 switch (Joint::mAspectProperties.mActuatorType)
1855 {
1856 case Joint::FORCE:
1857 case Joint::PASSIVE:
1858 case Joint::SERVO:
1859 case Joint::MIMIC:
1860 updateInvProjArtInertiaDynamic(artInertia);
1861 break;
1863 case Joint::VELOCITY:
1864 case Joint::LOCKED:
1865 updateInvProjArtInertiaKinematic(artInertia);
1866 break;
1867 default:
1868 GenericJoint_REPORT_UNSUPPORTED_ACTUATOR(updateInvProjArtInertia);
1869 break;
1870 }
1871}
1872
1873//==============================================================================
1874template <class ConfigSpaceT>
1876 const Eigen::Matrix6d& artInertia)
1877{
1878 // Projected articulated inertia
1879 const JacobianMatrix& Jacobian = getRelativeJacobianStatic();
1880 const Matrix projAI = Jacobian.transpose() * artInertia * Jacobian;
1881
1882 // Inversion of projected articulated inertia
1883 mInvProjArtInertia = math::inverse<ConfigSpaceT>(projAI);
1884
1885 // Verification
1886 assert(!math::isNan(mInvProjArtInertia));
1887}
1888
1889//==============================================================================
1890template <class ConfigSpaceT>
1892 const Eigen::Matrix6d& /*_artInertia*/)
1893{
1894 // Do nothing
1895}
1896
1897//==============================================================================
1898template <class ConfigSpaceT>
1900 const Eigen::Matrix6d& artInertia, double timeStep)
1901{
1902 switch (Joint::mAspectProperties.mActuatorType)
1903 {
1904 case Joint::FORCE:
1905 case Joint::PASSIVE:
1906 case Joint::SERVO:
1907 case Joint::MIMIC:
1908 updateInvProjArtInertiaImplicitDynamic(artInertia, timeStep);
1909 break;
1911 case Joint::VELOCITY:
1912 case Joint::LOCKED:
1913 updateInvProjArtInertiaImplicitKinematic(artInertia, timeStep);
1914 break;
1915 default:
1916 GenericJoint_REPORT_UNSUPPORTED_ACTUATOR(updateInvProjArtInertiaImplicit);
1917 break;
1918 }
1919}
1920
1921//==============================================================================
1922template <class ConfigSpaceT>
1924 const Eigen::Matrix6d& artInertia, double timeStep)
1925{
1926 // Projected articulated inertia
1927 const JacobianMatrix& Jacobian = getRelativeJacobianStatic();
1928 Matrix projAI = Jacobian.transpose() * artInertia * Jacobian;
1929
1930 // Add additional inertia for implicit damping and spring force
1931 projAI += (timeStep * Base::mAspectProperties.mDampingCoefficients
1932 + timeStep * timeStep * Base::mAspectProperties.mSpringStiffnesses)
1933 .asDiagonal();
1934
1935 // Inversion of projected articulated inertia
1936 mInvProjArtInertiaImplicit = math::inverse<ConfigSpaceT>(projAI);
1937
1938 // Verification
1939 assert(!math::isNan(mInvProjArtInertiaImplicit));
1940}
1941
1942//==============================================================================
1943template <class ConfigSpaceT>
1945 const Eigen::Matrix6d& /*artInertia*/, double /*timeStep*/)
1946{
1947 // Do nothing
1948}
1949
1950//==============================================================================
1951template <class ConfigSpaceT>
1953 Eigen::Vector6d& parentBiasForce,
1954 const Eigen::Matrix6d& childArtInertia,
1955 const Eigen::Vector6d& childBiasForce,
1956 const Eigen::Vector6d& childPartialAcc)
1957{
1958 switch (Joint::mAspectProperties.mActuatorType)
1959 {
1960 case Joint::FORCE:
1961 case Joint::PASSIVE:
1962 case Joint::SERVO:
1963 case Joint::MIMIC:
1964 addChildBiasForceToDynamic(
1965 parentBiasForce, childArtInertia, childBiasForce, childPartialAcc);
1966 break;
1968 case Joint::VELOCITY:
1969 case Joint::LOCKED:
1970 addChildBiasForceToKinematic(
1971 parentBiasForce, childArtInertia, childBiasForce, childPartialAcc);
1972 break;
1973 default:
1974 GenericJoint_REPORT_UNSUPPORTED_ACTUATOR(addChildBiasForceTo);
1975 break;
1976 }
1977}
1978
1979//==============================================================================
1980template <class ConfigSpaceT>
1982 Eigen::Vector6d& parentBiasForce,
1983 const Eigen::Matrix6d& childArtInertia,
1984 const Eigen::Vector6d& childBiasForce,
1985 const Eigen::Vector6d& childPartialAcc)
1986{
1987 // Compute beta
1988 const Eigen::Vector6d beta
1989 = childBiasForce
1990 + childArtInertia
1991 * (childPartialAcc
1992 + getRelativeJacobianStatic() * getInvProjArtInertiaImplicit()
1993 * mTotalForce);
1994
1995 // Eigen::Vector6d beta
1996 // = _childBiasForce;
1997 // beta.noalias() += _childArtInertia * _childPartialAcc;
1998 // beta.noalias() += _childArtInertia * mJacobian *
1999 // getInvProjArtInertiaImplicit() * mTotalForce;
2000
2001 // Verification
2002 assert(!math::isNan(beta));
2003
2004 // Add child body's bias force to parent body's bias force. Note that mT
2005 // should be updated.
2006 parentBiasForce += math::dAdInvT(this->getRelativeTransform(), beta);
2007}
2008
2009//==============================================================================
2010template <class ConfigSpaceT>
2012 Eigen::Vector6d& _parentBiasForce,
2013 const Eigen::Matrix6d& childArtInertia,
2014 const Eigen::Vector6d& childBiasForce,
2015 const Eigen::Vector6d& childPartialAcc)
2016{
2017 // Compute beta
2018 const Eigen::Vector6d beta
2019 = childBiasForce
2020 + childArtInertia
2021 * (childPartialAcc
2022 + getRelativeJacobianStatic() * getAccelerationsStatic());
2023
2024 // Eigen::Vector6d beta
2025 // = _childBiasForce;
2026 // beta.noalias() += _childArtInertia * _childPartialAcc;
2027 // beta.noalias() += _childArtInertia * mJacobian *
2028 // getInvProjArtInertiaImplicit() * mTotalForce;
2029
2030 // Verification
2031 assert(!math::isNan(beta));
2032
2033 // Add child body's bias force to parent body's bias force. Note that mT
2034 // should be updated.
2035 _parentBiasForce += math::dAdInvT(this->getRelativeTransform(), beta);
2036}
2037
2038//==============================================================================
2039template <class ConfigSpaceT>
2041 Eigen::Vector6d& parentBiasImpulse,
2042 const Eigen::Matrix6d& childArtInertia,
2043 const Eigen::Vector6d& childBiasImpulse)
2044{
2045 switch (Joint::mAspectProperties.mActuatorType)
2046 {
2047 case Joint::FORCE:
2048 case Joint::PASSIVE:
2049 case Joint::SERVO:
2050 case Joint::MIMIC:
2051 addChildBiasImpulseToDynamic(
2052 parentBiasImpulse, childArtInertia, childBiasImpulse);
2053 break;
2055 case Joint::VELOCITY:
2056 case Joint::LOCKED:
2057 addChildBiasImpulseToKinematic(
2058 parentBiasImpulse, childArtInertia, childBiasImpulse);
2059 break;
2060 default:
2061 GenericJoint_REPORT_UNSUPPORTED_ACTUATOR(addChildBiasImpulseTo);
2062 break;
2063 }
2064}
2065
2066//==============================================================================
2067template <class ConfigSpaceT>
2069 Eigen::Vector6d& _parentBiasImpulse,
2070 const Eigen::Matrix6d& childArtInertia,
2071 const Eigen::Vector6d& childBiasImpulse)
2072{
2073 // Compute beta
2074 const Eigen::Vector6d beta = childBiasImpulse
2075 + childArtInertia * getRelativeJacobianStatic()
2076 * getInvProjArtInertia() * mTotalImpulse;
2077
2078 // Verification
2079 assert(!math::isNan(beta));
2080
2081 // Add child body's bias force to parent body's bias force. Note that mT
2082 // should be updated.
2083 _parentBiasImpulse += math::dAdInvT(this->getRelativeTransform(), beta);
2084}
2085
2086//==============================================================================
2087template <class ConfigSpaceT>
2089 Eigen::Vector6d& parentBiasImpulse,
2090 const Eigen::Matrix6d& /*childArtInertia*/,
2091 const Eigen::Vector6d& childBiasImpulse)
2092{
2093 // Add child body's bias force to parent body's bias force. Note that mT
2094 // should be updated.
2095 parentBiasImpulse
2096 += math::dAdInvT(this->getRelativeTransform(), childBiasImpulse);
2097}
2098
2099//==============================================================================
2100template <class ConfigSpaceT>
2102 const Eigen::Vector6d& bodyForce, double timeStep)
2103{
2104 assert(timeStep > 0.0);
2105
2106 switch (Joint::mAspectProperties.mActuatorType)
2107 {
2108 case Joint::FORCE:
2109 this->mAspectState.mForces = this->mAspectState.mCommands;
2110 updateTotalForceDynamic(bodyForce, timeStep);
2111 break;
2112 case Joint::PASSIVE:
2113 case Joint::SERVO:
2114 case Joint::MIMIC:
2115 this->mAspectState.mForces.setZero();
2116 updateTotalForceDynamic(bodyForce, timeStep);
2117 break;
2119 setAccelerationsStatic(this->mAspectState.mCommands);
2120 updateTotalForceKinematic(bodyForce, timeStep);
2121 break;
2122 case Joint::VELOCITY:
2123 setAccelerationsStatic(
2124 (this->mAspectState.mCommands - getVelocitiesStatic()) / timeStep);
2125 updateTotalForceKinematic(bodyForce, timeStep);
2126 break;
2127 case Joint::LOCKED:
2128 setVelocitiesStatic(Vector::Zero());
2129 setAccelerationsStatic(Vector::Zero());
2130 updateTotalForceKinematic(bodyForce, timeStep);
2131 break;
2132 default:
2134 break;
2135 }
2136}
2137
2138//==============================================================================
2139template <class ConfigSpaceT>
2141 const Eigen::Vector6d& bodyForce, double timeStep)
2142{
2143 // Spring force
2144 const Vector springForce
2145 = -Base::mAspectProperties.mSpringStiffnesses.cwiseProduct(
2146 getPositionsStatic() - Base::mAspectProperties.mRestPositions
2147 + getVelocitiesStatic() * timeStep);
2148
2149 // Damping force
2150 const Vector dampingForce
2151 = -Base::mAspectProperties.mDampingCoefficients.cwiseProduct(
2152 getVelocitiesStatic());
2153
2154 //
2155 mTotalForce = this->mAspectState.mForces + springForce + dampingForce
2156 - getRelativeJacobianStatic().transpose() * bodyForce;
2157}
2158
2159//==============================================================================
2160template <class ConfigSpaceT>
2162 const Eigen::Vector6d& /*bodyForce*/, double /*timeStep*/)
2163{
2164 // Do nothing
2165}
2166
2167//==============================================================================
2168template <class ConfigSpaceT>
2170 const Eigen::Vector6d& bodyImpulse)
2171{
2172 switch (Joint::mAspectProperties.mActuatorType)
2173 {
2174 case Joint::FORCE:
2175 case Joint::PASSIVE:
2176 case Joint::SERVO:
2177 case Joint::MIMIC:
2178 updateTotalImpulseDynamic(bodyImpulse);
2179 break;
2181 case Joint::VELOCITY:
2182 case Joint::LOCKED:
2183 updateTotalImpulseKinematic(bodyImpulse);
2184 break;
2185 default:
2186 GenericJoint_REPORT_UNSUPPORTED_ACTUATOR(updateTotalImpulse);
2187 break;
2188 }
2189}
2190
2191//==============================================================================
2192template <class ConfigSpaceT>
2194 const Eigen::Vector6d& bodyImpulse)
2195{
2196 //
2197 mTotalImpulse = mConstraintImpulses
2198 - getRelativeJacobianStatic().transpose() * bodyImpulse;
2199}
2200
2201//==============================================================================
2202template <class ConfigSpaceT>
2204 const Eigen::Vector6d& /*bodyImpulse*/)
2205{
2206 // Do nothing
2207}
2208
2209//==============================================================================
2210template <class ConfigSpaceT>
2212{
2213 mTotalImpulse.setZero();
2214}
2215
2216//==============================================================================
2217template <class ConfigSpaceT>
2219 const Eigen::Matrix6d& artInertia, const Eigen::Vector6d& spatialAcc)
2220{
2221 switch (Joint::mAspectProperties.mActuatorType)
2222 {
2223 case Joint::FORCE:
2224 case Joint::PASSIVE:
2225 case Joint::SERVO:
2226 case Joint::MIMIC:
2227 updateAccelerationDynamic(artInertia, spatialAcc);
2228 break;
2230 case Joint::VELOCITY:
2231 case Joint::LOCKED:
2232 updateAccelerationKinematic(artInertia, spatialAcc);
2233 break;
2234 default:
2235 GenericJoint_REPORT_UNSUPPORTED_ACTUATOR(updateAcceleration);
2236 break;
2237 }
2238}
2239
2240//==============================================================================
2241template <class ConfigSpaceT>
2243 const Eigen::Matrix6d& artInertia, const Eigen::Vector6d& spatialAcc)
2244{
2245 //
2246 setAccelerationsStatic(
2247 getInvProjArtInertiaImplicit()
2248 * (mTotalForce
2249 - getRelativeJacobianStatic().transpose() * artInertia
2250 * math::AdInvT(this->getRelativeTransform(), spatialAcc)));
2251
2252 // Verification
2253 assert(!math::isNan(getAccelerationsStatic()));
2254}
2255
2256//==============================================================================
2257template <class ConfigSpaceT>
2259 const Eigen::Matrix6d& /*artInertia*/,
2260 const Eigen::Vector6d& /*spatialAcc*/)
2261{
2262 // Do nothing
2263}
2264
2265//==============================================================================
2266template <class ConfigSpaceT>
2268 const Eigen::Matrix6d& artInertia, const Eigen::Vector6d& velocityChange)
2269{
2270 switch (Joint::mAspectProperties.mActuatorType)
2271 {
2272 case Joint::FORCE:
2273 case Joint::PASSIVE:
2274 case Joint::SERVO:
2275 case Joint::MIMIC:
2276 updateVelocityChangeDynamic(artInertia, velocityChange);
2277 break;
2279 case Joint::VELOCITY:
2280 case Joint::LOCKED:
2281 updateVelocityChangeKinematic(artInertia, velocityChange);
2282 break;
2283 default:
2284 GenericJoint_REPORT_UNSUPPORTED_ACTUATOR(updateVelocityChange);
2285 break;
2286 }
2287}
2288
2289//==============================================================================
2290template <class ConfigSpaceT>
2292 const Eigen::Matrix6d& artInertia, const Eigen::Vector6d& velocityChange)
2293{
2294 //
2295 mVelocityChanges
2296 = getInvProjArtInertia()
2297 * (mTotalImpulse
2298 - getRelativeJacobianStatic().transpose() * artInertia
2299 * math::AdInvT(this->getRelativeTransform(), velocityChange));
2300
2301 // Verification
2302 assert(!math::isNan(mVelocityChanges));
2303}
2304
2305//==============================================================================
2306template <class ConfigSpaceT>
2308 const Eigen::Matrix6d& /*artInertia*/,
2309 const Eigen::Vector6d& /*velocityChange*/)
2310{
2311 // Do nothing
2312}
2313
2314//==============================================================================
2315template <class ConfigSpaceT>
2317 const Eigen::Vector6d& bodyForce,
2318 double timeStep,
2319 bool withDampingForces,
2320 bool withSpringForces)
2321{
2322 this->mAspectState.mForces
2323 = getRelativeJacobianStatic().transpose() * bodyForce;
2324
2325 // Implicit damping force:
2326 // tau_d = -Kd * dq - Kd * h * ddq
2327 if (withDampingForces)
2328 {
2329 const typename ConfigSpaceT::Vector dampingForces
2330 = -Base::mAspectProperties.mDampingCoefficients.cwiseProduct(
2331 getVelocitiesStatic() + getAccelerationsStatic() * timeStep);
2332 this->mAspectState.mForces -= dampingForces;
2333 }
2334
2335 // Implicit spring force:
2336 // tau_s = -Kp * (q - q0) - Kp * h * dq - Kp * h^2 * ddq
2337 if (withSpringForces)
2338 {
2339 const typename ConfigSpaceT::Vector springForces
2340 = -Base::mAspectProperties.mSpringStiffnesses.cwiseProduct(
2341 getPositionsStatic() - Base::mAspectProperties.mRestPositions
2342 + getVelocitiesStatic() * timeStep
2343 + getAccelerationsStatic() * timeStep * timeStep);
2344 this->mAspectState.mForces -= springForces;
2345 }
2346}
2347
2348//==============================================================================
2349template <class ConfigSpaceT>
2351 const Eigen::Vector6d& bodyForce,
2352 double timeStep,
2353 bool withDampingForces,
2354 bool withSpringForces)
2355{
2356 switch (Joint::mAspectProperties.mActuatorType)
2357 {
2358 case Joint::FORCE:
2359 case Joint::PASSIVE:
2360 case Joint::SERVO:
2361 case Joint::MIMIC:
2362 break;
2364 case Joint::VELOCITY:
2365 case Joint::LOCKED:
2366 updateForceID(bodyForce, timeStep, withDampingForces, withSpringForces);
2367 break;
2368 default:
2370 break;
2371 }
2372}
2373
2374//==============================================================================
2375template <class ConfigSpaceT>
2377 const Eigen::Vector6d& bodyImpulse)
2378{
2379 mImpulses = getRelativeJacobianStatic().transpose() * bodyImpulse;
2380}
2381
2382//==============================================================================
2383template <class ConfigSpaceT>
2385 const Eigen::Vector6d& bodyImpulse)
2386{
2387 switch (Joint::mAspectProperties.mActuatorType)
2388 {
2389 case Joint::FORCE:
2390 case Joint::PASSIVE:
2391 case Joint::SERVO:
2392 case Joint::MIMIC:
2393 break;
2395 case Joint::VELOCITY:
2396 case Joint::LOCKED:
2397 updateImpulseID(bodyImpulse);
2398 break;
2399 default:
2401 break;
2402 }
2403}
2404
2405//==============================================================================
2406template <class ConfigSpaceT>
2408{
2409 switch (Joint::mAspectProperties.mActuatorType)
2410 {
2411 case Joint::FORCE:
2412 case Joint::PASSIVE:
2413 case Joint::SERVO:
2414 case Joint::MIMIC:
2415 updateConstrainedTermsDynamic(timeStep);
2416 break;
2418 case Joint::VELOCITY:
2419 case Joint::LOCKED:
2420 updateConstrainedTermsKinematic(timeStep);
2421 break;
2422 default:
2423 GenericJoint_REPORT_UNSUPPORTED_ACTUATOR(updateConstrainedTerms);
2424 break;
2425 }
2426}
2427
2428//==============================================================================
2429template <class ConfigSpaceT>
2431{
2432 const double invTimeStep = 1.0 / timeStep;
2433
2434 setVelocitiesStatic(getVelocitiesStatic() + mVelocityChanges);
2435 setAccelerationsStatic(
2436 getAccelerationsStatic() + mVelocityChanges * invTimeStep);
2437 this->mAspectState.mForces.noalias() += mImpulses * invTimeStep;
2438 // Note: As long as this is only called from BodyNode::updateConstrainedTerms
2439}
2440
2441//==============================================================================
2442template <class ConfigSpaceT>
2444 double timeStep)
2445{
2446 this->mAspectState.mForces.noalias() += mImpulses / timeStep;
2447}
2448
2449//==============================================================================
2450template <class ConfigSpaceT>
2452 Eigen::Vector6d& parentBiasForce,
2453 const Eigen::Matrix6d& childArtInertia,
2454 const Eigen::Vector6d& childBiasForce)
2455{
2456 // Compute beta
2457 Eigen::Vector6d beta = childBiasForce;
2458 beta.noalias() += childArtInertia * getRelativeJacobianStatic()
2459 * getInvProjArtInertia() * mInvM_a;
2460
2461 // Verification
2462 assert(!math::isNan(beta));
2463
2464 // Add child body's bias force to parent body's bias force. Note that mT
2465 // should be updated.
2466 parentBiasForce += math::dAdInvT(this->getRelativeTransform(), beta);
2467}
2468
2469//==============================================================================
2470template <class ConfigSpaceT>
2472 Eigen::Vector6d& parentBiasForce,
2473 const Eigen::Matrix6d& childArtInertia,
2474 const Eigen::Vector6d& childBiasForce)
2475{
2476 // Compute beta
2477 Eigen::Vector6d beta = childBiasForce;
2478 beta.noalias() += childArtInertia * getRelativeJacobianStatic()
2479 * getInvProjArtInertiaImplicit() * mInvM_a;
2480
2481 // Verification
2482 assert(!math::isNan(beta));
2483
2484 // Add child body's bias force to parent body's bias force. Note that mT
2485 // should be updated.
2486 parentBiasForce += math::dAdInvT(this->getRelativeTransform(), beta);
2487}
2488
2489//==============================================================================
2490template <class ConfigSpaceT>
2492 const Eigen::Vector6d& bodyForce)
2493{
2494 // Compute alpha
2495 mInvM_a = this->mAspectState.mForces
2496 - getRelativeJacobianStatic().transpose() * bodyForce;
2497}
2498
2499//==============================================================================
2500template <class ConfigSpaceT>
2502 Eigen::MatrixXd& _invMassMat,
2503 const size_t _col,
2504 const Eigen::Matrix6d& artInertia,
2505 const Eigen::Vector6d& spatialAcc)
2506{
2507 //
2508 mInvMassMatrixSegment
2509 = getInvProjArtInertia()
2510 * (mInvM_a
2511 - getRelativeJacobianStatic().transpose() * artInertia
2512 * math::AdInvT(this->getRelativeTransform(), spatialAcc));
2513
2514 // Verification
2515 assert(!math::isNan(mInvMassMatrixSegment));
2516
2517 // Index
2518 size_t iStart = mDofs[0]->mIndexInTree;
2519
2520 // Assign
2521 _invMassMat.block<NumDofs, 1>(iStart, _col) = mInvMassMatrixSegment;
2522}
2523
2524//==============================================================================
2525template <class ConfigSpaceT>
2527 Eigen::MatrixXd& invMassMat,
2528 const size_t col,
2529 const Eigen::Matrix6d& artInertia,
2530 const Eigen::Vector6d& spatialAcc)
2531{
2532 //
2533 mInvMassMatrixSegment
2534 = getInvProjArtInertiaImplicit()
2535 * (mInvM_a
2536 - getRelativeJacobianStatic().transpose() * artInertia
2537 * math::AdInvT(this->getRelativeTransform(), spatialAcc));
2538
2539 // Verification
2540 assert(!math::isNan(mInvMassMatrixSegment));
2541
2542 // Index
2543 size_t iStart = mDofs[0]->mIndexInTree;
2544
2545 // Assign
2546 invMassMat.block<NumDofs, 1>(iStart, col) = mInvMassMatrixSegment;
2547}
2548
2549//==============================================================================
2550template <class ConfigSpaceT>
2552{
2553 //
2554 acc += getRelativeJacobianStatic() * mInvMassMatrixSegment;
2555}
2556
2557//==============================================================================
2558template <class ConfigSpaceT>
2560 const Eigen::Vector6d& spatial)
2561{
2562 return getRelativeJacobianStatic().transpose() * spatial;
2563}
2564
2565} // namespace dynamics
2566} // namespace dart
2567
2568#endif // DART_DYNAMICS_DETAIL_GenericJoint_HPP_
#define dterr
Output an error message.
Definition Console.hpp:49
#define dtwarn
Output a warning message.
Definition Console.hpp:46
BodyPropPtr properties
Definition SdfParser.cpp:80
std::string * name
Definition SkelParser.cpp:1697
bool * preserveName
Definition SkelParser.cpp:1696
Eigen::VectorXd velocity
Definition SkelParser.cpp:109
Eigen::VectorXd force
Definition SkelParser.cpp:111
std::size_t index
Definition SkelParser.cpp:1672
Eigen::VectorXd acceleration
Definition SkelParser.cpp:110
double * friction
Definition SkelParser.cpp:1694
Eigen::VectorXd position
Definition SkelParser.cpp:108
AspectProperties mAspectProperties
Aspect::Properties data, directly accessible to your derived class.
Definition EmbeddedAspect.hpp:228
AspectState mAspectState
Aspect::State data, directly accessible to your derived class.
Definition EmbeddedAspect.hpp:415
DegreeOfFreedom class is a proxy class for accessing single degrees of freedom (aka generalized coord...
Definition DegreeOfFreedom.hpp:56
Definition GenericJoint.hpp:49
void setAspectState(const AspectState &state)
Set the AspectState of this GenericJoint.
Definition GenericJoint.hpp:113
void setForceLowerLimits(const Eigen::VectorXd &lowerLimits) override
Definition GenericJoint.hpp:1239
double getCommand(std::size_t index) const override
Definition GenericJoint.hpp:389
typename ConfigSpaceT::Matrix Matrix
Definition GenericJoint.hpp:60
void addChildArtInertiaImplicitToKinematic(Eigen::Matrix6d &parentArtInertia, const Eigen::Matrix6d &childArtInertia)
Definition GenericJoint.hpp:1840
Eigen::VectorXd getCommands() const override
Definition GenericJoint.hpp:475
void resetVelocities() override
Definition GenericJoint.hpp:945
const Vector & getPositionsStatic() const
Fixed-size version of getPositions()
Definition GenericJoint.hpp:733
void setAccelerationsStatic(const Vector &accels)
Fixed-size version of setAccelerations()
Definition GenericJoint.hpp:759
void copy(const ThisClass &otherJoint)
Copy the Properties of another GenericJoint.
Definition GenericJoint.hpp:158
void setForceUpperLimits(const Eigen::VectorXd &upperLimits) override
Definition GenericJoint.hpp:1286
void updateTotalImpulseKinematic(const Eigen::Vector6d &bodyImpulse)
Definition GenericJoint.hpp:2203
void setCoulombFriction(std::size_t index, double friction) override
Definition GenericJoint.hpp:1515
const JacobianMatrix & getRelativeJacobianTimeDerivStatic() const
Fixed-size version of getRelativeJacobianTimeDeriv()
Definition GenericJoint.hpp:1598
void setRestPosition(std::size_t index, double q0) override
Definition GenericJoint.hpp:1461
void setAccelerations(const Eigen::VectorXd &accelerations) override
Definition GenericJoint.hpp:1035
void updateTotalImpulse(const Eigen::Vector6d &bodyImpulse) override
Definition GenericJoint.hpp:2169
void updateForceFD(const Eigen::Vector6d &bodyForce, double timeStep, bool withDampingForcese, bool withSpringForces) override
Definition GenericJoint.hpp:2350
const Matrix & getInvProjArtInertiaImplicit() const
Get the inverse of projected articulated inertia for implicit joint damping and spring forces.
Definition GenericJoint.hpp:1738
Eigen::VectorXd getPositionUpperLimits() const override
Definition GenericJoint.hpp:632
void setVelocityUpperLimits(const Eigen::VectorXd &upperLimits) override
Definition GenericJoint.hpp:911
void updateForceID(const Eigen::Vector6d &bodyForce, double timeStep, bool withDampingForces, bool withSpringForces) override
Definition GenericJoint.hpp:2316
Eigen::VectorXd getAccelerationUpperLimits() const override
Definition GenericJoint.hpp:1147
void updateAccelerationKinematic(const Eigen::Matrix6d &artInertia, const Eigen::Vector6d &spatialAcc)
Definition GenericJoint.hpp:2258
void updateVelocityChangeDynamic(const Eigen::Matrix6d &artInertia, const Eigen::Vector6d &velocityChange)
Definition GenericJoint.hpp:2291
Eigen::VectorXd getVelocityLowerLimits() const override
Definition GenericJoint.hpp:877
void updateInvProjArtInertiaImplicit(const Eigen::Matrix6d &artInertia, double timeStep) override
Definition GenericJoint.hpp:1899
void setVelocityLowerLimits(const Eigen::VectorXd &lowerLimits) override
Definition GenericJoint.hpp:863
void updateConstrainedTermsDynamic(double timeStep)
Definition GenericJoint.hpp:2430
void setPositionLowerLimit(std::size_t index, double position) override
Definition GenericJoint.hpp:543
const GenericJoint< ConfigSpaceT >::JacobianMatrix & getRelativeJacobianStatic() const
Fixed-size version of getRelativeJacobian()
Definition GenericJoint.hpp:1568
void addChildArtInertiaToDynamic(Eigen::Matrix6d &parentArtInertia, const Eigen::Matrix6d &childArtInertia)
Definition GenericJoint.hpp:1771
const math::Jacobian getRelativeJacobianTimeDeriv() const override
Definition GenericJoint.hpp:1589
void setVelocities(const Eigen::VectorXd &velocities) override
Definition GenericJoint.hpp:812
void addChildBiasImpulseToKinematic(Eigen::Vector6d &parentBiasImpulse, const Eigen::Matrix6d &childArtInertia, const Eigen::Vector6d &childBiasImpulse)
Definition GenericJoint.hpp:2088
void addChildArtInertiaImplicitTo(Eigen::Matrix6d &parentArtInertiaImplicit, const Eigen::Matrix6d &childArtInertiaImplicit) override
Definition GenericJoint.hpp:1799
void setPosition(std::size_t index, double position) override
Definition GenericJoint.hpp:489
void updateVelocityChange(const Eigen::Matrix6d &artInertia, const Eigen::Vector6d &velocityChange) override
Definition GenericJoint.hpp:2267
void setCommand(std::size_t index, double command) override
Definition GenericJoint.hpp:319
std::array< DegreeOfFreedom *, NumDofs > mDofs
Array of DegreeOfFreedom objects.
Definition GenericJoint.hpp:679
void setInitialPosition(std::size_t index, double initial) override
Definition GenericJoint.hpp:673
Eigen::VectorXd getForces() const override
Definition GenericJoint.hpp:1206
void resetCommands() override
Definition GenericJoint.hpp:482
void setVelocityChange(std::size_t index, double velocityChange) override
Definition GenericJoint.hpp:1317
typename Base::AspectState AspectState
Definition GenericJoint.hpp:64
void setAccelerationUpperLimits(const Eigen::VectorXd &upperLimits) override
Definition GenericJoint.hpp:1133
void setPartialAccelerationTo(Eigen::Vector6d &partialAcceleration, const Eigen::Vector6d &childVelocity) override
Definition GenericJoint.hpp:1690
double getVelocity(std::size_t index) const override
Definition GenericJoint.hpp:799
Eigen::Vector6d getBodyConstraintWrench() const override
Definition GenericJoint.hpp:1645
void addAccelerationTo(Eigen::Vector6d &acc) override
Definition GenericJoint.hpp:1704
void updateTotalImpulseDynamic(const Eigen::Vector6d &bodyImpulse)
Definition GenericJoint.hpp:2193
void setForce(std::size_t index, double force) override
Definition GenericJoint.hpp:1161
void setInitialVelocity(std::size_t index, double initial) override
Definition GenericJoint.hpp:952
double getForce(std::size_t index) const override
Definition GenericJoint.hpp:1177
void setInitialVelocities(const Eigen::VectorXd &initial) override
Definition GenericJoint.hpp:979
void updateInvProjArtInertiaDynamic(const Eigen::Matrix6d &artInertia)
Definition GenericJoint.hpp:1875
void setPositionUpperLimit(std::size_t index, double position) override
Definition GenericJoint.hpp:591
void updateInvProjArtInertiaImplicitKinematic(const Eigen::Matrix6d &artInertia, double timeStep)
Definition GenericJoint.hpp:1944
const math::Jacobian getRelativeJacobian() const override
Definition GenericJoint.hpp:1560
std::size_t getNumDofs() const override
Definition GenericJoint.hpp:211
void resetForces() override
Definition GenericJoint.hpp:1307
DegreeOfFreedom * getDof(std::size_t index) override
void addChildArtInertiaTo(Eigen::Matrix6d &parentArtInertia, const Eigen::Matrix6d &childArtInertia) override
Definition GenericJoint.hpp:1747
Eigen::VectorXd getPositionLowerLimits() const override
Definition GenericJoint.hpp:584
bool isDofNamePreserved(size_t index) const override
Definition GenericJoint.hpp:263
void addVelocityTo(Eigen::Vector6d &vel) override
Definition GenericJoint.hpp:1679
void preserveDofName(size_t index, bool preserve) override
Definition GenericJoint.hpp:250
double getVelocityUpperLimit(std::size_t index) const override
Definition GenericJoint.hpp:898
double getVelocityChange(std::size_t index) const override
Definition GenericJoint.hpp:1331
void updateTotalForce(const Eigen::Vector6d &bodyForce, double timeStep) override
Definition GenericJoint.hpp:2101
void resetConstraintImpulses() override
Definition GenericJoint.hpp:1378
virtual Vector getPositionDifferencesStatic(const Vector &q2, const Vector &q1) const
Fixed-size version of getPositionDifferences()
Definition GenericJoint.hpp:1424
void setVelocity(std::size_t index, double velocity) override
Definition GenericJoint.hpp:778
double getRestPosition(std::size_t index) const override
Definition GenericJoint.hpp:1474
void updateConstrainedTerms(double timeStep) override
Definition GenericJoint.hpp:2407
void integrateVelocities(double dt) override
Definition GenericJoint.hpp:1397
Eigen::VectorXd getPositions() const override
Definition GenericJoint.hpp:536
void addChildBiasImpulseToDynamic(Eigen::Vector6d &parentBiasImpulse, const Eigen::Matrix6d &childArtInertia, const Eigen::Vector6d &childBiasImpulse)
Definition GenericJoint.hpp:2068
double getAcceleration(std::size_t index) const override
Definition GenericJoint.hpp:1022
Eigen::VectorXd getVelocities() const override
Definition GenericJoint.hpp:829
Eigen::VectorXd getInitialPositions() const override
Definition GenericJoint.hpp:714
Eigen::VectorXd getPositionDifferences(const Eigen::VectorXd &q2, const Eigen::VectorXd &q1) const override
Definition GenericJoint.hpp:1405
void setPositionLowerLimits(const Eigen::VectorXd &lowerLimits) override
Definition GenericJoint.hpp:570
double getAccelerationUpperLimit(std::size_t index) const override
Definition GenericJoint.hpp:1120
void setForceLowerLimit(size_t index, double force) override
Definition GenericJoint.hpp:1213
void setSpringStiffness(std::size_t index, double k) override
Definition GenericJoint.hpp:1433
void updateRelativePrimaryAcceleration() const override
Definition GenericJoint.hpp:1671
void setProperties(const Properties &properties)
Set the Properties of this GenericJoint.
Definition GenericJoint.hpp:97
double getForceLowerLimit(std::size_t index) const override
Definition GenericJoint.hpp:1226
static constexpr std::size_t NumDofs
Definition GenericJoint.hpp:51
const Vector & getVelocitiesStatic() const
Fixed-size version of getVelocities()
Definition GenericJoint.hpp:752
double getPositionUpperLimit(std::size_t index) const override
Definition GenericJoint.hpp:605
const std::string & getDofName(size_t index) const override
Definition GenericJoint.hpp:276
ThisClass & operator=(const ThisClass &other)
Same as copy(const GenericJoint&)
Definition GenericJoint.hpp:178
double computePotentialEnergy() const override
Definition GenericJoint.hpp:1544
double getSpringStiffness(std::size_t index) const override
Definition GenericJoint.hpp:1448
void setDampingCoefficient(std::size_t index, double coeff) override
Definition GenericJoint.hpp:1487
void updateInvProjArtInertia(const Eigen::Matrix6d &artInertia) override
Definition GenericJoint.hpp:1851
void resetVelocity(std::size_t index) override
Definition GenericJoint.hpp:932
void setPositionsStatic(const Vector &positions)
Fixed-size version of setPositions()
Definition GenericJoint.hpp:721
void addChildBiasForceForInvAugMassMatrix(Eigen::Vector6d &parentBiasForce, const Eigen::Matrix6d &childArtInertia, const Eigen::Vector6d &childBiasForce) override
Definition GenericJoint.hpp:2471
void updateConstrainedTermsKinematic(double timeStep)
Definition GenericJoint.hpp:2443
void setAccelerationLowerLimits(const Eigen::VectorXd &lowerLimits) override
Definition GenericJoint.hpp:1086
void setAspectProperties(const AspectProperties &properties)
Set the AspectProperties of this GenericJoint.
Definition GenericJoint.hpp:124
Eigen::VectorXd getForceUpperLimits() const override
Definition GenericJoint.hpp:1300
detail::GenericJointProperties< ConfigSpaceT > Properties
Definition GenericJoint.hpp:63
void updateImpulseFD(const Eigen::Vector6d &bodyImpulse) override
Definition GenericJoint.hpp:2384
GenericJoint(const ThisClass &)=delete
void updateInvProjArtInertiaImplicitDynamic(const Eigen::Matrix6d &artInertia, double timeStep)
Definition GenericJoint.hpp:1923
void updateTotalForceKinematic(const Eigen::Vector6d &bodyForce, double timeStep)
Definition GenericJoint.hpp:2161
void resetTotalImpulses() override
Definition GenericJoint.hpp:2211
void integratePositions(double dt) override
Definition GenericJoint.hpp:1385
void setPositions(const Eigen::VectorXd &positions) override
Definition GenericJoint.hpp:523
void addChildBiasForceToDynamic(Eigen::Vector6d &parentBiasForce, const Eigen::Matrix6d &childArtInertia, const Eigen::Vector6d &childBiasForce, const Eigen::Vector6d &childPartialAcc)
Definition GenericJoint.hpp:1981
Eigen::VectorXd getForceLowerLimits() const override
Definition GenericJoint.hpp:1253
double getInitialVelocity(std::size_t index) const override
Definition GenericJoint.hpp:966
Eigen::VectorXd getAccelerations() const override
Definition GenericJoint.hpp:1052
typename ConfigSpaceT::Vector Vector
Definition GenericJoint.hpp:58
void updateVelocityChangeKinematic(const Eigen::Matrix6d &artInertia, const Eigen::Vector6d &velocityChange)
Definition GenericJoint.hpp:2307
const Vector & getAccelerationsStatic() const
Fixed-size version of getAccelerations()
Definition GenericJoint.hpp:771
Eigen::VectorXd getInitialVelocities() const override
Definition GenericJoint.hpp:993
void setCommands(const Eigen::VectorXd &commands) override
Definition GenericJoint.hpp:402
Eigen::VectorXd getSpatialToGeneralized(const Eigen::Vector6d &spatial) override
Definition GenericJoint.hpp:2559
typename ConfigSpaceT::JacobianMatrix JacobianMatrix
Definition GenericJoint.hpp:59
void getInvAugMassMatrixSegment(Eigen::MatrixXd &invMassMat, const size_t col, const Eigen::Matrix6d &artInertia, const Eigen::Vector6d &spatialAcc) override
Definition GenericJoint.hpp:2526
double getVelocityLowerLimit(std::size_t index) const override
Definition GenericJoint.hpp:850
void updateImpulseID(const Eigen::Vector6d &bodyImpulse) override
Definition GenericJoint.hpp:2376
void setVelocityLowerLimit(std::size_t index, double velocity) override
Definition GenericJoint.hpp:836
double getInitialPosition(std::size_t index) const override
Definition GenericJoint.hpp:687
void updateAcceleration(const Eigen::Matrix6d &artInertia, const Eigen::Vector6d &spatialAcc) override
Definition GenericJoint.hpp:2218
void addChildBiasForceToKinematic(Eigen::Vector6d &parentBiasForce, const Eigen::Matrix6d &childArtInertia, const Eigen::Vector6d &childBiasForce, const Eigen::Vector6d &childPartialAcc)
Definition GenericJoint.hpp:2011
void setVelocityUpperLimit(std::size_t index, double velocity) override
Definition GenericJoint.hpp:884
typename ConfigSpaceT::Point Point
Definition GenericJoint.hpp:56
void updateInvProjArtInertiaKinematic(const Eigen::Matrix6d &artInertia)
Definition GenericJoint.hpp:1891
bool hasPositionLimit(std::size_t index) const override
Definition GenericJoint.hpp:639
void setInitialPositions(const Eigen::VectorXd &initial) override
Definition GenericJoint.hpp:700
virtual ~GenericJoint()
Destructor.
Definition GenericJoint.hpp:89
void addChildBiasForceTo(Eigen::Vector6d &parentBiasForce, const Eigen::Matrix6d &childArtInertia, const Eigen::Vector6d &childBiasForce, const Eigen::Vector6d &childPartialAcc) override
Definition GenericJoint.hpp:1952
double getCoulombFriction(std::size_t index) const override
Definition GenericJoint.hpp:1531
void addInvMassMatrixSegmentTo(Eigen::Vector6d &acc) override
Definition GenericJoint.hpp:2551
void setConstraintImpulse(std::size_t index, double impulse) override
Definition GenericJoint.hpp:1351
void resetPosition(std::size_t index) override
Definition GenericJoint.hpp:653
double getForceUpperLimit(size_t index) const override
Definition GenericJoint.hpp:1273
void registerDofs() override
Definition GenericJoint.hpp:1632
void addVelocityChangeTo(Eigen::Vector6d &velocityChange) override
Definition GenericJoint.hpp:1715
const std::string & setDofName(std::size_t index, const std::string &name, bool preserveName=true) override
Definition GenericJoint.hpp:218
void setAccelerationUpperLimit(std::size_t index, double acceleration) override
Definition GenericJoint.hpp:1107
double getDampingCoefficient(std::size_t index) const override
Definition GenericJoint.hpp:1502
typename Base::AspectProperties AspectProperties
Definition GenericJoint.hpp:65
void setPositionUpperLimits(const Eigen::VectorXd &upperLimits) override
Definition GenericJoint.hpp:618
Eigen::VectorXd getAccelerationLowerLimits() const override
Definition GenericJoint.hpp:1100
void updateTotalForceDynamic(const Eigen::Vector6d &bodyForce, double timeStep)
Definition GenericJoint.hpp:2140
void setVelocitiesStatic(const Vector &velocities)
Fixed-size version of setVelocities()
Definition GenericJoint.hpp:740
void updateRelativeSpatialAcceleration() const override
Definition GenericJoint.hpp:1662
void updateRelativeSpatialVelocity() const override
Definition GenericJoint.hpp:1654
void setForceUpperLimit(size_t index, double force) override
Definition GenericJoint.hpp:1260
size_t getIndexInTree(size_t index) const override
Definition GenericJoint.hpp:306
Eigen::VectorXd getVelocityUpperLimits() const override
Definition GenericJoint.hpp:925
void setAccelerationLowerLimit(size_t index, double acceleration) override
Definition GenericJoint.hpp:1059
double getPosition(std::size_t index) const override
Definition GenericJoint.hpp:510
void addChildArtInertiaImplicitToDynamic(Eigen::Matrix6d &parentArtInertia, const Eigen::Matrix6d &childArtInertia)
Definition GenericJoint.hpp:1823
double getAccelerationLowerLimit(std::size_t index) const override
Definition GenericJoint.hpp:1073
void addChildBiasImpulseTo(Eigen::Vector6d &parentBiasImpulse, const Eigen::Matrix6d &childArtInertia, const Eigen::Vector6d &childBiasImpulse) override
Definition GenericJoint.hpp:2040
double getPositionLowerLimit(std::size_t index) const override
Definition GenericJoint.hpp:557
void updateAccelerationDynamic(const Eigen::Matrix6d &artInertia, const Eigen::Vector6d &spatialAcc)
Definition GenericJoint.hpp:2242
void resetPositions() override
Definition GenericJoint.hpp:666
void addChildBiasForceForInvMassMatrix(Eigen::Vector6d &parentBiasForce, const Eigen::Matrix6d &childArtInertia, const Eigen::Vector6d &childBiasForce) override
Definition GenericJoint.hpp:2451
void getInvMassMatrixSegment(Eigen::MatrixXd &invMassMat, const size_t col, const Eigen::Matrix6d &artInertia, const Eigen::Vector6d &spatialAcc) override
Definition GenericJoint.hpp:2501
Properties getGenericJointProperties() const
Get the Properties of this GenericJoint.
Definition GenericJoint.hpp:150
const Matrix & getInvProjArtInertia() const
Get the inverse of the projected articulated inertia.
Definition GenericJoint.hpp:1728
void setForces(const Eigen::VectorXd &forces) override
Definition GenericJoint.hpp:1190
void updateTotalForceForInvMassMatrix(const Eigen::Vector6d &bodyForce) override
Definition GenericJoint.hpp:2491
void resetAccelerations() override
Definition GenericJoint.hpp:1154
void setAcceleration(std::size_t index, double acceleration) override
Definition GenericJoint.hpp:1000
void addChildArtInertiaToKinematic(Eigen::Matrix6d &parentArtInertia, const Eigen::Matrix6d &childArtInertia)
Definition GenericJoint.hpp:1788
double getConstraintImpulse(std::size_t index) const override
Definition GenericJoint.hpp:1365
size_t getIndexInSkeleton(size_t index) const override
Definition GenericJoint.hpp:293
void resetVelocityChanges() override
Definition GenericJoint.hpp:1344
static constexpr ActuatorType PASSIVE
Definition Joint.hpp:68
static constexpr ActuatorType SERVO
Definition Joint.hpp:69
static constexpr ActuatorType ACCELERATION
Definition Joint.hpp:71
void updateArticulatedInertia() const
Tells the Skeleton to update the articulated inertia if it needs updating.
Definition Joint.cpp:623
static constexpr ActuatorType LOCKED
Definition Joint.hpp:73
static constexpr ActuatorType FORCE
Definition Joint.hpp:67
static constexpr ActuatorType MIMIC
Definition Joint.hpp:70
void setProperties(const Properties &properties)
Set the Properties of this Joint.
Definition Joint.cpp:109
static constexpr ActuatorType VELOCITY
Definition Joint.hpp:72
#define GenericJoint_REPORT_UNSUPPORTED_ACTUATOR(func)
Definition GenericJoint.hpp:60
#define GenericJoint_REPORT_DIM_MISMATCH(func, arg)
Definition GenericJoint.hpp:43
#define GenericJoint_REPORT_OUT_OF_RANGE(func, index)
Definition GenericJoint.hpp:52
#define GenericJoint_SET_IF_DIFFERENT(mField, value)
Definition GenericJoint.hpp:68
Matrix< double, 6, 1 > Vector6d
Definition MathTypes.hpp:49
Matrix< double, 6, 6 > Matrix6d
Definition MathTypes.hpp:50
std::shared_ptr< Skeleton > SkeletonPtr
Definition SmartPointer.hpp:60
T clip(const T &val, const T &lower, const T &upper)
Definition Helpers.hpp:159
Eigen::Matrix< double, 6, Eigen::Dynamic > Jacobian
Definition MathTypes.hpp:114
Eigen::Vector6d AdInvT(const Eigen::Isometry3d &_T, const Eigen::Vector6d &_V)
fast version of Ad(Inv(T), V)
Definition Geometry.cpp:776
Eigen::Vector6d dAdInvT(const Eigen::Isometry3d &_T, const Eigen::Vector6d &_F)
fast version of dAd(Inv(T), F)
Definition Geometry.cpp:850
Eigen::Vector6d ad(const Eigen::Vector6d &_X, const Eigen::Vector6d &_Y)
adjoint mapping
Definition Geometry.cpp:808
Inertia transformInertia(const Eigen::Isometry3d &_T, const Inertia &_I)
Definition Geometry.cpp:1414
bool isNan(double _v)
Returns whether _v is a NaN (Not-A-Number) value.
Definition Helpers.hpp:187
Definition BulletCollisionDetector.cpp:60
Definition GenericJointAspect.hpp:191
Definition GenericJointAspect.hpp:88
EuclideanPoint mInitialPositions
Initial positions.
Definition GenericJointAspect.hpp:102
Vector mInitialVelocities
Initial velocities.
Definition GenericJointAspect.hpp:111
Definition JointAspect.hpp:112