1 package com.neuronrobotics.replicator.driver.delta;
3 import com.neuronrobotics.sdk.addons.kinematics.math.RotationNR;
4 import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR;
29 private double sqrt3 = Math.sqrt(3.0);
32 private double pi = Math.PI;
61 throw new RuntimeException(
"Angle hit toggle point: "+input[i] );
63 double theta1 = Math.toRadians(input[0]);
64 double theta2 = Math.toRadians(input[1]);
65 double theta3 = Math.toRadians(input[2]);
68 double y1 = -(t +
getRf()*Math.cos(theta1));
69 double z1 = -
getRf()*Math.sin(theta1);
71 double y2 = (t +
getRf()*Math.cos(theta2))*
sin30;
73 double z2 = -
getRf()*Math.sin(theta2);
75 double y3 = (t +
getRf()*Math.cos(theta3))*
sin30;
76 double x3 = -y3*
tan60;
77 double z3 = -
getRf()*Math.sin(theta3);
79 double dnm = (y2-y1)*x3-(y3-y1)*x2;
81 double w1 = y1*y1 + z1*z1;
82 double w2 = x2*x2 + y2*y2 + z2*z2;
83 double w3 = x3*x3 + y3*y3 + z3*z3;
86 double a1 = (z2-z1)*(y3-y1)-(z3-z1)*(y2-y1);
87 double b1 = -((w2-w1)*(y3-y1)-(w3-w1)*(y2-y1))/2.0;
90 double a2 = -(z2-z1)*x3+(z3-z1)*x2;
91 double b2 = ((w2-w1)*x3 - (w3-w1)*x2)/2.0;
94 double a = a1*a1 + a2*a2 + dnm*dnm;
95 double b = 2*(a1*b1 + a2*(b2-y1*dnm) - z1*dnm*dnm);
96 double c = (b2-y1*dnm)*(b2-y1*dnm) + b1*b1 + dnm*dnm*(z1*z1 -
getRe()*
getRe());
99 double d = b*b - (double)4.0*a*c;
100 if (d < 0)
return null;
102 z0 = -(double)0.5*(b+Math.sqrt(d))/a;
103 x0 = (a1*z0 + b1)/dnm;
104 y0 = (a2*z0 + b2)/dnm;
122 double y1 = -0.5 * 0.57735 *
getF();
123 y0 -= 0.5 * 0.57735 *
getE();
126 double b = (y1-y0)/z0;
130 throw new RuntimeException(
"Out Of Workspace! Inverse kinematics failed, D < 0");
131 double yj = (y1 - a*b - Math.sqrt(d))/(b*b + 1);
132 double zj = a + b*yj;
133 theta = Math.atan(-zj/(y1 - yj)) + ((yj>y1)?180.0:0.0);
146 double theta1, theta2, theta3;
147 double x0 = input.
getX();
148 double y0 = input.
getY();
149 double z0 = input.
getZ();
153 theta1 = theta2 = theta3 = 0;
157 return new double[] {Math.toDegrees(theta1),Math.toDegrees(theta2),Math.toDegrees(theta3)};
166 return configuration.
getE();
175 return configuration.
getF();
184 return configuration.
getRe();
193 return configuration.
getRf();
DeltaRobotKinematics(DeltaRobotConfig config)
double delta_calcAngleYZ(double x0, double y0, double z0)
double[] delta_calcInverse(TransformNR input)
TransformNR delta_calcForward(double[] input)