Kinematic analysis deals with time dependent functions, such as velocity and acceleration of linkages. LinkageDesigner provides a number of functions that helps analyse the translational and angular velocity, acceleration and also higher order derivatives of any links.
LinkageData by default does not contains kinematic records, because the basic analysis does not requires it. In order to calculate the velocity or acceleration, the linkage should be converted into a time dependent linkage. As the linkage is converted into time dependent linkage LinkageDesigner recalculates and stores the required records in the LinkageData.
There are principally two ways to convert linkages into time dependent ones:
• Express every driving variables with the explicit function of the time variables and use the time as the only one driving variable.
• Specify first derivatives of the independent driving variables by setting the velocity values for every driving variables.
 ToTimeDependentLinkage[linkage,t] Converts linkage into a time dependent mechanism. The function determines the time-dependent variables of the linkage and calculates symbolically the first derivatives of these variables with respect to t symbol. NToTimeDependentLinkage[linkage,t] Converts linkage into a time dependent mechanism. The function determines the time-dependent variables of the linkage and calculates numerically the first derivatives of these variables with respect to t symbol.

Convert linkages into time dependent ones.

In this tutorial the kinematic analysis of the double cardan shaft linkage will be presented. This mechanism is often used in machines, cars, boats etc to transmit rotation and torques between two shafts whose axes are not coinciding.

Double cardan shaft mechanism

The double cardan shaft has a peculiar kinematic feature. If the input and output axes are parallel or perpendicular, coplanar and the angular velocity of the input shaft is constant, than the angular velocity of the output shaft is also constant. In this configuration the double cardan shaft is a so called CV joint ( Constant Velocity joint). Any other relative orientation of the input and output axes result a "jerky rotation" in the output shaft.
To analyse the above mentioned kinematic feature, two double cardan mechanisms are built. The first one having parallel and coplanar input-output axes, while the second one is slightly misaligned from the parallel axis. The angular velocity of the output axis are plotted for one whole rotation of the input axis. This way the raise of the "jerky rotation" can be explored.

## Define the cardan shaft linkage

The cardan shaft mechanism is used to transmit rotation ( and torque ) between two non-coaxial shaft. If the driving and driven axis is connected with one universal joint the angular velocity of the driven shaft would oscillate, even if the angular velocity of the driving shaft is constant. These variations in velocity give rise to inertia forces, torques, noise, and vibration. By using a double joint the variation of angular motion can be avoided, provided that :
• The two forks of the intermediate shaft (link2) lies in the same plane.
• The angle between the first shaft (link1) and the intermediate shaft (link2) must exactly be the same with that between the intermediate shaft (link2) and the last shaft (link3)
In order to model the different configuration of the double cardan shaft linkage, the linkage definition is divided into two steps. First the open chain double cardan shaft is defined without defining the loop closing rotational joint of the output axis (link3). This mechanism having 5 DOF that is used to align the output axis to the required direction and measure the position and orientation of the end point marker. Using the measured marker the loop closing rotational joint is defined and the resulted LinkageData is assigned to a new variable.
The main design rules of the linkage definition:
1. The input axis ( link1) rotates around the x-axis of the reference frame
Define the open chain double cardan shaft
 Out[69]=
The linkage definition above contains two fixed joints. The first fixed joint connects S link to link2. This joint is introduced to move and rotate the z-axis of link2 in the position where the second universal joint can be defined. The second fixed joint connects E link to link3. The LLRF of E link is positioned and rotated in a posture, where the rotational joint of the output axis will be defined.
Display the kinematic graph of the linkage
 Out[70]=
 Out[71]=
There are predefined geometries stored in the STL subdirectory of the \$LinkageExamplesDirectory. These geometries can be imported with the standard Import function and assigned to the \$LDLinkGeometry record of the LinkageData.
Import and color and assign solid geometry to the links
Since the LLRF of E link is defined as the joint marker of the rotational joint, which connects the output link to the workbench, the loop closing rotational joint can be easily defined. To determine the joint markers on both links it is enugh to measure LLRF of E with respect to the reference frame.
Move the open double cardan linkage into a posture where the input and output axis are parallel and coplanar. Set the angle of the input and intermediate shaft to 15°.
 Out[76]=
Measure the LLRF of "E" link in this posture
 Out[78]//MatrixForm=
Display the open double cardan shaft in this posture
 Out[79]=

Kinematic pair definition.

 option name default value CheckRedundantEquations False Enables/disables the redundant equation checking. ConstraintWorkingPrecision 16 Sets the working precision for the generated loop closing constraint equations. Verbose False Enables/disables verbose constraint definition. If it is enabled the function prints log messages. SimplifyEquation True Enables/disables simplification of generated transformations and loop closing equations.

Constraint generation options.

Define the loop closing kinematic pair and assign the resulted linkage to linkage1
The loop closing kinematic pair removes 4 variables and leave only one driving variable, which is the joint variable of the first rotational joint. This implies that the mobility of the double cardan shaft mechanism is 1.
 Out[81]=
Similarly as linkage1 was defined from linkage, a second mechanism could be defined. This mechanism hovewer have only coplanar but NOT parallel input and output axes. The angle between the input and output axes is set to be 5°.
Move the open double cardan linkage into a posture where the input and output axis are at angle 5° and coplanar.
 Out[82]=
Measure the LLRF of "E" link in this posture
 Out[84]//MatrixForm=
Define the loop closing kinematic pair and assign the resulted linkage to linkage2
Display the projected front view of linkage2 as 2D Graphics object
 Out[86]=

## Define time dependent double cardan shafts

In order to calculate the derivatives of the motion, the linkage has to be converted into a time dependent linkage. This can be done with the help of ToTimeDependentLinkage or NToTimeDependentLinkage functions. The primary task of these functions is to calculate the first derivatives of all time dependent variables and store them in the \$LDTimeDependentVariables record.
 ToTimeDependentLinkage[linkage,t] Calculates the first derivatives of the time dependent variables with respect to t and fill up the \$LDTimeDependentVariables and \$LDDrivingVelocities records of linkage. NToTimeDependentLinkage[linkage,t] Generates the equations of the first derivatives of the time dependent variables with respect to t. The generated equations are appended to the \$LDDerivedParametersB record.

Convert linkages into time dependent ones.

Even if in theory the first derivative of the time dependent variables can always be solved in closed form, sometimes the expressions are so big, that the solution would require considerable time and memory resources. To overcome this problem the NToTimeDependentLinkage function was introduced. This function only generates the set of linear equations but do not solve them parametrically. The equations determining the first derivatives are appended to the \$LDDerivedParametersB record and solved simultaneously with the other constraint equations. The equations of this record are solved numerically with the FindRoot function, which is usually much more faster than the closed form solution in case of large expressions.
Convert linkage1 to time dependent linkage. Make sure that t is symbol
 Out[88]=
 \$LDTimeDependentVariables contains the contains the first derivative of the time dependent variables with respect to the time symbol. \$LDDrivingVelocities stores the velocity values of the driving variables. \$LDDerivedParametersB stores the list of implicitly derived dependent parameter record of the linkage.

Browse the time dependent records of LinkageData
 Out[89]=
 Out[90]=
So far we have calculated the first derivative of the time dependent variables. Most of the time the time dependent variables are the joint variables of the kinematic pairs. In order to get the translational and rotational velocity ( or higher order derivative) of a given link, these joint velocities has to be transformed into the so called "Cartesian" velocity of the link. GetLinkageDerivative function does this mapping by using the LinkJacobiMatrix function. The function calculates the translational and angular velocity vectors and returns a list of the two vector. The first vector is the translational velocity, while the second one is the angular velocity vector. (Naturally if higher order derivative is requested the returned list correspond to the translational rotational derivative of the order specified. )
 LinkJacobiMatrix[mx,vars] calculates the Jacobian matrix of the homogeneous matrix mx with respect to generalized coordinate vector vars GetLinkageDerivative[linkage,s] returns the velocity and angular velocity vector of the origin of the LLRF of link s. GetLinkageDerivative[linkage,s ,n] returns the n-th translational and rotational derivative vector of s link. The reference point is defined by the origin of the LLRF of link s.

Derivative functions

There are two important restrictions for the usage of GetLinkageDerivative function:
• The linkage should be converted to time dependent linkage before this function is called.
This second restriction is not so severe since, any higher order derivative function can be calculated if the driving variables of the mechanism is parameterized with time.
Many cases the designer does not want to parameterize the movement of all driving variables, because it sometimes requires tedious calculation. Often it is enough to check, what is the velocity or acceleration of a specific link in a specific posture, when the velocity in that posture is a given number. This kind of "quick and dirty" solution is supported with the GetLinkageDerivative function.
 option name default value SubstituteParameters False switch on /off parameter substitution

GetLinkageDerivative function by default calculates parametrically the derivative functions. The resulted parameterized expressions could be evaluated by applying substitution rules of GetLinkageRules function. In case GetLinkageDerivative function is called with option, the actual values of the variables and parameters of the linkage are substituted before the velocities returned. This results that the function returns two numerical vectors.
 Out[92]=
 Out[94]=
Since the calculated velocity vectors are parametric expressions, therefore it is possible to calculate the velocity of E point as the driving variable is changing. GetLinkageRules function can calculate a list of substitution values as the driving variables are interpolated between two endpoints.
 GetLinkageRules[linkage,drvls] calculates a two dimensional list of interpolated parameters. The interpolation is specified with the drvls, which is a list of driving variables .

Get substitution values for interpolated driving variables.

Calculate a list of substitution rule of cardanShaftT1 if the input shaft rotates one 360°. Display the first element of the resulted list
 Out[96]=
Plot the norm of the angular velocity vector of the output shaft
 Out[97]=
Calculate a list of substitution rule of cardanShaftT2 if the input shaft rotates one 360°
Plot the norm of the angular velocity vector of the output shaft
 Out[99]=
Display together the two angular velocities
 Out[100]=
As the last plot shows the double cardan shaft linkage having paralell and coplanar input and output axes has constant output angular velocity. If the angle of the input and output axes are perturbed a little bit from the 0° , the angular velocity of the output axes become a periodic function.