# DHLink

## DHLink

DHLink is a base of a kinematic link that can be added to DHChain to form a kinematic chain.

DHLink kinematic properties can be configured using Denavit–Hartenberg (also called **DH**) parameters and an unlimited number of constraints (including loops) between links.

According to the DH parameter system, every kinematic link has 4 parameters:

**Alpha**- Angle in radians between old Z and new Z plane**Theta**- Angle in radians between old X and new X plane**A**- Length of the common normal**D**- Offset along the previous Z to the common normal

More info about the DH parameters can be found at:

The following 3 types can be added to DHChain component to form a kinematic chain:

Link | Description |
---|---|

DHRevoluteLink | a DHLink that can rotate around its joint. It means that its Theta parameter is changeable and other DH parameters are fixed via its mechanical body constraints. The most common example of DHRevoluteLink is a hinge joint connected to some arm. |

DHPrismaticLink | a DHLink that allows a linear motion along a single axis i.e. the D parameter of it is changeable and other DH parameters are fixed via its mechanical body constraints. The most common example of a DHPrismaticLink is a cylinder. |

DHFixedLink | a DHLink that links joints so that all DH parameters are fixed via link mechanical body constraints. In other words, DHFixedLink is a non-rotating, non-movable connection from link start to link end. |

To create a kinematic chain, the predecessor DHLink should be connected (routed) to the successor DHLink. One DHLink can be a predecessor to multiple successor links. All DH parameters of the successor DHLink are always applied relative to the predecessor DHLink end position.

In addition to DH parameters, every DHLink also has an end Position port with values in (Cartesian) coordinates (**X**, **Y** and **Z**), relative to the DHChain **StartPosition**. All DHLinks have also a RotationMatrix port that expresses the link end rotation corresponding to input values. Another set of these ports called **SolvedPosition** and **SolvedRotation** are valued after the position-solving process is finished (see Position Solving).

**DHRevoluteLink** and **DHPrismaticLink** have 2 parameters for their changeable (i.e. degree of freedom) DH value. One (named **Theta** or **D** correspondingly) can be valued (e.g. routed) from outside of DHChain (for example from the control joystick or the actual link position sensor) and will be the input for kinematic solver calculations. Other (named **ThetaSolved** or **DSolved** accordingly) is read-only and is valued by the kinematic solver (see Position Solving). This value can be used to order the actual link mover (stepper motor etc) to go to the new position.

DHLink can also have one or many **PositionConstraint** ports, that can be routed from two different sources:

Purpose | Routed from | Constraint description |
---|---|---|

Loop Constraint | Position port of any other DHLink | Creates kinematic loop, i.e. the solver tries to find positions for links (by changing the link degree of freedom parameters) so that these link end positions would be exactly in the same place. |

Fixed Position Constraint | Position port | Creates fixed position constraint, i.e. the solver tries to find positions for links (by changing the link degree of freedom parameters) so that this link end position would be at the coordinates specified by the connected port. |

Fixed Rotation Constraint | Angles port | Creates fixed angle constraint, i.e. the solver tries to find positions for links (by changing the link degree of freedom parameters) so that this link end would be at the angle specified by the connected port. See also Angles to Rotation Composing Conventions. |

Velocity Constraint | Velocity or AngularVelocity port | Creates velocity constraint, i.e. the solver will use the DHChain Velocity Solving and calculate the velocity- related output arguments and port values based on the velocity specified by the connected port. See also Angles to Rotation Composing Conventions. |

Moving Position Constraint with Angles and Velocities | MovingPosition | Creates moving position constraint, i.e. solver tries to find positions for links (by changing link degree of freedom parameters) so that the link end would be at the position and angle specified by the connected port, and the solver will then use the DHChain Velocity Solving and calculate also the velocity-related output argument and port values based on the velocity specified by the connected port. See also Angles to Rotation Composing Conventions. |

DHLink changeable parameters can also have a joint **Limits** port that set **Min** and **Max** values so that the kinematic solver will try to solve the link position so that the parameter will be between these values.

### Optional Velocity Inputs and Outputs

Different velocity-related arguments and ports can be added to the DHLink:

Optional Input | Description |
---|---|

ThetaSpeed (for DHRevoluteLink) or DSpeed (for DHPrismaticLink) argument | Can be added to specify the change speed of the corresponding degree of freedom parameter. This value will be taken into account (in addition to other constraints and speed-related inputs) when calculating the optional CalculatedThetaSpeed (for DHRevoluteLinks) or CalculatedDSpeed (for DHPrismaticLinks), and also CalculatedVelocity and CalculatedAngularVelocity. |

Optional Output | Description |
---|---|

PredictedTheta (for DHRevoluteLink) or PredictedD (for DHPrismaticLink) argument | Can be added to instruct the solver to calculate the degree of freedom parameter that the link will achieve for the start of the next DHChain processing cycle, considering all given input velocities. This value can be used as a control value for link movement stepper motors (instead of SolvedTheta or SolvedD, which do not take the input velocities into account) to better minimize the position correction lag in moving kinematic systems, like holding some steady position on moving platforms or precisely following some moving target. When there are no input velocities given PredictedTheta or PredictedD will be calculated equal to SolvedTheta or SolvedD correspondingly. |

CalculatedThetaSpeed (for DHRevoluteLink) or CalculatedDSpeed (for DHPrismaticLink) argument | Can be added to instruct the solver to calculate the change speed for the corresponding degree of freedom parameter. See also DHChain Velocity Solving. The argument has also all parameters of proportional–integral–derivative regulator (see PIDRegulator for detailed description) to provide more responsive correction to the motor speed to eliminate the overshoot or delay effects in real-world chain motion. By default, the parameters are set to P=1, I=0, D=0 and R=1 to be used in the regulator instantly, without any integral or derivative correction applied. |

CalculatedVelocity port | Can be added to instruct the solver to calculate the link endpoint velocity i.e. movement speed in X, Y and Z axis direction. See also DHChain Velocity Solving. |

CalculatedAngularVelocity port | Can be added to instruct the solver to calculate the link endpoint angular velocity i.e. rotation speed and direction around the X, Y and Z axis. See also DHChain Velocity Solving. |

MaxSpeed argument | Maximum linear speed (in any direction) that this link end is allowed to move at maximum when instructed to be moved by some moving constraints or input velocity. All MaxSpeeds set to different links reduce the chain movement together so that no MaxSpeed set will be exceeded. |

MaxAcceleration argument | Maximum acceleration, at which the linear speed of this link is allowed to increase, in cases when the speed needs to be increased because of some constraints or some input velocity was changing. |

MaxDeceleration argument | Maximum deceleration, at which the linear speed of this link is allowed to decrease, in cases when the speed needs to be reduced because of some constraint position is about to reach or some input velocity was changing. When added to the links, that has position constraint, it will instruct the DHChain to start decreasing the speed before actually reaching the target. So, when set smaller than the hardware maximum available deceleration (that can be limited by hardware, system delays or inertia), then it avoids overshooting the target position while reaching. |

## Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.