14.11.2012 Views

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 ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

90 Appendix B. Documentation <strong>of</strong> <strong>the</strong> programming<br />

*/<br />

if (search_direction == TRUE) {<br />

Turn(RIGHT);<br />

} else {<br />

Turn(LEFT);<br />

}<br />

blob_found = FALSE;<br />

}<br />

} else {<br />

/*<br />

* search direction is reversed<br />

*/<br />

search_direction = !search_direction;<br />

/*<br />

* controlling if <strong>the</strong> blob is with <strong>the</strong> correct color<br />

*/<br />

blob_found = TRUE;<br />

counter = 0;<br />

n_point.X = Blobs[myBlob].Centroid.X;<br />

n_point.Y<br />

= Blobs[myBlob].OuterBox.Bottom;<br />

s16 position[3];<br />

/*<br />

* for different camera positions different<br />

* calibrations and motion mechanism is used<br />

*/<br />

if (cam_position == SERVO_TOP) {<br />

CalculatePositionTop(n_point,<br />

position);<br />

#ifdef NO_DEBUG<br />

Print_Int(n_point.X,"X in cam coordinates");<br />

Print_Int(n_point.Y,"Y in cam coordinates");<br />

Print_Int(position[0],"X in real coordinates");<br />

Print_Int(position[1],"Y in real coordinates");<br />

#endif<br />

double alpha = 0;<br />

alpha = atan2(position[1],<br />

position[0]);<br />

s8 omega_modifid = alpha * 100;<br />

Triskar(position , omega_modifid,<br />

speed);<br />

if (Abs(position[0]) > 1200) {<br />

speed[2] = speed[2] / 2;<br />

Set_Speed(speed, FAR);<br />

} else if (Abs(position[0]) > 700) {

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!