Links

A Chrono body can be constrained in its relative motion with respect to a different body or ground. This is achieved by using ChLink classes.
From the ChLink class various sets of links are derived. The most noticeable are those derived from:

  • ChLinkMate: more efficient, however they do not implement limits and only few of them can have an imposed motion;
  • ChLinkLock: more general, the relative motion can be limited within boundaries, forces and relative displacements can easily be retrieved; it is possible to specify a constraint over points that are moving respect to the body reference frame;
  • ChLinkMotor: ChLinkMate derived joints with included actuation.

Thus, some of the ChLinkMate and ChLinkLock derived classes may overlap. The latter being more flexible, the first more efficient. Because of this, the ChLinkMate version should be preferred, in general.

Some general information are fundamental to effectively use these classes:

  • links often refer to a pair of ChMarker, but such markers can be automatically added to bodies during link initialization; see below;
  • each link has a reference/master frame; reaction forces and axis directions are computed with respect to this reference marker;
  • it is worth to set the initial position of the markers/bodies to a feasible position;
  • it is generally useful to set the solver parameters to finer values when constraints are present; see Solvers;

ChLink Quick Reference

ConDOF Task Description Class
6 Fix Fix position and rotation ChLinkMateFix
ChLinkLockLock
6|3 Bushing Linear compliance + optional spherical joint ChLinkBushing
5 Revolute Allows rotation along Z axis ChLinkMateRevolute
ChLinkLockRevolute
ChLinkRevolute
5 Prismatic Allows translation along Z axis ChLinkMatePrismatic
ChLinkLockPrismatic
4 Universal Universal joint (along X and Y axes) ChLinkUniversal
4 Revolute+Prismatic Allow translation along X axis and rotation along Z axis ChLinkLockRevolutePrismatic
4 Oldham Oldham joint; does not fix axes position ChLinkLockOldham
4 Cylindrical Z Axes are collinear ChLinkMateCylindrical
ChLinkLockCylindrical
3 Spherical Fix translations ChLinkMateSpherical
ChLinkLockSpherical
3 Planar XY planes are coplanar ChLinkLockPlanar
ChLinkMatePlanar
3 Aligned Fix rotations ChLinkLockAlign
2 Revolute+Spherical Fix distance along Z axis; free rotations ChLinkMateDistanceZ
ChLinkRevoluteSpherical
2 Revolute+Align Allow translation respect to a rotating frame ChLinkRevoluteTranslational
2 Point on a Plane Z translations are blocked ChLinkLockPointPlane
2 Point on a Line Point belongs to a given line; free to rotate ChLinkLockPointLine
ChLinkLockPointSpline
2 Parallel Z axes are parallel ChLinkMateParallel
ChLinkLockParallel
2 Orthogonal X and Y axes are kept orthogonal; Z axes are aligned ChLinkMateOrthogonal
ChLinkLockPerpend
1 Distance Polar distance is fixed ChLinkDistance
1 Rack-Pinion Couple rotation of the pinion Z axis with rack X axis ChLinkMateRackPinion
1 Pulley Couple rotation over Z axes; pulley-specific features ChLinkLockPulley
1 Gear Couple rotation over Z axes; gear-specific features ChLinkLockGear
0 Free No constraints ChLinkLockFree

Additionally, if a body has to be fixed to the global frame and reaction forces are of no interest, it is possible to use the SetFixed() method; this will also eliminate the state from the system.

Actuators

ConDOF MotDOF Task Description Class
0|3|5 1 Linear Actuator Applies linear force|speed|position between frames;
optionally adds none|prismatic|spherical joints to its ends
can be paired with 1D ChShaft
ChLinkMotorLinear and derived
0|3|5 1 Rotating Actuator Applies torque|speed|position between frames;
optionally adds none|revolute|cylindrical|Oldham joints to its ends
can be paired with 1D ChShaft
ChLinkMotorRotation and derived
0 1 Linear Spring+Damper Spring+Damper depending to frame distance; also with custom force ChLinkTSDA
0 1 Rotational Spring+Damper Spring+Damper depending to frame rotation along Z axis; also with custom force ChLinkRSDA

Also ChLinkLockLock can be used to impose a motion between bodies.

Usage

In many cases there is no need to explicitly create two markers. Use in the case the ChLink::Initialize() function, passing the two bodies and the position of the constraint. This function will automatically create the two markers and it will add them to the bodies.

Alternatively, one can create the two markers by explicitly, add them to the two bodies, and then call Initialize() by passing the two markers.

In general, the process involves the following steps:

  1. Create one of the links of the ChLink derived class (e.g. ChLinkLockSpherical)
    auto mylink = chrono_types::make_shared<ChLinkLockSpherical>();
  2. Use mylink->Initialize(…) to connect two bodies; different links may accept different arguments. Refer to the documentation of the specific link for further information.
    mylink->Initialize(pendulumBody, // the 1st body to connect
    floorBody, // the 2nd body to connect
    ChFramed(ChVector3d(1, 0, 0),
    QuatFromAngleAxis(-CH_PI / 2, VECT_X)
    )
    );
  3. Add the link to a ChSystem
    my_system.Add(mylink);
  4. Optional: set link properties

Examples

See also:

ChQuaterniond QuatFromAngleAxis(double angle, const ChVector3d &axis)
Convert from an angle and an axis to a quaternion.
Definition: ChRotation.cpp:149
ChFrame< double > ChFramed
Alias for double-precision coordinate frames.
Definition: ChFrame.h:346
ChVector3< double > ChVector3d
Alias for double-precision vectors.
Definition: ChVector3.h:283