Simbody  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Constraint.h
Go to the documentation of this file.
1 #ifndef SimTK_SIMBODY_CONSTRAINT_H_
2 #define SimTK_SIMBODY_CONSTRAINT_H_
3 
4 /* -------------------------------------------------------------------------- *
5  * Simbody(tm) *
6  * -------------------------------------------------------------------------- *
7  * This is part of the SimTK biosimulation toolkit originating from *
8  * Simbios, the NIH National Center for Physics-Based Simulation of *
9  * Biological Structures at Stanford, funded under the NIH Roadmap for *
10  * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody. *
11  * *
12  * Portions copyright (c) 2007-12 Stanford University and the Authors. *
13  * Authors: Michael Sherman *
14  * Contributors: *
15  * *
16  * Licensed under the Apache License, Version 2.0 (the "License"); you may *
17  * not use this file except in compliance with the License. You may obtain a *
18  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. *
19  * *
20  * Unless required by applicable law or agreed to in writing, software *
21  * distributed under the License is distributed on an "AS IS" BASIS, *
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
23  * See the License for the specific language governing permissions and *
24  * limitations under the License. *
25  * -------------------------------------------------------------------------- */
26 
33 #include "SimTKmath.h"
35 
36 #include <cassert>
37 
38 namespace SimTK {
39 
40 class SimbodyMatterSubsystem;
41 class SimbodyMatterSubtree;
42 class MobilizedBody;
43 class Constraint;
44 class ConstraintImpl;
45 
46 // We only want the template instantiation to occur once. This symbol is
47 // defined in the SimTK core compilation unit that defines the Constraint
48 // class but should not be defined any other time.
49 #ifndef SimTK_SIMBODY_DEFINING_CONSTRAINT
50  extern template class PIMPLHandle<Constraint, ConstraintImpl, true>;
51 #endif
52 
54  // CONSTRAINT BASE CLASS //
56 
68 public:
74 explicit Constraint(ConstraintImpl* r) : HandleBase(r) { }
75 
79 void disable(State&) const;
80 
87 void enable(State&) const;
90 bool isDisabled(const State&) const;
94 bool isDisabledByDefault() const;
95 
100 void setDisabledByDefault(bool shouldBeDisabled);
101 
104 operator ConstraintIndex() const {return getConstraintIndex();}
105 
111 const SimbodyMatterSubsystem& getMatterSubsystem() const;
112 
118 SimbodyMatterSubsystem& updMatterSubsystem();
119 
126 ConstraintIndex getConstraintIndex() const;
127 
129 bool isInSubsystem() const;
133 bool isInSameSubsystem(const MobilizedBody& mobod) const;
134 
135  // TOPOLOGY STAGE (i.e., post-construction) //
136 
142 int getNumConstrainedBodies() const;
143 
148 const MobilizedBody& getMobilizedBodyFromConstrainedBody
149  (ConstrainedBodyIndex consBodyIx) const;
150 
155 const MobilizedBody& getAncestorMobilizedBody() const;
156 
163 int getNumConstrainedMobilizers() const;
164 
169 const MobilizedBody& getMobilizedBodyFromConstrainedMobilizer
170  (ConstrainedMobilizerIndex consMobilizerIx) const;
171 
174 const SimbodyMatterSubtree& getSubtree() const;
175 
176  // MODEL STAGE //
177 // nothing in base class currently
178 
179  // INSTANCE STAGE //
180 
185 int getNumConstrainedQ(const State&, ConstrainedMobilizerIndex) const;
190 int getNumConstrainedU(const State&, ConstrainedMobilizerIndex) const;
191 
198 ConstrainedUIndex getConstrainedUIndex
199  (const State&, ConstrainedMobilizerIndex, MobilizerUIndex which) const;
206 ConstrainedQIndex getConstrainedQIndex
207  (const State&, ConstrainedMobilizerIndex, MobilizerQIndex which) const;
208 
211 int getNumConstrainedQ(const State&) const;
212 
217 int getNumConstrainedU(const State&) const;
218 
221 QIndex getQIndexOfConstrainedQ(const State& state,
222  ConstrainedQIndex consQIndex) const;
225 UIndex getUIndexOfConstrainedU(const State& state,
226  ConstrainedUIndex consUIndex) const;
227 
241 void getNumConstraintEquationsInUse(const State& state,
242  int& mp, int& mv, int& ma) const;
243 
266 void getIndexOfMultipliersInUse(const State& state,
267  MultiplierIndex& px0,
268  MultiplierIndex& vx0,
269  MultiplierIndex& ax0) const;
270 
292 void setMyPartInConstraintSpaceVector(const State& state,
293  const Vector& myPart,
294  Vector& constraintSpace) const;
295 
313 void getMyPartFromConstraintSpaceVector(const State& state,
314  const Vector& constraintSpace,
315  Vector& myPart) const;
316 
317  // POSITION STAGE //
320 Vector getPositionErrorsAsVector(const State&) const; // mp of these
321 Vector calcPositionErrorFromQ(const State&, const Vector& q) const;
322 
323 // Matrix P = partial(perr_dot)/partial(u). (just the holonomic constraints)
324 Matrix calcPositionConstraintMatrixP(const State&) const; // mp X nu
325 Matrix calcPositionConstraintMatrixPt(const State&) const; // nu X mp
326 
327 // Matrix PNInv = partial(perr)/partial(q) = P*N^-1
328 Matrix calcPositionConstraintMatrixPNInv(const State&) const; // mp X nq
329 
345 void calcConstraintForcesFromMultipliers(const State&,
346  const Vector& lambda, // mp+mv+ma of these
347  Vector_<SpatialVec>& bodyForcesInA, // numConstrainedBodies
348  Vector& mobilityForces) const; // numConstrainedU
349 
350  // VELOCITY STAGE //
353 Vector getVelocityErrorsAsVector(const State&) const; // mp+mv of these
354 Vector calcVelocityErrorFromU(const State&, // mp+mv of these
355  const Vector& u) const; // numParticipatingU u's
356 
357 // Matrix V = partial(verr)/partial(u) for just the non-holonomic
358 // constraints.
359 Matrix calcVelocityConstraintMatrixV(const State&) const; // mv X nu
360 Matrix calcVelocityConstraintMatrixVt(const State&) const; // nu X mv
361 
362  // DYNAMICS STAGE //
363 // nothing in base class currently
364 
365  // ACCELERATION STAGE //
369 Vector getAccelerationErrorsAsVector(const State&) const; // mp+mv+ma of these
370 Vector calcAccelerationErrorFromUDot(const State&, // mp+mv+ma of these
371  const Vector& udot) const; // numParticipatingU udot's
372 
376 Vector getMultipliersAsVector(const State&) const; // mp+mv+ma of these
377 
390 void getConstraintForcesAsVectors
391  (const State& state,
392  Vector_<SpatialVec>& bodyForcesInG, // numConstrainedBodies
393  Vector& mobilityForces) const; // numConstrainedU
394 
398  Vector_<SpatialVec> bodyForcesInG;
399  Vector mobilityForces;
400  getConstraintForcesAsVectors(state,bodyForcesInG,mobilityForces);
401  return bodyForcesInG;
402 }
407  Vector_<SpatialVec> bodyForcesInG;
408  Vector mobilityForces;
409  getConstraintForcesAsVectors(state,bodyForcesInG,mobilityForces);
410  return mobilityForces;
411 }
412 
436 Real calcPower(const State& state) const;
437 
438 // Matrix A = partial(aerr)/partial(udot) for just the acceleration-only
439 // constraints.
440 Matrix calcAccelerationConstraintMatrixA(const State&) const; // ma X nu
441 Matrix calcAccelerationConstraintMatrixAt(const State&) const; // nu X ma
442 
443 
444 // These are the built-in Constraint types. Types on the same line are
445 // synonymous.
446 class Rod; typedef Rod ConstantDistance;
447 class Ball; typedef Ball CoincidentPoints; typedef Ball Spherical;
448 class Weld; typedef Weld CoincidentFrames;
449 class PointInPlane; // translations perpendicular to plane normal only
450 class PointOnLine; // translations along a line only
451 class ConstantAngle; // prevent rotation about common normal of two vectors
452 class ConstantOrientation; // allows any translation but no rotation
453 class NoSlip1D; // same velocity at a point along a direction
454 class BallRollingOnPlane; // ball in contact and rolling w/o slip against plane
455 class ConstantSpeed; // prescribe generalized speed value
456 class ConstantAcceleration; // prescribe generalized acceleration value
457 class Custom;
458 class CoordinateCoupler;
459 class SpeedCoupler;
460 class PrescribedMotion;
461 
462 class RodImpl;
463 class BallImpl;
464 class WeldImpl;
465 class PointInPlaneImpl;
466 class PointOnLineImpl;
467 class ConstantAngleImpl;
468 class ConstantOrientationImpl;
469 class NoSlip1DImpl;
470 class BallRollingOnPlaneImpl;
471 class ConstantSpeedImpl;
472 class ConstantAccelerationImpl;
473 class CustomImpl;
474 class CoordinateCouplerImpl;
475 class SpeedCouplerImpl;
476 class PrescribedMotionImpl;
477 };
478 
480  // ROD (CONSTANT DISTANCE) CONSTRAINT //
482 
499 public:
500  // no default constructor
501  Rod(MobilizedBody& body1, MobilizedBody& body2,
502  Real defaultLength=1);
503  Rod(MobilizedBody& body1, const Vec3& defaultPoint1,
504  MobilizedBody& body2, const Vec3& defaultPoint2,
505  Real defaultLength=1);
506 
508  Rod() {}
509 
510  // Defaults for Instance variables.
511  Rod& setDefaultPointOnBody1(const Vec3&);
512  Rod& setDefaultPointOnBody2(const Vec3&);
513  Rod& setDefaultRodLength(Real);
514 
515  // Stage::Topology
516  MobilizedBodyIndex getBody1MobilizedBodyIndex() const;
517  MobilizedBodyIndex getBody2MobilizedBodyIndex() const;
518  const Vec3& getDefaultPointOnBody1() const;
519  const Vec3& getDefaultPointOnBody2() const;
520  Real getDefaultRodLength() const;
521 
522  // Stage::Instance
523  const Vec3& getPointOnBody1(const State&) const;
524  const Vec3& getPointOnBody2(const State&) const;
525  Real getRodLength (const State&) const;
526 
527  // Stage::Position, Velocity, Acceleration
528  Real getPositionError(const State&) const;
529  Real getVelocityError(const State&) const;
530 
531  // Stage::Acceleration
532  Real getAccelerationError(const State&) const;
533  Real getMultiplier(const State&) const;
534  Real getRodTension(const State&) const; // negative means compression
535  // hide from Doxygen
539 };
540 
542  // POINT IN PLANE CONSTRAINT //
544 
556 public:
557  // no default constructor
558  PointInPlane(MobilizedBody& planeBody_B, const UnitVec3& defaultPlaneNormal_B, Real defaultHeight,
559  MobilizedBody& followerBody_F, const Vec3& defaultFollowerPoint_F);
560 
563 
564  // These affect only generated decorative geometry for visualization;
565  // the plane is really infinite in extent with zero depth and the
566  // point is really of zero radius.
567  PointInPlane& setPlaneDisplayHalfWidth(Real);
568  PointInPlane& setPointDisplayRadius(Real);
569  Real getPlaneDisplayHalfWidth() const;
570  Real getPointDisplayRadius() const;
571 
572  // Defaults for Instance variables.
573  PointInPlane& setDefaultPlaneNormal(const UnitVec3&);
574  PointInPlane& setDefaultPlaneHeight(Real);
575  PointInPlane& setDefaultFollowerPoint(const Vec3&);
576 
577  // Stage::Topology
578  MobilizedBodyIndex getPlaneMobilizedBodyIndex() const;
579  MobilizedBodyIndex getFollowerMobilizedBodyIndex() const;
580 
581  const UnitVec3& getDefaultPlaneNormal() const;
582  Real getDefaultPlaneHeight() const;
583  const Vec3& getDefaultFollowerPoint() const;
584 
585  // Stage::Instance
586  const UnitVec3& getPlaneNormal(const State&) const;
587  Real getPlaneHeight(const State&) const;
588  const Vec3& getFollowerPoint(const State&) const;
589 
590  // Stage::Position, Velocity
591  Real getPositionError(const State&) const;
592  Real getVelocityError(const State&) const;
593 
594  // Stage::Acceleration
595  Real getAccelerationError(const State&) const;
596  Real getMultiplier(const State&) const;
597  Real getForceOnFollowerPoint(const State&) const; // in normal direction
598  // hide from Doxygen
601  (PointInPlane, PointInPlaneImpl, Constraint);
603 };
604 
606  // POINT ON LINE CONSTRAINT //
608 
620 public:
621  // no default constructor
622  PointOnLine(MobilizedBody& lineBody_B, const UnitVec3& defaultLineDirection_B, const Vec3& defaultPointOnLine_B,
623  MobilizedBody& followerBody_F, const Vec3& defaultFollowerPoint_F);
624 
627 
628  // These affect only generated decorative geometry for visualization;
629  // the line is really infinite in extent and the
630  // point is really of zero radius.
631  PointOnLine& setLineDisplayHalfLength(Real);
632  PointOnLine& setPointDisplayRadius(Real);
633  Real getLineDisplayHalfLength() const;
634  Real getPointDisplayRadius() const;
635 
636  // Defaults for Instance variables.
637  PointOnLine& setDefaultLineDirection(const UnitVec3&);
638  PointOnLine& setDefaultPointOnLine(const Vec3&);
639  PointOnLine& setDefaultFollowerPoint(const Vec3&);
640 
641  // Stage::Topology
642  MobilizedBodyIndex getLineMobilizedBodyIndex() const;
643  MobilizedBodyIndex getFollowerMobilizedBodyIndex() const;
644 
645  const UnitVec3& getDefaultLineDirection() const;
646  const Vec3& getDefaultPointOnLine() const;
647  const Vec3& getDefaultFollowerPoint() const;
648 
649  // Stage::Instance
650  const UnitVec3& getLineDirection(const State&) const;
651  const Vec3& getPointOnLine(const State&) const;
652  const Vec3& getFollowerPoint(const State&) const;
653 
654  // Stage::Position, Velocity
655  Vec2 getPositionErrors(const State&) const;
656  Vec2 getVelocityErrors(const State&) const;
657 
658  // Stage::Acceleration
659  Vec2 getAccelerationErrors(const State&) const;
660  Vec2 getMultipliers(const State&) const;
661  const Vec2& getForceOnFollowerPoint(const State&) const; // in normal direction
662  // hide from Doxygen
665  (PointOnLine, PointOnLineImpl, Constraint);
667 };
668 
670  // CONSTANT ANGLE CONSTRAINT //
672 
702 public:
703  // no default constructor
704  ConstantAngle(MobilizedBody& baseBody_B, const UnitVec3& defaultAxis_B,
705  MobilizedBody& followerBody_F, const UnitVec3& defaultAxis_F,
706  Real angle = Pi/2);
707 
710 
711  // These affect only generated decorative geometry for visualization.
712  ConstantAngle& setAxisDisplayLength(Real);
713  ConstantAngle& setAxisDisplayWidth(Real);
714  Real getAxisDisplayLength() const;
715  Real getAxisDisplayWidth() const;
716 
717  // Defaults for Instance variables.
718  ConstantAngle& setDefaultBaseAxis(const UnitVec3&);
719  ConstantAngle& setDefaultFollowerAxis(const UnitVec3&);
720  ConstantAngle& setDefaultAngle(Real);
721 
722  // Stage::Topology
723  MobilizedBodyIndex getBaseMobilizedBodyIndex() const;
724  MobilizedBodyIndex getFollowerMobilizedBodyIndex() const;
725 
726  const UnitVec3& getDefaultBaseAxis() const;
727  const UnitVec3& getDefaultFollowerAxis() const;
728  Real getDefaultAngle() const;
729 
730  // Stage::Instance
731  const UnitVec3& getBaseAxis(const State&) const;
732  const UnitVec3& getFollowerAxis(const State&) const;
733  Real getAngle(const State&) const;
734 
735  // Stage::Position, Velocity
736  Real getPositionError(const State&) const;
737  Real getVelocityError(const State&) const;
738 
739  // Stage::Acceleration
740  Real getAccelerationError(const State&) const;
741  Real getMultiplier(const State&) const;
742  Real getTorqueOnFollowerBody(const State&) const; // about f X b
743  // hide from Doxygen
747 };
748 
750  // BALL (COINCIDENT POINTS) CONSTRAINT //
752 
773 public:
777  Ball(MobilizedBody& body1, MobilizedBody& body2);
781  Ball(MobilizedBody& body1, const Vec3& defaultPoint1,
782  MobilizedBody& body2, const Vec3& defaultPoint2);
783 
785  Ball() {}
786 
791  void setPointOnBody1(State& state, const Vec3& point_B1) const;
796  void setPointOnBody2(State& state, const Vec3& point_B2) const;
797 
800  const Vec3& getPointOnBody1(const State& state) const;
803  const Vec3& getPointOnBody2(const State& state) const;
804 
809  Ball& setDefaultPointOnBody1(const Vec3& defaultPoint_B1);
814  Ball& setDefaultPointOnBody2(const Vec3& defaultPoint_B2);
815 
820  const Vec3& getDefaultPointOnBody1() const;
825  const Vec3& getDefaultPointOnBody2() const;
826 
827 
830  Ball& setDefaultRadius(Real r);
833  Real getDefaultRadius() const;
834 
836  MobilizedBodyIndex getBody1MobilizedBodyIndex() const;
838  MobilizedBodyIndex getBody2MobilizedBodyIndex() const;
839 
840 
846  Vec3 getPositionErrors(const State& state) const;
847 
854  Vec3 getVelocityErrors(const State& state) const;
855 
864  Vec3 getAccelerationErrors(const State&) const;
865 
869  Vec3 getBallReactionForceOnBody1(const State&) const;
873  Vec3 getBallReactionForceOnBody2(const State&) const;
874 
882  Vec3 getMultipliers(const State& state) const;
883  // hide from Doxygen
887 };
888 
890  // CONSTANT ORIENTATION CONSTRAINT //
892 
910 {
911 public:
912  // no default constructor
913  ConstantOrientation(MobilizedBody& baseBody_B, const Rotation& defaultRB,
914  MobilizedBody& followerBody_F, const Rotation& defaultRF);
915 
918 
919  //TODO: default visualization geometry?
920 
921  // Defaults for Instance variables.
922  ConstantOrientation& setDefaultBaseRotation(const Rotation&);
923  ConstantOrientation& setDefaultFollowerRotation(const Rotation&);
924 
925  // Stage::Topology
926  MobilizedBodyIndex getBaseMobilizedBodyIndex() const;
927  MobilizedBodyIndex getFollowerMobilizedBodyIndex() const;
928 
929  const Rotation& getDefaultBaseRotation() const;
930  const Rotation& getDefaultFollowerRotation() const;
931 
932  // Stage::Instance
933  const Rotation& getBaseRotation(const State&) const;
934  const Rotation& getFollowerRotation(const State&) const;
935 
936  // Stage::Position, Velocity
937  Vec3 getPositionErrors(const State&) const;
938  Vec3 getVelocityErrors(const State&) const;
939 
940  // Stage::Acceleration
941  Vec3 getAccelerationErrors(const State&) const;
942  Vec3 getMultipliers(const State&) const;
943  Vec3 getTorqueOnFollowerBody(const State&) const;
944  // hide from Doxygen
947  (ConstantOrientation, ConstantOrientationImpl, Constraint);
949 };
950 
952  // WELD (COINCIDENT FRAMES) CONSTRAINT //
954 
979 public:
980  // no default constructor
981 
984  Weld(MobilizedBody& body1, MobilizedBody& body2);
985 
990  Weld(MobilizedBody& body1, const Transform& frame1,
991  MobilizedBody& body2, const Transform& frame2);
992 
994  Weld() {}
995 
996  // Control over generated decorative geometry.
997 
1001  Weld& setAxisDisplayLength(Real r);
1002 
1006  Real getAxisDisplayLength() const;
1007 
1008  // Defaults for Instance variables.
1009 
1013  Weld& setDefaultFrameOnBody1(const Transform&);
1014 
1016  const Transform& getDefaultFrameOnBody1() const;
1017 
1021  Weld& setDefaultFrameOnBody2(const Transform&);
1022 
1024  const Transform& getDefaultFrameOnBody2() const;
1025 
1026 
1027  // Stage::Topology
1028 
1030  MobilizedBodyIndex getBody1MobilizedBodyIndex() const;
1031 
1033  MobilizedBodyIndex getBody2MobilizedBodyIndex() const;
1034 
1035 
1036  // Stage::Instance
1037  const Transform& getFrameOnBody1(const State&) const;
1038  const Transform& getFrameOnBody2(const State&) const;
1039 
1040  // Stage::Position, Velocity, Acceleration
1041  Vec6 getPositionErrors(const State&) const;
1042  Vec6 getVelocityErrors(const State&) const;
1043 
1044  // Stage::Acceleration
1045  Vec6 getAccelerationErrors(const State&) const;
1046  Vec6 getMultipliers(const State&) const;
1047 
1048  // Forces are reported expressed in the body frame of the indicated body.
1049  const SpatialVec& getWeldReactionOnBody1(const State&) const;
1050  const SpatialVec& getWeldReactionOnBody2(const State&) const;
1051  // hide from Doxygen
1055 };
1056 
1058  // NO SLIP 1D CONSTRAINT //
1060 
1073 public:
1074  // no default constructor
1075 
1082  NoSlip1D(MobilizedBody& caseBodyC, const Vec3& P_C, const UnitVec3& n_C,
1083  MobilizedBody& movingBody0, MobilizedBody& movingBody1);
1084 
1087 
1092  void setContactPoint(State& state, const Vec3& point_C) const;
1097  void setDirection(State& state, const UnitVec3& direction_C) const;
1098 
1101  const Vec3& getContactPoint(const State& state) const;
1104  const UnitVec3& getDirection(const State& state) const;
1105 
1106  // These affect only generated decorative geometry for visualization;
1107  // the plane is really infinite in extent with zero depth and the
1108  // point is really of zero radius.
1109 
1112  NoSlip1D& setDirectionDisplayLength(Real);
1115  NoSlip1D& setPointDisplayRadius(Real);
1118  Real getDirectionDisplayLength() const;
1121  Real getPointDisplayRadius() const;
1122 
1123  // Defaults for Instance variables.
1124 
1127  NoSlip1D& setDefaultContactPoint(const Vec3&);
1130  NoSlip1D& setDefaultDirection(const UnitVec3&);
1131 
1132 
1133  // Stage::Topology
1134 
1137  MobilizedBodyIndex getCaseMobilizedBodyIndex() const;
1140  MobilizedBodyIndex getMovingBodyMobilizedBodyIndex(int which) const;
1141 
1144  const UnitVec3& getDefaultDirection() const;
1147  const Vec3& getDefaultContactPoint() const;
1148 
1149 
1150  // Stage::Position, Velocity
1151  // no position error
1152 
1156  Real getVelocityError(const State& state) const;
1157 
1158  // Stage::Acceleration
1159 
1164  Real getAccelerationError(const State&) const;
1165 
1172  Real getMultiplier(const State&) const;
1173 
1177  Real getForceAtContactPoint(const State&) const;
1178  // hide from Doxygen
1182 };
1183 
1185  // BALL ROLLING ON PLANE CONSTRAINT //
1187 
1223 public:
1224  // no default constructor
1227  BallRollingOnPlane(MobilizedBody& planeBody_P,
1228  const UnitVec3& defaultPlaneNormal_P,
1229  Real defaultPlaneHeight,
1230  MobilizedBody& ballBody_B,
1231  const Vec3& defaultBallCenter_B,
1232  Real defaultBallRadius);
1233 
1236 
1237  // These affect only generated decorative geometry for visualization;
1238  // the plane is really infinite in extent with zero depth.
1239  BallRollingOnPlane& setPlaneDisplayHalfWidth(Real);
1240  Real getPlaneDisplayHalfWidth() const;
1241 
1242  // Defaults for Instance variables.
1243  BallRollingOnPlane& setDefaultPlaneNormal(const UnitVec3&);
1244  BallRollingOnPlane& setDefaultPlaneHeight(Real);
1245  BallRollingOnPlane& setDefaultBallCenter(const Vec3&);
1246  BallRollingOnPlane& setDefaultBallRadius(Real);
1247 
1248  // Stage::Topology
1249  MobilizedBodyIndex getPlaneMobilizedBodyIndex() const;
1250  MobilizedBodyIndex getBallMobilizedBodyIndex() const;
1251 
1252  const UnitVec3& getDefaultPlaneNormal() const;
1253  Real getDefaultPlaneHeight() const;
1254  const Vec3& getDefaultBallCenter() const;
1255  Real getDefaultBallRadius() const;
1256 
1257  // Stage::Instance
1258  const UnitVec3& getPlaneNormal(const State&) const;
1259  Real getPlaneHeight(const State&) const;
1260  const Vec3& getBallCenter(const State&) const;
1261  Real getBallRadius(const State&) const;
1262 
1263  // Stage::Position, Velocity
1264  Real getPositionError(const State&) const;
1265  Vec3 getVelocityError(const State&) const;
1266 
1267  // Stage::Acceleration
1268  Vec3 getAccelerationError(const State&) const;
1269  Vec3 getMultipliers(const State&) const;
1270 
1274  Real getNormalForce(const State&) const;
1277  Vec2 getFrictionForceOnBallInPlaneFrame(const State&) const;
1278  // Don't let doxygen see this
1282 };
1283 
1284 
1286  // CONSTANT SPEED //
1288 
1297 public:
1298  // no default constructor
1301  ConstantSpeed(MobilizedBody& mobilizer, MobilizerUIndex whichU,
1302  Real defaultSpeed);
1305  ConstantSpeed(MobilizedBody& mobilizer, Real defaultSpeed);
1306 
1309 
1313  MobilizedBodyIndex getMobilizedBodyIndex() const;
1316  MobilizerUIndex getWhichU() const;
1321  Real getDefaultSpeed() const;
1327  ConstantSpeed& setDefaultSpeed(Real speed);
1328 
1333  void setSpeed(State& state, Real speed) const;
1337  Real getSpeed(const State& state) const;
1338 
1339  // no position error
1340 
1344  Real getVelocityError(const State& state) const;
1345 
1346  // Stage::Acceleration
1350  Real getAccelerationError(const State& state) const;
1356  Real getMultiplier(const State&) const;
1357  // hide from Doxygen
1360  (ConstantSpeed, ConstantSpeedImpl, Constraint);
1362 };
1363 
1365  // CONSTANT ACCELERATION //
1367 
1376 {
1377 public:
1378  // no default constructor
1382  Real defaultAcceleration);
1385  ConstantAcceleration(MobilizedBody& mobilizer,
1386  Real defaultAcceleration);
1387 
1390 
1394  MobilizedBodyIndex getMobilizedBodyIndex() const;
1398  MobilizerUIndex getWhichU() const;
1403  Real getDefaultAcceleration() const;
1409  ConstantAcceleration& setDefaultAcceleration(Real accel);
1410 
1415  void setAcceleration(State& state, Real accel) const;
1419  Real getAcceleration(const State& state) const;
1420 
1421  // no position or velocity error
1422 
1423  // Stage::Acceleration
1427  Real getAccelerationError(const State&) const;
1433  Real getMultiplier(const State&) const;
1434  // hide from Doxygen
1437  (ConstantAcceleration, ConstantAccelerationImpl, Constraint);
1439 };
1440 
1441 //==============================================================================
1442 // CUSTOM
1443 //==============================================================================
1477 public:
1478  class Implementation;
1479  class ImplementationImpl;
1480 
1488  explicit Custom(Implementation* implementation);
1489 
1490 
1492  Custom() {}
1493 
1495 protected:
1496  const Implementation& getImplementation() const;
1497  Implementation& updImplementation();
1498 };
1499 
1500 //==============================================================================
1501 // CUSTOM::IMPLEMENTATION
1502 //==============================================================================
1503 
1504 // We only want the template instantiation to occur once. This symbol is
1505 // defined in the SimTK core compilation unit that defines the Constraint
1506 // class but should not be defined any other time.
1507 #ifndef SimTK_SIMBODY_DEFINING_CONSTRAINT
1508  extern template class PIMPLHandle<Constraint::Custom::Implementation,
1509  Constraint::Custom::ImplementationImpl>;
1510 #endif
1511 
1515 : public PIMPLHandle<Implementation,ImplementationImpl> {
1516 public:
1517 // No default constructor because you have to supply at least the
1518 // SimbodyMatterSubsystem to which this Constraint belongs.
1519 
1522 virtual ~Implementation() { }
1523 
1528 virtual Implementation* clone() const = 0;
1529 
1533 Implementation(SimbodyMatterSubsystem&, int mp, int mv, int ma);
1534 
1540 
1542 const SimbodyMatterSubsystem& getMatterSubsystem() const;
1543 
1544  // Topological information//
1545 
1552 void invalidateTopologyCache() const;
1553 
1558 Implementation& setDefaultNumConstraintEquations(int mp, int mv, int ma);
1559 
1564 Implementation& setDisabledByDefault(bool shouldBeDisabled);
1565 
1571 ConstrainedBodyIndex addConstrainedBody(const MobilizedBody&);
1572 
1579 ConstrainedMobilizerIndex addConstrainedMobilizer(const MobilizedBody&);
1580 
1586 getMobilizedBodyIndexOfConstrainedBody(ConstrainedBodyIndex) const;
1587 
1593 getMobilizedBodyIndexOfConstrainedMobilizer(ConstrainedMobilizerIndex) const;
1594 
1595 
1625 Real getOneQ(const State& state,
1626  const Array_<Real,ConstrainedQIndex>& constrainedQ,
1627  ConstrainedMobilizerIndex mobilizer,
1628  MobilizerQIndex whichQ) const;
1629 
1634 Real getOneQFromState(const State& state,
1635  ConstrainedMobilizerIndex mobilizer,
1636  MobilizerQIndex whichQ) const;
1637 
1658 Real getOneQDot(const State& state,
1659  const Array_<Real,ConstrainedQIndex>& constrainedQDot,
1660  ConstrainedMobilizerIndex mobilizer,
1661  MobilizerQIndex whichQ) const;
1662 
1668 Real getOneQDotFromState(const State& state,
1669  ConstrainedMobilizerIndex mobilizer,
1670  MobilizerQIndex whichQ) const;
1671 
1672 
1696 Real getOneQDotDot(const State& state,
1697  const Array_<Real,ConstrainedQIndex>& constrainedQDotDot,
1698  ConstrainedMobilizerIndex mobilizer,
1699  MobilizerQIndex whichQ) const;
1700 
1718 Real getOneU(const State& state,
1719  const Array_<Real,ConstrainedUIndex>& constrainedU,
1720  ConstrainedMobilizerIndex mobilizer,
1721  MobilizerUIndex whichU) const;
1722 
1730 Real getOneUFromState(const State& state,
1731  ConstrainedMobilizerIndex mobilizer,
1732  MobilizerUIndex whichU) const;
1733 
1756 Real getOneUDot(const State& state,
1757  const Array_<Real,ConstrainedUIndex>& constrainedUDot,
1758  ConstrainedMobilizerIndex mobilizer,
1759  MobilizerUIndex whichU) const;
1760 
1769 void addInOneMobilityForce
1770  (const State& state,
1771  ConstrainedMobilizerIndex mobilizer,
1772  MobilizerUIndex whichU,
1773  Real fu,
1774  Array_<Real,ConstrainedUIndex>& mobilityForces) const;
1775 
1791 void addInOneQForce
1792  (const State& state,
1793  ConstrainedMobilizerIndex mobilizer,
1794  MobilizerQIndex whichQ,
1795  Real fq,
1796  Array_<Real,ConstrainedQIndex>& qForces) const;
1815 const Transform& getBodyTransform
1816  (const Array_<Transform,ConstrainedBodyIndex>& allX_AB,
1817  ConstrainedBodyIndex bodyB) const;
1820 const Rotation& getBodyRotation
1822  ConstrainedBodyIndex bodyB) const
1823 { return getBodyTransform(allX_AB,bodyB).R(); }
1827 const Vec3& getBodyOriginLocation
1829  ConstrainedBodyIndex bodyB) const
1830 { return getBodyTransform(allX_AB,bodyB).p(); }
1831 
1837 const Transform& getBodyTransformFromState
1838  (const State& state, ConstrainedBodyIndex B) const; // X_AB
1841 const Rotation& getBodyRotationFromState
1842  (const State& state, ConstrainedBodyIndex bodyB) const
1843 { return getBodyTransformFromState(state,bodyB).R(); }
1847 const Vec3& getBodyOriginLocationFromState
1848  (const State& state, ConstrainedBodyIndex bodyB) const
1849 { return getBodyTransformFromState(state,bodyB).p(); }
1850 
1854 const SpatialVec& getBodyVelocity
1855  (const Array_<SpatialVec,ConstrainedBodyIndex>& allV_AB,
1856  ConstrainedBodyIndex bodyB) const;
1859 const Vec3& getBodyAngularVelocity
1861  ConstrainedBodyIndex bodyB) const
1862 { return getBodyVelocity(allV_AB,bodyB)[0]; }
1865 const Vec3& getBodyOriginVelocity
1867  ConstrainedBodyIndex bodyB) const
1868 { return getBodyVelocity(allV_AB,bodyB)[1]; }
1869 
1875 const SpatialVec& getBodyVelocityFromState
1876  (const State& state, ConstrainedBodyIndex bodyB) const; // V_AB
1879 const Vec3& getBodyAngularVelocityFromState
1880  (const State& state, ConstrainedBodyIndex bodyB) const
1881 { return getBodyVelocityFromState(state,bodyB)[0]; }
1884 const Vec3& getBodyOriginVelocityFromState
1885  (const State& state, ConstrainedBodyIndex bodyB) const
1886 { return getBodyVelocityFromState(state,bodyB)[1]; }
1887 
1893 const SpatialVec& getBodyAcceleration
1894  (const Array_<SpatialVec,ConstrainedBodyIndex>& allA_AB,
1895  ConstrainedBodyIndex bodyB) const;
1898 const Vec3& getBodyAngularAcceleration
1900  ConstrainedBodyIndex bodyB) const
1901 { return getBodyAcceleration(allA_AB,bodyB)[0]; }
1904 const Vec3& getBodyOriginAcceleration
1906  ConstrainedBodyIndex bodyB) const
1907 { return getBodyAcceleration(allA_AB,bodyB)[1]; }
1908 
1909  // Calculate location, velocity, and acceleration for a given station.
1910 
1917 Vec3 findStationLocation
1919  ConstrainedBodyIndex bodyB,
1920  const Vec3& p_BS) const
1921 {
1922  const Transform& X_AB = allX_AB[bodyB];
1923  return X_AB * p_BS; // re-measure and re-express
1924 }
1928 Vec3 findStationLocationFromState
1929  (const State& state,
1930  ConstrainedBodyIndex bodyB,
1931  const Vec3& p_BS) const
1932 {
1933  const Transform& X_AB = getBodyTransformFromState(state,bodyB);
1934  return X_AB * p_BS; // re-measure and re-express
1935 }
1936 
1943 Vec3 findStationVelocity
1944  (const State& state,
1946  ConstrainedBodyIndex bodyB,
1947  const Vec3& p_BS) const
1948 { // p_BS_A is p_BS rexpressed in A but not shifted to Ao
1949  const Rotation& R_AB = getBodyRotationFromState(state,bodyB);
1950  const Vec3 p_BS_A = R_AB * p_BS;
1951  const SpatialVec& V_AB = allV_AB[bodyB];
1952  return V_AB[1] + (V_AB[0] % p_BS_A); // v + w X r
1953 }
1957 Vec3 findStationVelocityFromState
1958  (const State& state,
1959  ConstrainedBodyIndex bodyB,
1960  const Vec3& p_BS) const
1961 { // p_BS_A is p_BS rexpressed in A but not shifted to Ao
1962  const Rotation& R_AB = getBodyRotationFromState(state,bodyB);
1963  const Vec3 p_BS_A = R_AB * p_BS;
1964  const SpatialVec& V_AB = getBodyVelocityFromState(state,bodyB);
1965  return V_AB[1] + (V_AB[0] % p_BS_A); // v + w X r
1966 }
1967 
1977 Vec3 findStationAcceleration
1978  (const State& state,
1980  ConstrainedBodyIndex bodyB,
1981  const Vec3& p_BS) const
1982 { // p_BS_A is p_BS rexpressed in A but not shifted to Ao
1983  const Rotation& R_AB = getBodyRotationFromState(state,bodyB);
1984  const Vec3 p_BS_A = R_AB * p_BS;
1985  const Vec3& w_AB = getBodyAngularVelocityFromState(state,bodyB);
1986  const SpatialVec& A_AB = allA_AB[bodyB];
1987 
1988  // Result is a + b X r + w X (w X r).
1989  // ("b" is angular acceleration; w is angular velocity).
1990  const Vec3 a_AS = A_AB[1] + (A_AB[0] % p_BS_A)
1991  + w_AB % (w_AB % p_BS_A); // % is not associative
1992  return a_AS;
1993 }
1994 
1995  // Utilities for applying constraint forces to ConstrainedBodies.
1996 
2001 void addInStationForce
2002  (const State& state,
2003  ConstrainedBodyIndex bodyB,
2004  const Vec3& p_BS,
2005  const Vec3& forceInA,
2006  Array_<SpatialVec,ConstrainedBodyIndex>& bodyForcesInA) const;
2007 
2010 void addInBodyTorque
2011  (const State& state,
2012  ConstrainedBodyIndex bodyB,
2013  const Vec3& torqueInA,
2014  Array_<SpatialVec,ConstrainedBodyIndex>& bodyForcesInA) const;
2023 void getMultipliers(const State& state,
2024  Array_<Real>& multipliers) const;
2027 protected:
2048 virtual void realizeTopology(State&) const { }
2049 
2060 virtual void realizeModel(State&) const { }
2061 
2067 virtual void realizeInstance(const State&) const { }
2068 
2074 virtual void realizeTime(const State&) const { }
2075 
2082 virtual void realizePosition(const State&) const { }
2083 
2090 virtual void realizeVelocity(const State&) const { }
2091 
2097 virtual void realizeDynamics(const State&) const { }
2098 
2107 virtual void realizeAcceleration(const State&) const { }
2108 
2114 virtual void realizeReport(const State&) const { }
2128 virtual void calcPositionErrors
2129  (const State& state, // Stage::Time
2131  const Array_<Real, ConstrainedQIndex>& constrainedQ,
2132  Array_<Real>& perr) // mp of these
2133  const;
2134 
2146 virtual void calcPositionDotErrors
2147  (const State& state, // Stage::Position
2149  const Array_<Real, ConstrainedQIndex>& constrainedQDot,
2150  Array_<Real>& pverr) // mp of these
2151  const;
2152 
2165 virtual void calcPositionDotDotErrors
2166  (const State& state, // Stage::Velocity
2168  const Array_<Real, ConstrainedQIndex>& constrainedQDotDot,
2169  Array_<Real>& paerr) // mp of these
2170  const;
2171 
2190 virtual void addInPositionConstraintForces
2191  (const State& state,
2192  const Array_<Real>& multipliers,
2194  Array_<Real, ConstrainedQIndex>& qForces) const;
2212 virtual void calcVelocityErrors
2213  (const State& state, // Stage::Position
2215  const Array_<Real, ConstrainedUIndex>& constrainedU,
2216  Array_<Real>& verr) // mv of these
2217  const;
2218 
2229 virtual void calcVelocityDotErrors
2230  (const State& state, // Stage::Velocity
2232  const Array_<Real, ConstrainedUIndex>& constrainedUDot,
2233  Array_<Real>& vaerr) // mv of these
2234  const;
2235 
2254 virtual void addInVelocityConstraintForces
2255  (const State& state,
2256  const Array_<Real>& multipliers,
2258  Array_<Real, ConstrainedUIndex>& mobilityForces) const;
2279 virtual void calcAccelerationErrors
2280  (const State& state, // Stage::Velocity
2282  const Array_<Real, ConstrainedUIndex>& constrainedUDot,
2283  Array_<Real>& aerr) // ma of these
2284  const;
2285 
2303 virtual void addInAccelerationConstraintForces
2304  (const State& state,
2305  const Array_<Real>& multipliers,
2307  Array_<Real, ConstrainedUIndex>& mobilityForces) const;
2317 virtual void calcDecorativeGeometryAndAppend
2318  (const State& s, Stage stage, Array_<DecorativeGeometry>& geom) const
2319 {
2320 }
2321 
2322 friend class Constraint::CustomImpl;
2323 };
2324 
2325 
2326 
2327 //==============================================================================
2328 // COORDINATE COUPLER
2329 //==============================================================================
2339 : public Constraint::Custom {
2340 public:
2362  const Function* function,
2363  const Array_<MobilizedBodyIndex>& coordMobod,
2364  const Array_<MobilizerQIndex>& coordQIndex);
2365 
2368  const std::vector<MobilizedBodyIndex>& coordBody,
2369  const std::vector<MobilizerQIndex>& coordIndex)
2370  { // Invoke the above constructor with converted arguments.
2371  new (this) CoordinateCoupler(matter,function,
2373  ArrayViewConst_<MobilizerQIndex>(coordIndex));
2374  }
2375 
2378 };
2379 
2380 
2381 
2382 //==============================================================================
2383 // SPEED COUPLER
2384 //==============================================================================
2396 public:
2416  const Function* function,
2417  const Array_<MobilizedBodyIndex>& speedBody,
2418  const Array_<MobilizerUIndex>& speedIndex);
2419 
2422  const Function* function,
2423  const std::vector<MobilizedBodyIndex>& speedBody,
2424  const std::vector<MobilizerUIndex>& speedIndex)
2425  { // Invoke above constructor with converted arguments.
2426  new (this) SpeedCoupler(matter, function,
2428  ArrayViewConst_<MobilizerUIndex>(speedIndex));
2429  }
2430 
2460  const Function* function,
2461  const Array_<MobilizedBodyIndex>& speedBody,
2462  const Array_<MobilizerUIndex>& speedIndex,
2463  const Array_<MobilizedBodyIndex>& coordBody,
2464  const Array_<MobilizerQIndex>& coordIndex);
2465 
2468  const Function* function,
2469  const std::vector<MobilizedBodyIndex>& speedBody,
2470  const std::vector<MobilizerUIndex>& speedIndex,
2471  const std::vector<MobilizedBodyIndex>& coordBody,
2472  const std::vector<MobilizerQIndex>& coordIndex)
2473  { // Invoke above constructor with converted arguments.
2474  new (this) SpeedCoupler(matter, function,
2478  ArrayViewConst_<MobilizerQIndex>(coordIndex));
2479  }
2480 
2483 };
2484 
2485 
2486 
2487 //==============================================================================
2488 // PRESCRIBED MOTION
2489 //==============================================================================
2496 : public Constraint::Custom {
2497 public:
2514  const Function* function,
2515  MobilizedBodyIndex coordBody,
2516  MobilizerQIndex coordIndex);
2517 
2518 
2521 };
2522 
2523 
2524 
2525 } // namespace SimTK
2526 
2527 #endif // SimTK_SIMBODY_CONSTRAINT_H_
2528 
2529 
2530 
virtual void realizeDynamics(const State &) const
The Matter Subsystem's realizeDynamics() method will call this method after any MobilizedBody Dynamic...
Definition: Constraint.h:2097
This is for arrays indexed by mobilized body number within a subsystem (typically the SimbodyMatterSu...
Three constraint equations.
Definition: Constraint.h:909
Unique integer type for Subsystem-local u indexing.
ConstantOrientation()
Default constructor creates an empty handle.
Definition: Constraint.h:917
This is a Constraint that uses a Function to prescribe the behavior of a single generalized coordinat...
Definition: Constraint.h:2495
ConstantAcceleration()
Default constructor creates an empty handle.
Definition: Constraint.h:1389
This class is basically a glorified enumerated type, type-safe and range checked but permitting conve...
Definition: Stage.h:50
A SimbodyMatterSubtree is a view of a connected subgraph of the tree of mobilized bodies in a Simbody...
Definition: SimbodyMatterSubtree.h:109
NoSlip1D()
Default constructor creates an empty handle.
Definition: Constraint.h:1086
SpeedCoupler()
Default constructor creates an empty handle.
Definition: Constraint.h:2482
PrescribedMotion()
Default constructor creates an empty handle.
Definition: Constraint.h:2520
Constrain a single mobility to have a particular speed.
Definition: Constraint.h:1296
Every Simbody header and source file should include this header before any other Simbody header...
Ball()
Default constructor creates an empty handle.
Definition: Constraint.h:785
PointInPlane()
Default constructor creates an empty handle.
Definition: Constraint.h:562
This is the handle class for the hidden State implementation.
Definition: State.h:264
This is for arrays indexed by constraint number within a subsystem (typically the SimbodyMatterSubsys...
ConstantAngle()
Default constructor creates an empty handle.
Definition: Constraint.h:709
virtual void realizeModel(State &) const
The Matter Subsystem's realizeModel() method will call this method after all MobilizedBody Model-stag...
Definition: Constraint.h:2060
The SimTK::Array_<T> container class is a plug-compatible replacement for the C++ standard template l...
Definition: Array.h:50
Six constraint equations.
Definition: Constraint.h:978
#define SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(DERIVED, DERIVED_IMPL, PARENT)
Definition: PrivateImplementation.h:343
BallRollingOnPlane()
Default constructor creates an empty handle.
Definition: Constraint.h:1235
virtual ~Implementation()
Destructor is virtual so derived classes get a chance to clean up if necessary.
Definition: Constraint.h:1522
Constraint()
Default constructor creates an empty Constraint handle that can be used to reference any Constraint...
Definition: Constraint.h:71
This is a Constraint that uses a Function object to define a nonholonomic (velocity) constraint...
Definition: Constraint.h:2395
One constraint equation.
Definition: Constraint.h:555
virtual void realizeTime(const State &) const
The Matter Subsystem's realizeTime() method will call this method after any MobilizedBody Time-stage ...
Definition: Constraint.h:2074
Unique integer type for Subsystem-local q indexing.
This is a Constraint that uses a Function object to define a single holonomic (position) constraint e...
Definition: Constraint.h:2338
Two constraint equations.
Definition: Constraint.h:619
virtual void realizeVelocity(const State &) const
The Matter Subsystem's realizeVelocity() method will call this method after any MobilizedBody Velocit...
Definition: Constraint.h:2090
CoordinateCoupler(SimbodyMatterSubsystem &matter, const Function *function, const std::vector< MobilizedBodyIndex > &coordBody, const std::vector< MobilizerQIndex > &coordIndex)
For compatibility with std::vector; no copying is done.
Definition: Constraint.h:2367
Rod()
Default constructor creates an empty handle.
Definition: Constraint.h:508
This is the Matrix class intended to appear in user code.
Definition: BigMatrix.h:181
const Real Pi
Real(pi)
Ball Spherical
Definition: Constraint.h:447
This constraint consists of one constraint equation that enforces a constant distance between a point...
Definition: Constraint.h:498
Enforce that a fixed station on one body remains coincident with a fixed station on a second body...
Definition: Constraint.h:772
PointOnLine()
Default constructor creates an empty handle.
Definition: Constraint.h:626
This Array_ helper class is the base class for ArrayView_ which is the base class for Array_; here we...
Definition: Array.h:48
Weld CoincidentFrames
Definition: Constraint.h:448
virtual void realizeInstance(const State &) const
The Matter Subsystem's realizeInstance() method will call this method after all MobilizedBody Instanc...
Definition: Constraint.h:2067
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:72
The Mobilizer associated with each MobilizedBody, once modeled, has a specific number of generalized ...
Vector_< SpatialVec > getConstrainedBodyForcesAsVector(const State &state) const
For convenience, returns constrained body forces as the function return.
Definition: Constraint.h:397
A MobilizedBody is Simbody's fundamental body-and-joint object used to parameterize a system's motion...
Definition: MobilizedBody.h:167
virtual void realizeTopology(State &) const
The Matter Subsystem's realizeTopology() method will call this method after all MobilizedBody topolog...
Definition: Constraint.h:2048
This is the base class for all Constraint classes, which is just a handle for the underlying hidden i...
Definition: Constraint.h:66
The handle class Constraint::Custom (dataless) and its companion class Constraint::Custom::Implementa...
Definition: Constraint.h:1476
Constraint(ConstraintImpl *r)
For internal use: construct a new Constraint handle referencing a particular implementation object...
Definition: Constraint.h:74
Weld()
Default constructor creates an empty handle.
Definition: Constraint.h:994
ConstantSpeed()
Default constructor creates an empty handle.
Definition: Constraint.h:1308
Custom()
Default constructor creates an empty handle.
Definition: Constraint.h:1492
This is the abstract base class for the implementation of custom constraints. See Constraint::Custom ...
Definition: Constraint.h:1514
This subsystem contains the bodies ("matter") in the multibody system, the mobilizers (joints) that d...
Definition: SimbodyMatterSubsystem.h:130
Rod ConstantDistance
Definition: Constraint.h:446
This constraint consists of a single constraint equation that enforces that a unit vector v1 fixed to...
Definition: Constraint.h:701
virtual void realizeAcceleration(const State &) const
The Matter Subsystem's realizeAcceleration() method will call this method after any MobilizedBody Acc...
Definition: Constraint.h:2107
Unique integer type for Subsystem-local multiplier indexing.
virtual void realizeReport(const State &) const
The Matter Subsystem's realizeReport() method will call this method after any MobilizedBody Report-st...
Definition: Constraint.h:2114
This constraint enforces continuous contact and non-slip rolling between a spherical surface fixed on...
Definition: Constraint.h:1222
Constrain a single mobility to have a particular acceleration.
Definition: Constraint.h:1375
One non-holonomic constraint equation.
Definition: Constraint.h:1072
virtual void realizePosition(const State &) const
The Matter Subsystem's realizePosition() method will call this method after any MobilizedBody Positio...
Definition: Constraint.h:2082
Vector getConstrainedMobilityForcesAsVector(const State &state) const
For convenience, returns constrained mobility forces as the function return.
Definition: Constraint.h:406
The Mobilizer associated with each MobilizedBody, once modeled, has a specific number of generalized ...
SpeedCoupler(SimbodyMatterSubsystem &matter, const Function *function, const std::vector< MobilizedBodyIndex > &speedBody, const std::vector< MobilizerUIndex > &speedIndex, const std::vector< MobilizedBodyIndex > &coordBody, const std::vector< MobilizerQIndex > &coordIndex)
For compatibility with std::vector; no copying is done.
Definition: Constraint.h:2467
SpeedCoupler(SimbodyMatterSubsystem &matter, const Function *function, const std::vector< MobilizedBodyIndex > &speedBody, const std::vector< MobilizerUIndex > &speedIndex)
For compatibility with std::vector; no copying is done.
Definition: Constraint.h:2421
CoordinateCoupler()
Default constructor creates an empty handle.
Definition: Constraint.h:2377