==Overview==
Kinematics are part of the Coordinated Motion Library which is used by the GCode Interpreter. It provides a transformation from the desired CAD positions to the System's required Actuator positions to move there.
#include "Kinematics5AxisTableBC.h"</pre>
==Kinematics3Rod==
The first non-linear Kinematics that was added to the KMotion Libraries was the simple Kinematics3Rod class shown below. Given the XYZ CAD position it computes the necessary lengths of 3 "rod" type linear actuators to place the end effector at the desired CAD location. Also below is a old video of it in operation.
</pre>
{{#ev:youtube|MV42zmiT_4I}} ==A more complex 6 axis Kinematics (CKinematicsGeppetto)==
{{#ev:youtube|MSONYPXe3bE}}
==Alex's system with a Table A axis and Gimbal B axis (Kinematics5AxisTableAGimbalB.cpp)==
{{#ev:youtube|PuIdtZKdYfA}}
Here is the math. First the definitions:
[[File:TableAGimbalBDefs.png|none|link=]]
Origin Definition
[[File:TableAGimbalBOrigin.png|none|link=]]
The Solution
[[File:TableAGimbalBSolution.png|none|link=]]
The code:
<pre class="brush:c">// Kienematics for Table with A Axis and Tool Gimble head with B Axis
//
// A axis always rotates about X axis
// B axis always rotates about Y axis
int CKinematics5AxisTableAGimbalB::TransformCADtoActuators(double x, double y, double z, double a, double b, double c, double *Acts, bool NoGeo)
{
double Xt, Yt, Zt, Xa, Ya, Za, ToolXR, ToolZR, ChuckXR, ChuckZR, Dummy;
if (m_MotionParams.TCP_Active)
{
//Find CAD Tool Tip Location from coordinate passed in (Xt, Yt, Zt)
Xt = x - m_MotionParams.TCP_X; // remove tool offset
Yt = y - m_MotionParams.TCP_Y;
Zt = z - m_MotionParams.TCP_Z;
//Perform A rotation to obtain (Xa, Ya, Za)
Rotate3(0, 0, 0, Xt, Yt, Zt, a, 0, 0, &Xa, &Ya, &Za);
//Determine ChuckXR ChuckZR by rotating PivotChuckLength by Angle B
Rotate3(0, 0, 0, 0, 0, PivotToChuckLength, 0, -b, 0, &ChuckXR, &Dummy, &ChuckZR);
//Determine Rotated Tool offset ToolXR ToolZR by rotating ToolX ToolZ by Angle B
Rotate3(0, 0, 0, m_MotionParams.TCP_X, m_MotionParams.TCP_Y, m_MotionParams.TCP_Z, 0, -b, 0, &ToolXR, &Dummy, &ToolZR);
x = Xa + ToolXR + ChuckXR;
y = Ya;
z = Za + ToolZR + ChuckZR - PivotToChuckLength;
}
if (!NoGeo) GeoCorrect(x,y,z,&x,&y, &z);
Acts[0] = x*m_MotionParams.CountsPerInchX;
Acts[1] = y*m_MotionParams.CountsPerInchY;
Acts[2] = z*m_MotionParams.CountsPerInchZ;
Acts[3] = a*m_MotionParams.CountsPerInchA;
Acts[4] = b*m_MotionParams.CountsPerInchB;
Acts[5] = c*m_MotionParams.CountsPerInchC;
return 0;
}
</pre>