Submitted version of the thesis - Airlab, the Artificial Intelligence ...
Submitted version of the thesis - Airlab, the Artificial Intelligence ...
Submitted version of the thesis - Airlab, the Artificial Intelligence ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
B.1. Microprocessor Code 109<br />
}<br />
Inverse(H, InvH);<br />
double position[3] = { 0, 0, 0 };<br />
double image_point[3] = { point.X, point.Y, 1 };<br />
vectorByMatrix3x1(InvH, image_point, position);<br />
result[0] = (s16) (position[0] / position[2]);<br />
result[1] = (s16) (position[1] / position[2]);<br />
result[2] = (s16) (position[2] / position[2]);<br />
void CalculateBallPosition(u8 X, u8 Y, u8 Dpx,<br />
double result[4]) {<br />
double image_point[3] = { X, Y, 1 };<br />
double inv_K[3][3] = { { 0.005216086284917, 0,<br />
-0.419160051539105 }, { 0, 0.005228129700905,<br />
-0.320361489617536 }, { 0, 0, 1 } };<br />
double position[3] = { 0, 0, 0 };<br />
vectorByMatrix3x1(inv_K, image_point, position);<br />
double norm;<br />
norm = sqrt((position[0] * position[0]) + (position[1]<br />
* position[1]) + (position[2] * position[2]));<br />
position[0] = position[0] / norm;<br />
position[1] = position[1] / norm;<br />
position[2] = position[2] / norm;<br />
int X_axis = 300;<br />
int Y_axis = -150;<br />
int Dreal = 62; //red ball w 6.2 cm diam<br />
double fstar = 160.9969;<br />
double Pc[4] = { (fstar * Dreal / Dpx) * position[0],<br />
(fstar * Dreal / Dpx) * position[1], (fstar<br />
* Dreal / Dpx) * position[2], 1 };<br />
double T_wr[4][4] = { { 1, 0, 0, X_axis }, { 0, 1, 0,<br />
Y_axis }, { 0, 0, 1, 0 }, { 0, 0, 0, 1 } };<br />
double T_wc[4][4] = { { 0.0012, -0.3587, 0.9334,<br />
-350.8669 }, { -1.0000, -0.0039, -0.0002,