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 #include "dart/dynamics/ZeroDofJoint.hpp"
34
35 #include "dart/common/Console.hpp"
36 #include "dart/dynamics/BodyNode.hpp"
37 #include "dart/dynamics/Skeleton.hpp"
38 #include "dart/math/Helpers.hpp"
39
40 namespace dart {
41 namespace dynamics {
42
43 //==============================================================================
Properties(const Joint::Properties & _properties)44 ZeroDofJoint::Properties::Properties(const Joint::Properties& _properties)
45 : Joint::Properties(_properties)
46 {
47 // Do nothing
48 }
49
50 //==============================================================================
~ZeroDofJoint()51 ZeroDofJoint::~ZeroDofJoint()
52 {
53 // Do nothing
54 }
55
56 //==============================================================================
getZeroDofJointProperties() const57 ZeroDofJoint::Properties ZeroDofJoint::getZeroDofJointProperties() const
58 {
59 return getJointProperties();
60 }
61
62 //==============================================================================
getDof(std::size_t)63 DegreeOfFreedom* ZeroDofJoint::getDof(std::size_t)
64 {
65 dterr << "[ZeroDofJoint::getDof] Attempting to get a DegreeOfFreedom from a "
66 << "ZeroDofJoint. This is not allowed!\n";
67 assert(false);
68 return nullptr;
69 }
70
71 //==============================================================================
getDof(std::size_t) const72 const DegreeOfFreedom* ZeroDofJoint::getDof(std::size_t) const
73 {
74 dterr << "[ZeroDofJoint::getDof] Attempting to get a DegreeOfFreedom from a "
75 << "ZeroDofJoint. This is not allowed!\n";
76 assert(false);
77 return nullptr;
78 }
79
80 //==============================================================================
setDofName(std::size_t,const std::string &,bool)81 const std::string& ZeroDofJoint::setDofName(
82 std::size_t, const std::string&, bool)
83 {
84 return emptyString;
85 }
86
87 //==============================================================================
preserveDofName(std::size_t,bool)88 void ZeroDofJoint::preserveDofName(std::size_t, bool)
89 {
90 // Do nothing
91 }
92
93 //==============================================================================
isDofNamePreserved(std::size_t) const94 bool ZeroDofJoint::isDofNamePreserved(std::size_t) const
95 {
96 return false;
97 }
98
99 //==============================================================================
getDofName(std::size_t) const100 const std::string& ZeroDofJoint::getDofName(std::size_t) const
101 {
102 return emptyString;
103 }
104
105 //==============================================================================
getNumDofs() const106 std::size_t ZeroDofJoint::getNumDofs() const
107 {
108 return 0;
109 }
110
111 //==============================================================================
getIndexInSkeleton(std::size_t _index) const112 std::size_t ZeroDofJoint::getIndexInSkeleton(std::size_t _index) const
113 {
114 dterr << "[ZeroDofJoint::getIndexInSkeleton] This function should never be "
115 << "called (" << _index << ")!\n";
116 assert(false);
117
118 return 0;
119 }
120
121 //==============================================================================
getIndexInTree(std::size_t _index) const122 std::size_t ZeroDofJoint::getIndexInTree(std::size_t _index) const
123 {
124 dterr << "ZeroDofJoint::getIndexInTree] This function should never be "
125 << "called (" << _index << ")!\n";
126 assert(false);
127
128 return 0;
129 }
130
131 //==============================================================================
setCommand(std::size_t,double)132 void ZeroDofJoint::setCommand(std::size_t /*_index*/, double /*_command*/)
133 {
134 // Do nothing
135 }
136
137 //==============================================================================
getCommand(std::size_t _index) const138 double ZeroDofJoint::getCommand(std::size_t _index) const
139 {
140 dterr << "[ZeroDofJoint::getCommand]: index[" << _index << "] out of range"
141 << std::endl;
142
143 return 0.0;
144 }
145
146 //==============================================================================
setCommands(const Eigen::VectorXd &)147 void ZeroDofJoint::setCommands(const Eigen::VectorXd& /*_commands*/)
148 {
149 // Do nothing
150 }
151
152 //==============================================================================
getCommands() const153 Eigen::VectorXd ZeroDofJoint::getCommands() const
154 {
155 return Eigen::Matrix<double, 0, 1>();
156 }
157
158 //==============================================================================
resetCommands()159 void ZeroDofJoint::resetCommands()
160 {
161 // Do nothing
162 }
163
164 //==============================================================================
setPosition(std::size_t,double)165 void ZeroDofJoint::setPosition(std::size_t, double)
166 {
167 // Do nothing
168 }
169
170 //==============================================================================
getPosition(std::size_t _index) const171 double ZeroDofJoint::getPosition(std::size_t _index) const
172 {
173 dterr << "getPosition index[" << _index << "] out of range" << std::endl;
174
175 return 0.0;
176 }
177
178 //==============================================================================
setPositions(const Eigen::VectorXd &)179 void ZeroDofJoint::setPositions(const Eigen::VectorXd& /*_positions*/)
180 {
181 // Do nothing
182 }
183
184 //==============================================================================
getPositions() const185 Eigen::VectorXd ZeroDofJoint::getPositions() const
186 {
187 return Eigen::Matrix<double, 0, 1>();
188 }
189
190 //==============================================================================
setPositionLowerLimit(std::size_t,double)191 void ZeroDofJoint::setPositionLowerLimit(
192 std::size_t /*_index*/, double /*_position*/)
193 {
194 // Do nothing
195 }
196
197 //==============================================================================
getPositionLowerLimit(std::size_t) const198 double ZeroDofJoint::getPositionLowerLimit(std::size_t /*_index*/) const
199 {
200 return 0.0;
201 }
202
203 //==============================================================================
setPositionLowerLimits(const Eigen::VectorXd &)204 void ZeroDofJoint::setPositionLowerLimits(
205 const Eigen::VectorXd& /*lowerLimits*/)
206 {
207 // Do nothing
208 }
209
210 //==============================================================================
getPositionLowerLimits() const211 Eigen::VectorXd ZeroDofJoint::getPositionLowerLimits() const
212 {
213 return Eigen::VectorXd::Zero(0);
214 }
215
216 //==============================================================================
setPositionUpperLimit(std::size_t,double)217 void ZeroDofJoint::setPositionUpperLimit(
218 std::size_t /*_index*/, double /*_position*/)
219 {
220 // Do nothing
221 }
222
223 //==============================================================================
getPositionUpperLimit(std::size_t) const224 double ZeroDofJoint::getPositionUpperLimit(std::size_t /*_index*/) const
225 {
226 return 0.0;
227 }
228
229 //==============================================================================
setPositionUpperLimits(const Eigen::VectorXd &)230 void ZeroDofJoint::setPositionUpperLimits(
231 const Eigen::VectorXd& /*upperLimits*/)
232 {
233 // Do nothing
234 }
235
236 //==============================================================================
getPositionUpperLimits() const237 Eigen::VectorXd ZeroDofJoint::getPositionUpperLimits() const
238 {
239 return Eigen::VectorXd::Zero(0);
240 }
241
242 //==============================================================================
hasPositionLimit(std::size_t) const243 bool ZeroDofJoint::hasPositionLimit(std::size_t /*_index*/) const
244 {
245 return true;
246 }
247
248 //==============================================================================
resetPosition(std::size_t)249 void ZeroDofJoint::resetPosition(std::size_t /*_index*/)
250 {
251 // Do nothing
252 }
253
254 //==============================================================================
resetPositions()255 void ZeroDofJoint::resetPositions()
256 {
257 // Do nothing
258 }
259
260 //==============================================================================
setInitialPosition(std::size_t,double)261 void ZeroDofJoint::setInitialPosition(
262 std::size_t /*_index*/, double /*_initial*/)
263 {
264 // Do nothing
265 }
266
267 //==============================================================================
getInitialPosition(std::size_t) const268 double ZeroDofJoint::getInitialPosition(std::size_t /*_index*/) const
269 {
270 return 0.0;
271 }
272
273 //==============================================================================
setInitialPositions(const Eigen::VectorXd &)274 void ZeroDofJoint::setInitialPositions(const Eigen::VectorXd& /*_initial*/)
275 {
276 // Do nothing
277 }
278
279 //==============================================================================
getInitialPositions() const280 Eigen::VectorXd ZeroDofJoint::getInitialPositions() const
281 {
282 return Eigen::VectorXd();
283 }
284
285 //==============================================================================
setVelocity(std::size_t,double)286 void ZeroDofJoint::setVelocity(std::size_t /*_index*/, double /*_velocity*/)
287 {
288 // Do nothing
289 }
290
291 //==============================================================================
getVelocity(std::size_t) const292 double ZeroDofJoint::getVelocity(std::size_t /*_index*/) const
293 {
294 return 0.0;
295 }
296
297 //==============================================================================
setVelocities(const Eigen::VectorXd &)298 void ZeroDofJoint::setVelocities(const Eigen::VectorXd& /*_velocities*/)
299 {
300 // Do nothing
301 }
302
303 //==============================================================================
getVelocities() const304 Eigen::VectorXd ZeroDofJoint::getVelocities() const
305 {
306 return Eigen::Matrix<double, 0, 1>();
307 }
308
309 //==============================================================================
setVelocityLowerLimit(std::size_t,double)310 void ZeroDofJoint::setVelocityLowerLimit(
311 std::size_t /*_index*/, double /*_velocity*/)
312 {
313 // Do nothing
314 }
315
316 //==============================================================================
getVelocityLowerLimit(std::size_t) const317 double ZeroDofJoint::getVelocityLowerLimit(std::size_t /*_index*/) const
318 {
319 return 0.0;
320 }
321
322 //==============================================================================
setVelocityLowerLimits(const Eigen::VectorXd &)323 void ZeroDofJoint::setVelocityLowerLimits(
324 const Eigen::VectorXd& /*lowerLimits*/)
325 {
326 // Do nothing
327 }
328
329 //==============================================================================
getVelocityLowerLimits() const330 Eigen::VectorXd ZeroDofJoint::getVelocityLowerLimits() const
331 {
332 return Eigen::VectorXd::Zero(0);
333 }
334
335 //==============================================================================
setVelocityUpperLimit(std::size_t,double)336 void ZeroDofJoint::setVelocityUpperLimit(
337 std::size_t /*_index*/, double /*_velocity*/)
338 {
339 // Do nothing
340 }
341
342 //==============================================================================
getVelocityUpperLimit(std::size_t) const343 double ZeroDofJoint::getVelocityUpperLimit(std::size_t /*_index*/) const
344 {
345 return 0.0;
346 }
347
348 //==============================================================================
setVelocityUpperLimits(const Eigen::VectorXd &)349 void ZeroDofJoint::setVelocityUpperLimits(
350 const Eigen::VectorXd& /*upperLimits*/)
351 {
352 // Do nothing
353 }
354
355 //==============================================================================
getVelocityUpperLimits() const356 Eigen::VectorXd ZeroDofJoint::getVelocityUpperLimits() const
357 {
358 return Eigen::VectorXd::Zero(0);
359 }
360
361 //==============================================================================
resetVelocity(std::size_t)362 void ZeroDofJoint::resetVelocity(std::size_t /*_index*/)
363 {
364 // Do nothing
365 }
366
367 //==============================================================================
resetVelocities()368 void ZeroDofJoint::resetVelocities()
369 {
370 // Do nothing
371 }
372
373 //==============================================================================
setInitialVelocity(std::size_t,double)374 void ZeroDofJoint::setInitialVelocity(
375 std::size_t /*_index*/, double /*_initial*/)
376 {
377 // Do nothing
378 }
379
380 //==============================================================================
getInitialVelocity(std::size_t) const381 double ZeroDofJoint::getInitialVelocity(std::size_t /*_index*/) const
382 {
383 return 0.0;
384 }
385
386 //==============================================================================
setInitialVelocities(const Eigen::VectorXd &)387 void ZeroDofJoint::setInitialVelocities(const Eigen::VectorXd& /*_initial*/)
388 {
389 // Do nothing
390 }
391
392 //==============================================================================
getInitialVelocities() const393 Eigen::VectorXd ZeroDofJoint::getInitialVelocities() const
394 {
395 return Eigen::VectorXd();
396 }
397
398 //==============================================================================
setAcceleration(std::size_t,double)399 void ZeroDofJoint::setAcceleration(
400 std::size_t /*_index*/, double /*_acceleration*/)
401 {
402 // Do nothing
403 }
404
405 //==============================================================================
getAcceleration(std::size_t) const406 double ZeroDofJoint::getAcceleration(std::size_t /*_index*/) const
407 {
408 return 0.0;
409 }
410
411 //==============================================================================
setAccelerations(const Eigen::VectorXd &)412 void ZeroDofJoint::setAccelerations(const Eigen::VectorXd& /*_accelerations*/)
413 {
414 // Do nothing
415 }
416
417 //==============================================================================
getAccelerations() const418 Eigen::VectorXd ZeroDofJoint::getAccelerations() const
419 {
420 return Eigen::Matrix<double, 0, 1>();
421 }
422
423 //==============================================================================
resetAccelerations()424 void ZeroDofJoint::resetAccelerations()
425 {
426 // Do nothing
427 }
428
429 //==============================================================================
setAccelerationLowerLimit(std::size_t,double)430 void ZeroDofJoint::setAccelerationLowerLimit(
431 std::size_t /*_index*/, double /*_acceleration*/)
432 {
433 // Do nothing
434 }
435
436 //==============================================================================
getAccelerationLowerLimit(std::size_t) const437 double ZeroDofJoint::getAccelerationLowerLimit(std::size_t /*_index*/) const
438 {
439 return 0.0;
440 }
441
442 //==============================================================================
setAccelerationLowerLimits(const Eigen::VectorXd &)443 void ZeroDofJoint::setAccelerationLowerLimits(
444 const Eigen::VectorXd& /*lowerLimits*/)
445 {
446 // Do nothing
447 }
448
449 //==============================================================================
getAccelerationLowerLimits() const450 Eigen::VectorXd ZeroDofJoint::getAccelerationLowerLimits() const
451 {
452 return Eigen::VectorXd::Zero(0);
453 }
454
455 //==============================================================================
setAccelerationUpperLimit(std::size_t,double)456 void ZeroDofJoint::setAccelerationUpperLimit(
457 std::size_t /*_index*/, double /*_acceleration*/)
458 {
459 // Do nothing
460 }
461
462 //==============================================================================
getAccelerationUpperLimit(std::size_t) const463 double ZeroDofJoint::getAccelerationUpperLimit(std::size_t /*_index*/) const
464 {
465 return 0.0;
466 }
467
468 //==============================================================================
setAccelerationUpperLimits(const Eigen::VectorXd &)469 void ZeroDofJoint::setAccelerationUpperLimits(
470 const Eigen::VectorXd& /*upperLimits*/)
471 {
472 // Do nothing
473 }
474
475 //==============================================================================
getAccelerationUpperLimits() const476 Eigen::VectorXd ZeroDofJoint::getAccelerationUpperLimits() const
477 {
478 return Eigen::VectorXd::Zero(0);
479 }
480
481 //==============================================================================
setForce(std::size_t,double)482 void ZeroDofJoint::setForce(std::size_t /*_index*/, double /*_force*/)
483 {
484 // Do nothing
485 }
486
487 //==============================================================================
getForce(std::size_t) const488 double ZeroDofJoint::getForce(std::size_t /*_index*/) const
489 {
490 return 0.0;
491 }
492
493 //==============================================================================
setForces(const Eigen::VectorXd &)494 void ZeroDofJoint::setForces(const Eigen::VectorXd& /*_forces*/)
495 {
496 // Do nothing
497 }
498
499 //==============================================================================
getForces() const500 Eigen::VectorXd ZeroDofJoint::getForces() const
501 {
502 return Eigen::Matrix<double, 0, 1>();
503 }
504
505 //==============================================================================
resetForces()506 void ZeroDofJoint::resetForces()
507 {
508 // Do nothing
509 }
510
511 //==============================================================================
setForceLowerLimit(std::size_t,double)512 void ZeroDofJoint::setForceLowerLimit(std::size_t /*_index*/, double /*_force*/)
513 {
514 // Do nothing
515 }
516
517 //==============================================================================
getForceLowerLimit(std::size_t) const518 double ZeroDofJoint::getForceLowerLimit(std::size_t /*_index*/) const
519 {
520 return 0.0;
521 }
522
523 //==============================================================================
setForceLowerLimits(const Eigen::VectorXd &)524 void ZeroDofJoint::setForceLowerLimits(const Eigen::VectorXd& /*lowerLimits*/)
525 {
526 // Do nothing
527 }
528
529 //==============================================================================
getForceLowerLimits() const530 Eigen::VectorXd ZeroDofJoint::getForceLowerLimits() const
531 {
532 return Eigen::VectorXd::Zero(0);
533 }
534
535 //==============================================================================
setForceUpperLimit(std::size_t,double)536 void ZeroDofJoint::setForceUpperLimit(std::size_t /*_index*/, double /*_force*/)
537 {
538 // Do nothing
539 }
540
541 //==============================================================================
getForceUpperLimit(std::size_t) const542 double ZeroDofJoint::getForceUpperLimit(std::size_t /*_index*/) const
543 {
544 return 0.0;
545 }
546
547 //==============================================================================
setForceUpperLimits(const Eigen::VectorXd &)548 void ZeroDofJoint::setForceUpperLimits(const Eigen::VectorXd& /*upperLimits*/)
549 {
550 // Do nothing
551 }
552
553 //==============================================================================
getForceUpperLimits() const554 Eigen::VectorXd ZeroDofJoint::getForceUpperLimits() const
555 {
556 return Eigen::VectorXd::Zero(0);
557 }
558
559 //==============================================================================
setVelocityChange(std::size_t,double)560 void ZeroDofJoint::setVelocityChange(
561 std::size_t /*_index*/, double /*_velocityChange*/)
562 {
563 // Do nothing
564 }
565
566 //==============================================================================
getVelocityChange(std::size_t) const567 double ZeroDofJoint::getVelocityChange(std::size_t /*_index*/) const
568 {
569 return 0.0;
570 }
571
572 //==============================================================================
resetVelocityChanges()573 void ZeroDofJoint::resetVelocityChanges()
574 {
575 // Do nothing
576 }
577
578 //==============================================================================
setConstraintImpulse(std::size_t,double)579 void ZeroDofJoint::setConstraintImpulse(
580 std::size_t /*_index*/, double /*_impulse*/)
581 {
582 // Do nothing
583 }
584
585 //==============================================================================
getConstraintImpulse(std::size_t) const586 double ZeroDofJoint::getConstraintImpulse(std::size_t /*_index*/) const
587 {
588 return 0.0;
589 }
590
591 //==============================================================================
resetConstraintImpulses()592 void ZeroDofJoint::resetConstraintImpulses()
593 {
594 // Do nothing
595 }
596
597 //==============================================================================
integratePositions(double)598 void ZeroDofJoint::integratePositions(double /*_dt*/)
599 {
600 // Do nothing
601 }
602
603 //==============================================================================
integrateVelocities(double)604 void ZeroDofJoint::integrateVelocities(double /*_dt*/)
605 {
606 // Do nothing
607 }
608
609 //==============================================================================
getPositionDifferences(const Eigen::VectorXd &,const Eigen::VectorXd &) const610 Eigen::VectorXd ZeroDofJoint::getPositionDifferences(
611 const Eigen::VectorXd& /*_q2*/, const Eigen::VectorXd& /*_q1*/) const
612 {
613 return Eigen::VectorXd::Zero(0);
614 }
615
616 //==============================================================================
setSpringStiffness(std::size_t,double)617 void ZeroDofJoint::setSpringStiffness(std::size_t /*_index*/, double /*_k*/)
618 {
619 // Do nothing
620 }
621
622 //==============================================================================
getSpringStiffness(std::size_t) const623 double ZeroDofJoint::getSpringStiffness(std::size_t /*_index*/) const
624 {
625 return 0.0;
626 }
627
628 //==============================================================================
setRestPosition(std::size_t,double)629 void ZeroDofJoint::setRestPosition(std::size_t /*_index*/, double /*_q0*/)
630 {
631 // Do nothing
632 }
633
634 //==============================================================================
getRestPosition(std::size_t) const635 double ZeroDofJoint::getRestPosition(std::size_t /*_index*/) const
636 {
637 return 0.0;
638 }
639
640 //==============================================================================
setDampingCoefficient(std::size_t,double)641 void ZeroDofJoint::setDampingCoefficient(std::size_t /*_index*/, double /*_d*/)
642 {
643 // Do nothing
644 }
645
646 //==============================================================================
getDampingCoefficient(std::size_t) const647 double ZeroDofJoint::getDampingCoefficient(std::size_t /*_index*/) const
648 {
649 return 0.0;
650 }
651
652 //==============================================================================
setCoulombFriction(std::size_t,double)653 void ZeroDofJoint::setCoulombFriction(
654 std::size_t /*_index*/, double /*_friction*/)
655 {
656 // Do nothing
657 }
658
659 //==============================================================================
getCoulombFriction(std::size_t) const660 double ZeroDofJoint::getCoulombFriction(std::size_t /*_index*/) const
661 {
662 return 0.0;
663 }
664
665 //==============================================================================
computePotentialEnergy() const666 double ZeroDofJoint::computePotentialEnergy() const
667 {
668 return 0.0;
669 }
670
671 //==============================================================================
ZeroDofJoint()672 ZeroDofJoint::ZeroDofJoint()
673 {
674 // Do nothing. The Joint Aspect must be created by the most derived class.
675 }
676
677 //==============================================================================
registerDofs()678 void ZeroDofJoint::registerDofs()
679 {
680 // Do nothing
681 }
682
683 //==============================================================================
updateDegreeOfFreedomNames()684 void ZeroDofJoint::updateDegreeOfFreedomNames()
685 {
686 // Do nothing
687 }
688
689 //==============================================================================
getBodyConstraintWrench() const690 Eigen::Vector6d ZeroDofJoint::getBodyConstraintWrench() const
691 {
692 assert(mChildBodyNode);
693 return mChildBodyNode->getBodyForce();
694 }
695
696 //==============================================================================
getRelativeJacobian() const697 const math::Jacobian ZeroDofJoint::getRelativeJacobian() const
698 {
699 return Eigen::Matrix<double, 6, 0>();
700 }
701
702 //==============================================================================
getRelativeJacobian(const Eigen::VectorXd &) const703 math::Jacobian ZeroDofJoint::getRelativeJacobian(
704 const Eigen::VectorXd& /*_positions*/) const
705 {
706 return Eigen::Matrix<double, 6, 0>();
707 }
708
709 //==============================================================================
getRelativeJacobianTimeDeriv() const710 const math::Jacobian ZeroDofJoint::getRelativeJacobianTimeDeriv() const
711 {
712 return Eigen::Matrix<double, 6, 0>();
713 }
714
715 //==============================================================================
addVelocityTo(Eigen::Vector6d &)716 void ZeroDofJoint::addVelocityTo(Eigen::Vector6d& /*_vel*/)
717 {
718 // Do nothing
719 }
720
721 //==============================================================================
addVelocityChangeTo(Eigen::Vector6d &)722 void ZeroDofJoint::addVelocityChangeTo(Eigen::Vector6d& /*_velocityChange*/)
723 {
724 // Do nothing
725 }
726
727 //==============================================================================
setPartialAccelerationTo(Eigen::Vector6d & _partialAcceleration,const Eigen::Vector6d &)728 void ZeroDofJoint::setPartialAccelerationTo(
729 Eigen::Vector6d& _partialAcceleration,
730 const Eigen::Vector6d& /*_childVelocity*/)
731 {
732 _partialAcceleration.setZero();
733 }
734
735 //==============================================================================
addAccelerationTo(Eigen::Vector6d &)736 void ZeroDofJoint::addAccelerationTo(Eigen::Vector6d& /*_acc*/)
737 {
738 // Do nothing
739 }
740
741 //==============================================================================
addChildArtInertiaTo(Eigen::Matrix6d & _parentArtInertia,const Eigen::Matrix6d & _childArtInertia)742 void ZeroDofJoint::addChildArtInertiaTo(
743 Eigen::Matrix6d& _parentArtInertia, const Eigen::Matrix6d& _childArtInertia)
744 {
745 // Add child body's articulated inertia to parent body's articulated inertia.
746 // Note that mT should be updated.
747 _parentArtInertia += math::transformInertia(
748 getRelativeTransform().inverse(), _childArtInertia);
749 }
750
751 //==============================================================================
addChildArtInertiaImplicitTo(Eigen::Matrix6d & _parentArtInertia,const Eigen::Matrix6d & _childArtInertia)752 void ZeroDofJoint::addChildArtInertiaImplicitTo(
753 Eigen::Matrix6d& _parentArtInertia, const Eigen::Matrix6d& _childArtInertia)
754 {
755 // Add child body's articulated inertia to parent body's articulated inertia.
756 // Note that mT should be updated.
757 _parentArtInertia += math::transformInertia(
758 getRelativeTransform().inverse(), _childArtInertia);
759 }
760
761 //==============================================================================
updateInvProjArtInertia(const Eigen::Matrix6d &)762 void ZeroDofJoint::updateInvProjArtInertia(
763 const Eigen::Matrix6d& /*_artInertia*/)
764 {
765 // Do nothing
766 }
767
768 //==============================================================================
updateInvProjArtInertiaImplicit(const Eigen::Matrix6d &,double)769 void ZeroDofJoint::updateInvProjArtInertiaImplicit(
770 const Eigen::Matrix6d& /*_artInertia*/, double /*_timeStep*/)
771 {
772 // Do nothing
773 }
774
775 //==============================================================================
addChildBiasForceTo(Eigen::Vector6d & _parentBiasForce,const Eigen::Matrix6d & _childArtInertia,const Eigen::Vector6d & _childBiasForce,const Eigen::Vector6d & _childPartialAcc)776 void ZeroDofJoint::addChildBiasForceTo(
777 Eigen::Vector6d& _parentBiasForce,
778 const Eigen::Matrix6d& _childArtInertia,
779 const Eigen::Vector6d& _childBiasForce,
780 const Eigen::Vector6d& _childPartialAcc)
781 {
782 // Add child body's bias force to parent body's bias force. Note that mT
783 // should be updated.
784 _parentBiasForce += math::dAdInvT(
785 getRelativeTransform(),
786 _childBiasForce + _childArtInertia * _childPartialAcc);
787 }
788
789 //==============================================================================
addChildBiasImpulseTo(Eigen::Vector6d & _parentBiasImpulse,const Eigen::Matrix6d &,const Eigen::Vector6d & _childBiasImpulse)790 void ZeroDofJoint::addChildBiasImpulseTo(
791 Eigen::Vector6d& _parentBiasImpulse,
792 const Eigen::Matrix6d& /*_childArtInertia*/,
793 const Eigen::Vector6d& _childBiasImpulse)
794 {
795 // Add child body's bias force to parent body's bias impulse. Note that mT
796 // should be updated.
797 _parentBiasImpulse
798 += math::dAdInvT(getRelativeTransform(), _childBiasImpulse);
799 }
800
801 //==============================================================================
updateTotalForce(const Eigen::Vector6d &,double)802 void ZeroDofJoint::updateTotalForce(
803 const Eigen::Vector6d& /*_bodyForce*/, double /*_timeStep*/)
804 {
805 // Do nothing
806 }
807
808 //==============================================================================
updateTotalImpulse(const Eigen::Vector6d &)809 void ZeroDofJoint::updateTotalImpulse(const Eigen::Vector6d& /*_bodyImpulse*/)
810 {
811 // Do nothing
812 }
813
814 //==============================================================================
resetTotalImpulses()815 void ZeroDofJoint::resetTotalImpulses()
816 {
817 // Do nothing
818 }
819
820 //==============================================================================
updateAcceleration(const Eigen::Matrix6d &,const Eigen::Vector6d &)821 void ZeroDofJoint::updateAcceleration(
822 const Eigen::Matrix6d& /*_artInertia*/,
823 const Eigen::Vector6d& /*_spatialAcc*/)
824 {
825 // Do nothing
826 }
827
828 //==============================================================================
updateVelocityChange(const Eigen::Matrix6d &,const Eigen::Vector6d &)829 void ZeroDofJoint::updateVelocityChange(
830 const Eigen::Matrix6d& /*_artInertia*/,
831 const Eigen::Vector6d& /*_velocityChange*/)
832 {
833 // Do nothing
834 }
835
836 //==============================================================================
updateForceID(const Eigen::Vector6d &,double,bool,bool)837 void ZeroDofJoint::updateForceID(
838 const Eigen::Vector6d& /*_bodyForce*/,
839 double /*_timeStep*/,
840 bool /*_withDampingForces*/,
841 bool /*_withSpringForces*/)
842 {
843 // Do nothing
844 }
845
846 //==============================================================================
updateForceFD(const Eigen::Vector6d &,double,bool,bool)847 void ZeroDofJoint::updateForceFD(
848 const Eigen::Vector6d& /*_bodyForce*/,
849 double /*_timeStep*/,
850 bool /*_withDampingForces*/,
851 bool /*_withSpringForces*/)
852 {
853 // Do nothing
854 }
855
856 //==============================================================================
updateImpulseID(const Eigen::Vector6d &)857 void ZeroDofJoint::updateImpulseID(const Eigen::Vector6d& /*_bodyImpulse*/)
858 {
859 // Do nothing
860 }
861
862 //==============================================================================
updateImpulseFD(const Eigen::Vector6d &)863 void ZeroDofJoint::updateImpulseFD(const Eigen::Vector6d& /*_bodyImpulse*/)
864 {
865 // Do nothing
866 }
867
868 //==============================================================================
updateConstrainedTerms(double)869 void ZeroDofJoint::updateConstrainedTerms(double /*_timeStep*/)
870 {
871 // Do nothing
872 }
873
874 //==============================================================================
addChildBiasForceForInvMassMatrix(Eigen::Vector6d &,const Eigen::Matrix6d &,const Eigen::Vector6d &)875 void ZeroDofJoint::addChildBiasForceForInvMassMatrix(
876 Eigen::Vector6d& /*_parentBiasForce*/,
877 const Eigen::Matrix6d& /*_childArtInertia*/,
878 const Eigen::Vector6d& /*_childBiasForce*/)
879 {
880 // TODO(JS)
881 }
882
883 //==============================================================================
addChildBiasForceForInvAugMassMatrix(Eigen::Vector6d &,const Eigen::Matrix6d &,const Eigen::Vector6d &)884 void ZeroDofJoint::addChildBiasForceForInvAugMassMatrix(
885 Eigen::Vector6d& /*_parentBiasForce*/,
886 const Eigen::Matrix6d& /*_childArtInertia*/,
887 const Eigen::Vector6d& /*_childBiasForce*/)
888 {
889 // TODO(JS)
890 }
891
892 //==============================================================================
updateTotalForceForInvMassMatrix(const Eigen::Vector6d &)893 void ZeroDofJoint::updateTotalForceForInvMassMatrix(
894 const Eigen::Vector6d& /*_bodyForce*/)
895 {
896 // TODO(JS)
897 }
898
899 //==============================================================================
getInvMassMatrixSegment(Eigen::MatrixXd &,const std::size_t,const Eigen::Matrix6d &,const Eigen::Vector6d &)900 void ZeroDofJoint::getInvMassMatrixSegment(
901 Eigen::MatrixXd& /*_invMassMat*/,
902 const std::size_t /*_col*/,
903 const Eigen::Matrix6d& /*_artInertia*/,
904 const Eigen::Vector6d& /*_spatialAcc*/)
905 {
906 // TODO(JS)
907 }
908
909 //==============================================================================
getInvAugMassMatrixSegment(Eigen::MatrixXd &,const std::size_t,const Eigen::Matrix6d &,const Eigen::Vector6d &)910 void ZeroDofJoint::getInvAugMassMatrixSegment(
911 Eigen::MatrixXd& /*_invMassMat*/,
912 const std::size_t /*_col*/,
913 const Eigen::Matrix6d& /*_artInertia*/,
914 const Eigen::Vector6d& /*_spatialAcc*/)
915 {
916 // TODO(JS)
917 }
918
919 //==============================================================================
addInvMassMatrixSegmentTo(Eigen::Vector6d &)920 void ZeroDofJoint::addInvMassMatrixSegmentTo(Eigen::Vector6d& /*_acc*/)
921 {
922 // TODO(JS)
923 }
924
925 //==============================================================================
getSpatialToGeneralized(const Eigen::Vector6d &)926 Eigen::VectorXd ZeroDofJoint::getSpatialToGeneralized(
927 const Eigen::Vector6d& /*_spatial*/)
928 {
929 // Return zero size vector
930 return Eigen::VectorXd::Zero(0);
931 }
932
933 } // namespace dynamics
934 } // namespace dart
935