Joints
A joint restricts the number of degrees of freedom (DOF) of a body. For example, a free floating body has 6 DOF, but if it is attached to a Revolute joint, the joint restricts all but one rotational degree of freedom (a revolute joint acts like a hinge). Similarily, a Prismatic joint restricts all but one translational degree of freedom (a prismatic joint acts like a slider).
A Spherical joints restricts all translational degrees of freedom, but allows all rotational degrees of freedom. It thus transmits no torque. A Planar joint moves in a plane, i.e., it restricts one translational DOF and two rotational DOF. A Universal joint has two rotational DOF.
Some joints offer the option to add 1-dimensional components to them by providing the keyword axisflange = true. This allows us to add, e.g., springs, dampers, sensors, and actuators to the joint.
Docstrings
Multibody.PlanarMultibody.FreeMotionMultibody.GearConstraintMultibody.JointRRRMultibody.JointUSRMultibody.PlanarMechanics.PrismaticMultibody.PlanarMechanics.RevoluteMultibody.PrismaticMultibody.PrismaticConstraintMultibody.RevoluteMultibody.RevolutePlanarLoopConstraintMultibody.SphericalMultibody.SphericalConstraintMultibody.SphericalSphericalMultibody.UniversalMultibody.UniversalSpherical
Multibody.Planar — ConstantPlanar(; n = [0,0,1], n_x = [1,0,0], cylinderlength = 0.1, cylinderdiameter = 0.05, cylindercolor = [1, 0, 1, 1], boxwidth = 0.3*cylinderdiameter, boxheight = boxwidth, boxcolor = [0, 0, 1, 1])Joint where frame_b can move in a plane and can rotate around an axis orthogonal to the plane. The plane is defined by vector n which is perpendicular to the plane and by vector n_x, which points in the direction of the x-axis of the plane. frame_a and frame_b coincide when s_x=prismatic_x.s=0, s_y=prismatic_y.s=0 and phi=revolute.phi=0.
Structural parameters
n: Axis orthogonal to unconstrained plane, resolved inframe_a(= same as inframe_b)n_x: Vector in direction of x-axis of plane, resolved inframe_a(n_xshall be orthogonal ton)
Connectors
frame_a: Frame for the jointframe_b: Frame for the joint
Variables
s_x: Relative distance along first prismatic joint starting atframe_as_y: Relative distance along second prismatic joint starting at first prismatic jointphi: Relative rotation angle fromframe_atoframe_bv_x: Relative velocity along first prismatic jointv_y: Relative velocity along second prismatic jointw: Relative angular velocity around revolute jointa_x: Relative acceleration along first prismatic jointa_y: Relative acceleration along second prismatic jointwd: Relative angular acceleration around revolute joint
Rendering parameters
cylinderlength: Length of the revolute cylindercylinderdiameter: Diameter of the revolute cylindercylindercolor: (structural) Color of the revolute cylinderboxwidth: Width of the prismatic joint boxesboxheight: Height of the prismatic joint boxesboxcolor: (structural) Color of the prismatic joint boxesradius: (structural) Radius of the revolute cylinderrender: Enable rendering of the joint in animations
Multibody.FreeMotion — MethodFreeMotion(; name, state = true, sequence, isroot = true, w_rel_a_fixed = false, z_rel_a_fixed = false, phi = 0, phid = 0, phidd = 0, w_rel_b = 0, r_rel_a = 0, v_rel_a = 0, a_rel_a = 0)Joint which does not constrain the motion between frame_a and frame_b. Such a joint is only meaningful if the relative distance and orientation between frame_a and frame_b, and their derivatives, shall be used as state.
Note, that bodies such as Body, BodyShape, have potential state variables describing the distance and orientation, and their derivatives, between the world frame and a body fixed frame. Therefore, if these potential state variables are suited, a FreeMotion joint is not needed.
The state of the FreeMotion object consits of:
The relative position vector r_rel_a from the origin of frame_a to the origin of frame_b, resolved in frame_a and the relative velocity v_rel_a of the origin of frame_b with respect to the origin of frame_a, resolved in frame_a (= D(r_rel_a)).
Arguments
state: Enforce this joint having state, this is often desired and is the default choice.sequence: Rotation sequence, defaults to[1, 2, 3]w_rel_a_fixed: = true, ifw_rel_a_startare used as initial values, else as guess valuesz_rel_a_fixed: = true, ifz_rel_a_startare used as initial values, else as guess values
Initial condition arguments:
phiphidphiddw_rel_br_rel_av_rel_aa_rel_a
Multibody.GearConstraint — MethodGearConstraint(; name, ratio, checkTotalPower = false, n_a, n_b, r_a, r_b)This ideal massless joint provides a gear constraint between frames frame_a and frame_b. The axes of rotation of frame_a and frame_b may be arbitrary.
ratio: Gear ration_a: Axis of rotation offrame_an_b: Axis of rotation offrame_br_a: Vector from framebearingtoframe_aresolved in bearingr_b: Vector from framebearingtoframe_bresolved in bearing
Multibody.JointRRR — MethodJointRRR(;
name,
n_a = [0,0,1],
n_b = [0,0,1],
rRod1_ia = [1,0,0],
rRod2_ib = [-1,0,0],
phi_offset = 0,
phi_guess = 0,
)This component consists of 3 revolute joints with parallel axes of rotation that are connected together by two rods.
This joint aggregation introduces neither constraints nor state variables and should therefore be used in kinematic loops whenever possible to avoid non-linear systems of equations. It is only meaningful to use this component in planar loops. Basically, the position and orientation of the 3 revolute joints as well as of frame_ia, frame_ib, and frame_im are calculated by solving analytically a non-linear equation, given the position and orientation at frame_a and at frame_b.
Connector frame_a is the "left" side of the first revolute joint whereas frame_ia is the "right side of this revolute joint, fixed in rod 1. Connector frame_b is the "right" side of the third revolute joint whereas frame_ib is the "left" side of this revolute joint, fixed in rod 2. Finally, connector frame_im is the connector at the "right" side of the revolute joint in the middle, fixed in rod 2.
The easiest way to define the parameters of this joint is by moving the MultiBody system in a reference configuration where all frames of all components are parallel to each other (alternatively, at least frame_a, frame_ia, frame_im, frame_ib, frame_b of the JointRRR joint should be parallel to each other when defining an instance of this component).
Basically, the JointRRR model internally consists of a universal-spherical-revolute joint aggregation (= JointUSR). In a planar loop this will behave as if 3 revolute joints with parallel axes are connected by rigid rods.
Arguments
n_aAxis of revolute joints resolved inframe_a(all axes are parallel to each other)n_bAxis of revolute joint fixed and resolved inframe_brRod1_iaVector from origin offrame_ato revolute joint in the middle, resolved inframe_iarRod2_ibVector from origin offrame_ibto revolute joint in the middle, resolved inframe_ibphi_offsetRelative angle offset of revolute joint atframe_b(angle = phi(t) + phi_offset)
Connectors
frame_a: Coordinate system fixed to the component with one cut-force and cut-torqueframe_b: Coordinate system fixed to the component with one cut-force and cut-torqueframe_ia: Coordinate system at origin offrame_afixed at connecting rod of left and middle revolute jointframe_ib: Coordinate system at origin offrame_ibfixed at connecting rod of middle and right revolute jointframe_im: Coordinate system at origin of revolute joint in the middle fixed at connecting rod of middle and right revolute jointaxis: 1-dim. rotational flange that drives the right revolute joint atframe_bbearing: 1-dim. rotational flange of the drive bearing of the right revolute joint atframe_b
Multibody.JointUSR — MethodJointUSR(;
name,
n1_a = [0, 0, 1],
n_b = [0, 0, 1],
rRod1_ia = [1, 0, 0],
rRod1_ib = [-1, 0, 0],
phi_offset = 0,
phi_guess = 0,
)This component consists of a universal joint at frame_a, a revolute joint at frame_b and a spherical joint which is connected via rod1 to the universal and via rod2 to the revolute joint.
This joint aggregation has no mass and no inertia and introduces neither constraints nor potential state variables. It should be used in kinematic loops whenever possible since the non-linear system of equations introduced by this joint aggregation is solved analytically (i.e., a solution is always computed, if a unique solution exists).
The universal joint is defined in the following way:
- The rotation axis of revolute joint 1 is along parameter vector
n1_awhich is fixed inframe_a. - The rotation axis of revolute joint 2 is perpendicular to axis 1 and to the line connecting the universal and the spherical joint (= rod 1).
The definition of axis 2 of the universal joint is performed according to the most often occurring case for the sake of simplicity. Otherwise, the treatment is much more complicated and the number of operations is considerably higher, if axis 2 is not orthogonal to axis 1 and to the connecting rod.
Note, there is a singularity when axis 1 and the connecting rod are parallel to each other. Therefore, if possible n1_a should be selected in such a way that it is perpendicular to rRod1_ia in the initial configuration (i.e., the distance to the singularity is as large as possible).
The rest of this joint aggregation is defined by the following parameters:
positive_branch: The positive branch of the revolute joint is selected (cf. elbow up vs. elbow down).- The position of the spherical joint with respect to the universal joint is defined by vector
rRod1_ia. This vector is directed fromframe_ato the spherical joint and is resolved inframe_ia(it is most simple to selectframe_iasuch that it is parallel toframe_ain the reference or initial configuration). - The position of the spherical joint with respect to the revolute joint is defined by vector
rRod2_ib. This vector is directed from the inner frame of the revolute joint (frame_iborrevolute.frame_a) to the spherical joint and is resolved inframe_ib(note, thatframe_ibandframe_bare parallel to each other). - The axis of rotation of the revolute joint is defined by axis vector
n_b. It is fixed and resolved inframe_b. - When specifying this joint aggregation with the definitions above, two different configurations are possible. Via parameter
phi_guessa guess value forrevolute.phi(t0)at the initial timet0is given. The configuration is selected that is closest tophi_guess(|revolute.phi - phi_guess|is minimal).
Connectors
frame_a: Frame for the universal jointframe_b: Frame for the revolute joint- An additional
frame_iais present. It is fixed in the rod connecting the universal and the spherical joint at the origin offrame_a. The placement offrame_iaon the rod is implicitly defined by the universal joint (frame_aandframe_iacoincide when the angles of the two revolute joints of the universal joint are zero) and by parameter vector rRod1ia, the position vector from the origin of `frameato the spherical joint, resolved inframe_ia`. - An additional
frame_ibis present. It is fixed in the rod connecting the revolute and the spherical joint at the side of the revolute joint that is connected to this rod (= rod2.frame_a = revolute.frame_a). - An additional
frame_imis present. It is fixed in the rod connecting the revolute and the spherical joint at the side of the spherical joint that is connected to this rod (= rod2.frame_b). It is always parallel toframe_ib.
Multibody.Prismatic — MethodPrismatic(; name, n = [0, 0, 1], axisflange = false)Prismatic joint with 1 translational degree-of-freedom
n: The axis of motion (unit vector)axisflange: If true, the joint will have two additional frames from Mechanical.Translational,axisandsupport, between which translational components such as springs and dampers can be connected.
If axisflange, flange connectors for ModelicaStandardLibrary.Mechanics.TranslationalModelica are also available:
axis: 1-dim. translational flange that drives the jointsupport: 1-dim. translational flange of the drive support (assumed to be fixed in the world frame, NOT in the joint)
The function returns an ODESystem representing the prismatic joint.
Multibody.PrismaticConstraint — MethodPrismaticConstraint(; name, color, radius = 0.05, x_locked = true, y_locked = true, z_locked = true, render = true)This model does not use explicit variables e.g. state variables in order to describe the relative motion of frame_b with respect to frame_a, but defines kinematic constraints between the frame_a and frame_b. The forces and torques at both frames are then evaluated in such a way that the constraints are satisfied. Sometimes this type of formulation is called an implicit joint in literature.
As a consequence of the formulation, the relative kinematics between frame_a and frame_b cannot be initialized.
In complex multibody systems with closed loops this may help to simplify the system of non-linear equations. Compare the simplification result using the classical joint formulation and this alternative formulation to check which one is more efficient for the particular system under consideration.
In systems without closed loops the use of this implicit joint does not make sense or may even be disadvantageous.
Parameters
color: Color of the joint in animations (RGBA)radius: Radius of the joint in animationsx_locked: Set to false if the translational motion in x-direction shall be freey_locked: Set to false if the translational motion in y-direction shall be freez_locked: Set to false if the translational motion in z-direction shall be freerender: Whether or not the joint is rendered in animations
Multibody.Revolute — MethodRevolute(; name, phi0 = 0, w0 = 0, n, axisflange = false)Revolute joint with 1 rotational degree-of-freedom
phi0: Initial anglew0: Iniitial angular velocityn: The axis of rotationaxisflange: If true, the joint will have two additional frames from Mechanical.Rotational,axisandsupport, between which rotational components such as springs and dampers can be connected.
If axisflange, flange connectors for ModelicaStandardLibrary.Mechanics.Rotational are also available:
axis: 1-dim. rotational flange that drives the jointsupport: 1-dim. rotational flange of the drive support (assumed to be fixed in the world frame, NOT in the joint)
Rendering options
radius = 0.05: Radius of the joint in animationslength = radius: Length of the joint in animationscolor: Color of the joint in animations, a vector of length 4 with values between [0, 1] providing RGBA values
Multibody.RevolutePlanarLoopConstraint — MethodRevolutePlanarLoopConstraint(; name, n)Revolute joint that is described by 2 positional constraints for usage in a planar loop (the ambiguous cut-force perpendicular to the loop and the ambiguous cut-torques are set arbitrarily to zero)
Joint where frame_b rotates around axis n which is fixed in frame_a and where this joint is used in a planar loop providing 2 constraint equations on position level.
If a planar loop is present, e.g., consisting of 4 revolute joints where the joint axes are all parallel to each other, then there is no unique mathematical solution if all revolute joints are modelled with Revolute and the symbolic algorithms will fail. The reason is that, e.g., the cut-forces in the revolute joints perpendicular to the planar loop are not uniquely defined when 3-dim. descriptions of revolute joints are used. In this case, one revolute joint in the loop has to be replaced by model RevolutePlanarLoopConstraint. The effect is that from the 5 constraints of a 3-dim. revolute joint, 3 constraints are removed and replaced by appropriate known variables (e.g., the force in the direction of the axis of rotation is treated as known with value equal to zero; for standard revolute joints, this force is an unknown quantity).
Multibody.Spherical — MethodSpherical(; name, state = false, isroot = true, w_rel_a_fixed = false, z_rel_a_fixed = false, sequence, phi = 0, phid = 0, phidd = 0, d = 0)Joint with 3 constraints that define that the origin of frame_a and the origin of frame_b coincide. By default this joint defines only the 3 constraints without any potential state variables. If parameter state is set to true, three states are introduced. The orientation of frame_b is computed by rotating frame_a along the axes defined in parameter vector sequence (default = [1,2,3], i.e., the Cardan angle sequence) around the angles used as state. If angles are used as state there is the slight disadvantage that a singular configuration is present leading to a division by zero.
isroot: Indicate thatframe_ais the root, otherwiseframe_bis the root. Only relevant ifstate = true.sequence: Rotation sequenced: Viscous damping constant. Ifd > 0. the joint dissipates energy due to viscous damping according to $τ ~ -d*ω$.
Rendering options
radius = 0.1: Radius of the joint in animationscolor = [1,1,0,1]: Color of the joint in animations, a vector of length 4 with values between [0, 1] providing RGBA valuesrender = true: Render the joint in animations
Multibody.SphericalConstraint — MethodSphericalConstraint(; name, color = [1, 1, 0, 1], radius = 0.1, x_locked = true, y_locked = true, z_locked = true)Spherical cut joint and translational directions may be constrained or released
This model does not use explicit variables e.g. state variables in order to describe the relative motion of frame_b with to respect to frame_a, but defines kinematic constraints between the frame_a and frame_b. The forces and torques at both frames are then evaluated in such a way that the constraints are satisfied. Sometimes this type of formulation is also called an implicit joint in literature.
As a consequence of the formulation the relative kinematics between frame_a and frame_b cannot be initialized.
In complex multibody systems with closed loops this may help to simplify the system of non-linear equations. Please compare state realization chosen by structural_simplify using the classical joint formulation and the alternative formulation used here in order to check whether this fact applies to the particular system under consideration. In systems without closed loops the use of this implicit joint is not recommended.
Arguments
x_locked: Set to false if the translational motion in x-direction shall be freey_locked: Set to false if the translational motion in y-direction shall be freez_locked: Set to false if the translational motion in z-direction shall be free
Rendering parameters
color: Color of the joint in animations (RGBA)radius: Radius of the joint in animations
Multibody.SphericalSpherical — MethodSphericalSpherical(; name, state = false, isroot = true, iscut=false, w_rel_a_fixed = false, r_0 = [0,0,0], color = [1, 1, 0, 1], m = 0, radius = 0.1, kinematic_constraint=true)Joint that has a spherical joint on each of its two ends. The rod connecting the two spherical joints is approximated by a point mass that is located in the middle of the rod. When the mass is set to zero (default), special code for a massless body is generated.
This joint introduces one constraint defining that the distance between the origin of frame_a and the origin of frame_b is constant (= rodLength). It is highly recommended to use this joint in loops whenever possible, because this enhances the efficiency considerably due to smaller systems of non-linear algebraic equations.
It is not possible to connect other components, such as a body with mass properties or a special visual shape object to the rod connecting the two spherical joints. If this is needed, use instead joint UniversalSpherical that has the additional frame frame_ia for this.
Connectors:
frame_a: Frame for the first spherical jointframe_b: Frame for the second spherical joint
Rendering parameters:
radius: Radius of the joint in animationscolor: Color of the joint in animations (RGBA)
Multibody.Universal — MethodUniversal(; name, n_a, n_b, phi_a = 0, phi_b = 0, w_a = 0, w_b = 0, a_a = 0, a_b = 0, state_priority=10)Joint where frame_a rotates around axis n_a which is fixed in frame_a and frame_b rotates around axis n_b which is fixed in frame_b. The two frames coincide when revolute_a.phi=0 and revolute_b.phi=0. This joint has the following potential states;
- The relative angle
phi_a = revolute_a.phi[rad] around axisn_a - the relative angle
phi_b = revolute_b.phi[rad] around axisn_b - the relative angular velocity
w_a = D(phi_a) - the relative angular velocity
w_b = D(phi_b)
Multibody.UniversalSpherical — MethodUniversalSpherical(; name, n1_a, rRod_ia, sphere_diameter = 0.1, sphere_color, rod_width = 0.1, rod_height = 0.1, rod_color, cylinder_length = 0.1, cylinder_diameter = 0.1, cylinder_color, kinematic_constraint = true)Universal - spherical joint aggregation (1 constraint, no potential states)
This component consists of a universal joint at frame_a and a spherical joint at frame_b that are connected together with a rigid rod.
This joint aggregation has no mass and no inertia and introduces the constraint that the distance between the origin of frame_a and the origin of frame_b is constant (= length(rRod_ia)). The universal joint is defined in the following way:
- The rotation axis of revolute joint 1 is along parameter vector
n1_awhich is fixed inframe_a. - The rotation axis of revolute joint 2 is perpendicular to axis 1 and to the line connecting the universal and the spherical joint.
Note, there is a singularity when axis 1 and the connecting rod are parallel to each other. Therefore, if possible n1_a should be selected in such a way that it is perpendicular to rRod_ia in the initial configuration (i.e., the distance to the singularity is as large as possible).
An additional frame_ia is present. It is fixed in the connecting rod at the origin of frame_a. The placement of frame_ia on the rod is implicitly defined by the universal joint (frame_a and frame_ia coincide when the angles of the two revolute joints of the universal joint are zero) and by parameter vector rRod_ia, the position vector from the origin of frame_a to the origin of frame_b, resolved in frame_ia.
This joint aggregation can be used in cases where in reality a rod with spherical joints at end are present. Such a system has an additional degree of freedom to rotate the rod along its axis. In practice this rotation is usually of no interest and is mathematically removed by replacing one of the spherical joints by a universal joint. Still, in most cases the SphericalSpherical joint aggregation can be used instead of the UniversalSpherical joint since the rod is animated and its mass properties are approximated by a point mass in the middle of the rod. The SphericalSpherical joint has the advantage that it does not have a singular configuration.
Arguments
n1_aAxis 1 of universal joint resolved in frame_a (axis 2 is orthogonal to axis 1 and to rod)rRod_iaVector from origin of framea to origin of frameb, resolved inframe_ia(if computeRodLength=true, rRod_ia is only an axis vector along the connecting rod)kinematic_constraint = trueSet to false if no constraint shall be defined, due to analytically solving a kinematic loopconstraint_residueIf set to:external, an equation in the parent system is expected to define this variable, e.g.,rod.constraint_residue ~ rod.f_rod - f_rodwhererodis the name of the UniversalSpherical joint. If unspecified, the length constraintrRod_0'rRod_0 - rodLength'rodLengthis used
Connectors
frame_a: Frame for the universal jointframe_b: Frame for the spherical jointframe_ia: Frame fixed in the rod at the origin offrame_a
Rendering parameters
sphere_diameter: Diameter of spheres representing the universal and the spherical jointsphere_color: Color of spheres representing the universal and the spherical joint (RGBA)rod_width: Width of rod shape in direction of axis 2 of universal jointrod_height: Height of rod shape in direction that is orthogonal to rod and to axis 2rod_color: Color of rod shape connecting the universal and the spherical joints (RGBA)cylinder_length: Length of cylinders representing the two universal joint axescylinder_diameter: Diameter of cylinders representing the two universal joint axescylinder_color: Color of cylinders representing the two universal joint axes (RGBA)
Multibody.PlanarMechanics.Prismatic — MethodPrismatic(; name, f, s = 0, axisflange = false)A prismatic joint
Parameters
r: [m, m] x,y-direction of the rod wrt. body system at phi=0axisflange=false: Iftrue, a force flange is enabled, otherwise implicitly grounded"render: Render the joint in animationsradius: Radius of the body in animationscolor: Color of the body in animations
Variables
s(t): [m] Elongation of the jointv(t): [m/s] Velocity of elongationa(t): [m/s²] Acceleration of elongationf(t): [N] Force in direction of elongation
Connectors
Multibody.PlanarMechanics.Revolute — MethodRevolute(; name, phi = 0.0, tau = 0.0, axisflange = false)A revolute joint
Parameters:
axisflange=false: Iftrue, a force flange is enabled, otherwise implicitly grounded"phi: [rad] Initial angular position for the flangetau: [Nm] Initial Cut torque in the flange
Variables:
phi(t): [rad] angular positionw(t): [rad/s] angular velocityα(t): [rad/s²] angular accelerationtau(t): [Nm] torque
Connectors