# Interface

## Initialization

The unused kwargs of initialization functions are set to zero.

ConstrainedDynamics.setPosition!Method
setPosition!(origin, body2; p1, p2, Δx, Δq)

Set the position and orientation of body2 relative to the origin at the connection points p1 and p2.

ConstrainedDynamics.setVelocity!Method
setVelocity!(body1, body2; p1, p2 Δv, Δω)

Set the translational and angular velocity of body2 relative to body1 at the connection points p1 and p2.

ConstrainedDynamics.setVelocity!Method
setVelocity!(origin, body2; p1, p2 Δv, Δω)

Set the translational and angular velocity of body2 relative to the origin at the connection points p1 and p2.

## Indexing

The following functions can be used to get bodies and constraints from a mechanism.

ConstrainedDynamics.getbodyMethod
getbody!(mechanism, id)

Gets the body with ID id from mechanism if it exists. If id = nothing, the origin will be returned.

ConstrainedDynamics.getcomponentMethod
getcomponent!(mechanism, name)

Gets the component (body or equality constraint) with name name from mechanism if it exists.

## Minimal Coordinates

The state of a mechanism ist stored in maximal coordinates, i.e. the position and orientation of each body. Minimal coordinates (generalized, joint coordinates) can be set and retrived from constraints with the following functions.

ConstrainedDynamics.setForce!Method
setForce!(mechanism, eqconstraint, Fτ)

Sets the minimal coordinate forces (vector) of joint eqconstraint.

Prismatic joint example: setVelocity!(mechanism, geteqconstraint(mechanism, jointid), [-1.0])

ConstrainedDynamics.setPosition!Method
setPosition!(mechanism, eqconstraint, xθ)

Sets the minimal coordinates (vector) of joint eqconstraint.

Revolute joint example: setPosition!(mechanism, geteqconstraint(mechanism, "joint_name"), [pi/2])

ConstrainedDynamics.setVelocity!Method
setVelocity!(mechanism, eqconstraint, vω)

Sets the minimal coordinate velocities (vector) of joint eqconstraint.

Planar joint example: setVelocity!(mechanism, geteqconstraint(mechanism, jointid), [0.5;2.0])