You are here:

# Working with Constraints

Constraints operate on one or more parts to restrict their relative range of motion.

Depending on the type of constraint, there may only be one coordinate that can be controlled (for example, the Hinge joint); or there are multiple controllable coordinates (for example, the Angular 1 Position 3 constraint).

Between each pair of parts, there are three degrees of freedom for position and three for orientation. A constraint removes some of the degrees of freedom between the attached parts. A hinge constraint, for example, which is a two-part constraint, removes five out of the six degrees of freedom between the two attached parts. Depending on the constraint, the remaining degrees of freedom (also called "constraint coordinates") can be controlled either by setting limits, locking, or motorizing.

## Controlling a Constraint Coordinate

Some constraints offer controllable coordinates, which represent relative linear or angular movements between the attached parts. This movement can be controlled in one of three ways:

• Free: The rigid bodies can move freely along the coordinate.
• Motorized: Allows you to specify a desired velocity for the coordinate, indicating a motion along or about the coordinate. The constraint will try to achieve this velocity by applying a force to the constrained bodies. The maximum force the motor can apply, as well as the motor loss (inverse of the damping coefficient), can be specified.
A motorized coordinate acts like a proportional controller on the velocity level, applying a viscous force, , which is proportional to the velocity error Verror and the specified damping coefficient c, representing the proportional gain. The proportional gain is equivalent to the inverse of the user-provided motor loss.
• Lock: This mode locks the coordinate to a specified position or angle and restricts the parts' relative movement accordingly. A locked coordinate exhibits viscoelastic characteristics when undergoing deformations. The amount of viscoelasticity can be specified via stiffness and damping coefficients, k and c, yielding the following constraint force:

Here, the position and velocity error in the coordinate are denoted by xerror and verror respectively.
A lock can also be set to behave plastically, allowing irreversible plastic deformations in the coordinate position when the maximum force of the lock is overcome. In this mode, the target lock coordinate position will be displaced as soon as the yield point in the lock force is reached. Until this point, the lock acts elastically and the deformations are reversible. This allows modeling elastoplastic constraint characteristics.
It is also possible to make the locked coordinate move at a given speed, specified by the lock velocity. This way the lock control can be used to actuate the attached parts similar to a motor. Combining the lock velocity with the plastic lock mode, a position-based motor can be modelled, which, as opposed to the ordinary velocity-based motor control, never experiences any slip.

## Part Attachments

The way in which a given constraint restricts the motion between the attached parts depends not only on the type of constraint, but also on user-provided constraint axes and positions. The latter represent reference frames which are attached to the constrained parts. These reference frames are called part attachments, each of which is defined by a set of three orthonormal axes and a position, specified relative to the attached part. The primary and secondary axes of each attachment can be set in the constraint's Attachments tab. The third axis (or tertiary axis) is automatically computed as the cross product between primary and secondary axes, in this order.

The geometric meaning of the attachment axes and positions differs from constraint to constraint. For example in a constraint which has an angular controllable coordinate, such as a hinge, the primary axis would define the axis of rotation for this coordinate. For a linear coordinate, as in a prismatic joint, the axis defines the direction of motion.

In many constraints, the positions of the part attachments are used to maintain a common point in space between the attached parts. Take as an example the ball and socket joint. The positions of the ball and the socket, relative to the attached parts, would be represented by the positions given in the two part attachments. The specific meaning of the part attachments in the context of an individual constraint, and how they define the behavior of the constraint is explained in the respective constraint's detailed description.

In general, the part attachments are used to calculate the constraint violations and constraint coordinate positions. The violations and coordinate positions, in turn, define the reaction forces and torques applied by the constraint to the attached parts. As an example, a hinge constraint which has its controllable coordinate locked at angle zero is not violated if the world space positions of both its art attachments overlap and the three axes in both attachments are aligned in world space.

## Limiting Constraint Coordinates

Coordinate range limits can be defined for all controllable constraint coordinates. By default, limits are not enabled and the coordinate range is unrestricted. Enabling limits allows the range of controllable coordinates to be restricted to a provided minimum and maximum, which can also be set to +/- infinity. Coordinate limits are modelled as unilateral spring-dampers, which can only apply reaction forces towards the admissible range of the coordinate, meaning they cannot act sticky. This is comparable to the way contacts are modelled. As such, when a coordinate hits a limit, a viscoelastic reaction force is applied which can be configured through stiffness and damping coefficients. The applied force can be capped via minimum and maximum limit force parameters.

A limit can also be moved kinematically, via the limit velocity parameter, thus changing the admissible range of the coordinate over time. This is comparable to the lock velocity in a controllable and locked coordinate which makes the equilibrium position of the coordinate move over time according to the provided velocity.

## Relaxing a Constraint

Intuitively speaking, relaxing a constraint introduces compliance in the corresponding relaxed coordinates, which manifests itself as slack in the joint bearings when the constrained parts are subject to external forces.

Controllable coordinates cannot be relaxed but most constraints allow their non-controllable coordinates to be relaxed. A hinge constraint for example, which has one controllable angular coordinate, has five remaining non-controllable coordinates (three linear and two angular) which can all be relaxed.

Relaxing a positional constraint (i.e., a constraint which has a target position) puts the constraint into a mode in which it responds with a viscoelastic force to a constraint violation, identical to the reaction force of a spring-damper. The spring-damper can be parametrized via stiffness and damping coefficients. An example of such a constraint is a hinge.

Relaxing a velocity constraint (i.e., a constraint which has a target velocity) leads to a viscous force response upon constraint violation. The force response is parametrized via a kinetic loss parameter (inverse of a damping coefficient). An example of such a constraint is a gear ratio.

## Constraint Friction

Most controllable coordinates offer the option of enabling friction forces. Constraint friction applies a dissipative force which intends to remove any relative motion in the corresponding coordinate. For example, a hinge with its controllable angular coordinate in the free control mode can apply a friction force (or torque in this case) to the constrained parts about the hinge axis. The friction force can be set to a fixed maximum value or be chosen to be linearly proportional to the forces applied in the non-controllable coordinates of the joint. For a hinge, this means that the friction force would increase with the loads felt in the hinge bearing (that is, in the remaining five non-controllable coordinates).

To set the constraint friction:

1. In the Properties panel for a constraint, click either Axes tab (Controlled Axes or Other Axes), depending on the friction you need to set.
2. Select the Friction box to enable friction for the constraint's coordinate.
Note
You cannot configure friction between cables and pulley surfaces. The friction is assumed to be infinite (no cable slipping over pulley).
3. Set the following parameters:
• Coefficient: Sets the coefficient used to calculate the maximum scalar friction force that will be applied in the coordinate, as described by Fmax = (friction coefficient) * (constraint force outside coordinate axis). The "constraint force outside coordinate axis" is the rejection of the constraint force vector (taken from the last simulation step) from the coordinate axis vector, i.e., the scalar constraint force outside of the coordinate. This parameter is only used when Proportional is selected.
• Loss: Specifies the regularization parameter that limits the applied friction force to (1/loss) * (relative velocity). This models the friction force as a viscous force. If set to zero, friction force is not regularized and not velocity dependent.
• Maximum Force: Sets a constant maximum friction force that will be applied in the coordinate. This value is only used when Proportional is not selected.
• Proportional: When selected, the Coefficient and Static Friction Scale parameters are used. When not selected, Maximum Force is used.
• Static Friction Scale: Specifies a multiplier on top of the friction Coefficient that is included in the formula for Fmax, when the joint coordinate is stationary (no coordinate velocity). Thus, Fmax = (friction coefficient) * (static friction scale) * (constraint force outside coordinate axis).
This is used to dynamically model the difference in friction force in the static versus the kinetic case. If the joint is moving (i.e., kinetic case), the static friction scale in the previous equation is assumed to be 1.
This value is only used when Proportional is selected.

## Sub-Topics

The following topics are covered in this section: