```{raw} latex \clearpage ``` # General info for all constraints ## What a constraint is A constraint prescribes a relation between the coordinates of the bodies or nodes its markers sit on - two points coincide, a distance is fixed, a coordinate follows another - as **algebraic equations** $\gv(\qv, t) = \Null$. Each equation gets a **Lagrange multiplier** $\lambda$, an algebraic unknown of the system, and acts on the equations of motion with the transposed Jacobian of the constraint, $\left(\partial \gv / \partial \qv\right)\tp \tlambda$: the multipliers are the reaction forces and torques of the constraint, in the directions the page of each constraint says. This page holds for the joints as well. ## Index 3 and index 2 A constraint is written on the **position level** (index 3), $\gv(\qv,t) = \Null$, or on the **velocity level** (index 2), $\dot\gv = \Null$; which one the solver uses is `timeIntegration.generalizedAlpha.useIndex2Constraints` and the like. On the velocity level the position may drift over long simulations, which the output variables of some joints show. Constraints need an **implicit** time integration (generalized-alpha, trapezoidal) or the static solver; the explicit integrators do not solve algebraic equations - they can only eliminate `ObjectConnectorCoordinate` constraints to the ground, such as fixed nodes (`timeIntegration.explicit.eliminateConstraints`). ## `activeConnector` With `activeConnector = False` a constraint replaces its equations by $\tlambda = \Null$: it remains in the system with its multipliers, which are zero, and can be switched on again. ## Redundant constraints Constraints that fix the same motion twice - two revolute joints on one axis, a closed loop of planar joints in 3D - make the Jacobian of the constraints singular, and the solver fails. `mbs.ComputeSystemDegreeOfFreedom()` counts the redundant constraints; the `EigenDense` linear solver with `linearSolver.ignoreSingularJacobian` can handle some of them. (sec-drawing-objectsconstraint)= ## Drawing A constraint is drawn as a connector: if `connectors.show` and its own `show` are True, in its `color` or `connectors.defaultColor`, a `drawSize` of -1 takes `connectors.defaultSize`, and `connectors.showNumbers` writes its number. The settings: [`connectors.show`](#sec-vsettingsconnectors), [`connectors.showNumbers`](#sec-vsettingsconnectors), [`connectors.defaultColor`](#sec-vsettingsconnectors), [`connectors.defaultSize`](#sec-vsettingsconnectors).