DHChain - Denavit-Hartenberg Parameter Kinematic Chain
DHChain is a CDP component that can be added to the CDP application in order to simulate the behavior of kinematic link chains.
DHChain allows constructing kinematic chains from different DHLinks that are configured using Denavit–Hartenberg (also called DH) parameters and an unlimited number of constraints (including loops) between links.
Modeled DHChain can then be used in running CDP system for:
- forward calculating the chain end position (Cartesian) coordinates based on the freely changeable (degree of freedom) parameters of the links
- inverse calculating the links freely changeable (degree of freedom) parameters based on chain end (or some other constraint) (Cartesian) coordinates
- calculating the link movement speeds and endpoint velocities based on given speeds of constraints
DHChain has the following configuration properties:
|StartingDoF||string||Orientation of first link degree of freedom (X, Y or Z axis). Defaults to Z axis.|
|CalculationsPerCycle||unsigned||Number of kinematic calculation iterations to run during one processing cycle of the component. Kinematic solving of the link positions can take many calculation iterations and therefore a lot of CPU time. This property allows limiting the number of calculations that will be done in one processing cycle of the DHChain component. Defaults to 100. Should be decreased when DHChain is used on a controller with a weaker CPU. Note, that the processing cycle frequency can be adjusted using the fs property of the DHChain component.|
|CalculationPrecision||double||Maximum position constraint error tolerance allowed during kinematic solving. Inverse calculation cycles will be finished with success when all constraints are satisfied with a variance less than this value. Defaults to 0.0000000001. Can be increased to be closer to the actual movement precision that the modeled mechanical system provides, thereby reducing the CPU time needed by cutting off the unnecessary high-precision calculations.|
DHChain calculation state can be observed at runtime via these read-only properties:
|Unsolved||bool||Will be true, when the chain kinematics solver has link positions calculation pending or their constraints or limits are not satisfied yet|
|UnsolvedReason||string||When Unsolved is true, describes in what state the kinematics solver calculation is currently in|
|PropagateUnsolved||bool||When set, will cause link positions (i.e. their degree of freedom parameters and end positions and rotations) to be propagated after every calculation cycle, even when all constraints or limits are not satisfied yet|
Also, an unlimited number of position, angle and velocity ports can be added to the DHChain:
- Position - position in Cartesian coordinates in X, Y and Z direction
- Angles - rotation in radians around X, Y and Z axes
- Velocity - linear velocity i.e. movement speed in X, Y and Z direction
- AngularVelocity - angular velocity i.e. rotation speed around X, Y and Z axis
- MovingPosition - position with rotation angles, linear and angular velocities
Depending on the Input property and Routing connectivity these ports are used as follows:
|Input property value||Routed to or from||Position purpose||Description|
|true||Routed to one or multiple DHLink(s)||Start Position||Used to visualize and bring out the beginning of the DHChain i.e. link(s) routed from it should be considered as the DHChain starting link(s). Can also be used to set the beginning coordinate or angle of the first link of the DHChain to be different than the DHChain default X=0, Y=0 and Z=0 position.|
|true||Routed to one or multiple DHLink ConstraintPort||Constraint Position||Used for inverse kinematics calculations, i.e. forcing the kinematic solver to find the degree of freedom parameters for the DHChain links so that the routed DHLink end would be at this position or angle.|
|false||Routed from some DHLink Position or CalculatedPosition||Link end position||Used to visualize and bring out specific link position to the DHChain level. Typically this is added to DHLink whose end is considered as the DHChain end position.|
Kinematic position solving takes place in every DHChain component Process() cycle. Solving takes all DHlink input positions and checks if all configured constraints and joint limits are satisfied. If not, the solver tries to alter (reposition) the DHLinks by changing their given (input) degree of freedom parameters until the links are positioned so that all configured constraints and joint limits are satisfied. After that, the solver propagates the found values to every link output (i.e. solved) degree of freedom parameter. Also, the solver will update the link end position coordinates and rotation (i.e. link transformation) to SolvedPosition and SolvedRotation ports.
When DHLink constraints or joint limits are conflicting (i.e. solver can not find any way to position DHLinks so that all constraints and all limits are satisfied), then the Unsolved property is set together with the UnsolvedReason property, explaining the problem.
As the position solving is CPU intensive, DHChain will not do a recalculation of the positions until some link parameter or position constraint value changes.
When the DHChain has loops configured (i.e. some links have Loop Constraint set) then the solver tries to find the position for the link degree of freedom parameters so that looped link end positions would be exactly in the same place.
When some of the looped chain links have a degree of freedom parameter given as output (i.e. the parameter Input property is set to 0), then the solver will do an extra solving pass to move these freely movable links first to the positions where configured looped link end positions would be exactly at the same position (without considering any other target position constraint). This allows configuring of freely moving bearings or sliders that are not driven by any motor but rather move to the position depending on other, motor-driven joints.