A Chrono body can be constrained in its relative motion with respect to a different body or ground. For instance, consider the case of a connecting rod and a piston, which are connected by a revolute joint. Or the rod and the crankshaft, which are also connected through a joint.
Connecting the relative motion of bodies is achieved in Chrono using ChLink classes.
- Links are used to connect two ChBody
- There are many sub-classes of ChLink:
- Most links use two ChMarker objects
- Reactions and joint rotations/velocities are computed with respect to the master marker
- Motion is constrained with respect to the x,y,z axes of the frame of the master marker Example:
- ChLinkLockRevolute: allows one DOF, a rotation about the z axis
- ChLinkLockPrismatic: allows one DOF, a translation along the x axis
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:
- Create the link from the desired ChLinkXxxyyy class
mylink->Initialize(…)to connect two bodies
- Add the link to a ChSystem
- Optional: set link properties