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.

70 Chapter 6. Game<br />

s<strong>of</strong>tware or from <strong>the</strong> Matlab script taking samples from <strong>the</strong> environment in<br />

order to calculate <strong>the</strong> histogram to find <strong>the</strong> correct color coding. The color<br />

values found from <strong>the</strong> Matlab script should be tested with <strong>the</strong> ST color<br />

picker s<strong>of</strong>tware in order to check <strong>the</strong> correctness <strong>of</strong> <strong>the</strong> results.<br />

After <strong>the</strong> initialization phase completed, <strong>the</strong> main control loop starts.<br />

Beforeentering<strong>the</strong>maincontrolloop,<strong>the</strong>parameters, suchassearch direction,<br />

game end, color done, blob found etc., that are going to be used locally inside<br />

<strong>the</strong> main loop are set to initial values. The main loop starts by reading<br />

<strong>the</strong> values <strong>of</strong> <strong>the</strong> sensor data. Later, <strong>the</strong> ’color done’ status, which is controlling<br />

<strong>the</strong> target acquired condition. Initially, it is set as ’FALSE’, since<br />

<strong>the</strong> camera did not acquire any images. Before capturing any image, <strong>the</strong><br />

’control hit’ is checked to detect and clear <strong>the</strong> hit. Until no collision is<br />

detected, <strong>the</strong> capturing <strong>of</strong> <strong>the</strong> images will not start. After <strong>the</strong> capturing is<br />

complete, <strong>the</strong> blobs found with <strong>the</strong> correct color, if any, are sorted according<br />

to <strong>the</strong> <strong>the</strong>ir area, and <strong>the</strong> one with <strong>the</strong> maximum area is set as ’myBlob’.<br />

If no blob found in this step, ’myBlob’ is set to -1 to indicate no blob is<br />

found within constraints. The sign <strong>of</strong> <strong>the</strong> ’myBlob’ is controlled to check<br />

whe<strong>the</strong>r a blob is found or not. If no blob is found, ’blob found’ or ’counter’<br />

status is checked. This part is implemented so that to decrease <strong>the</strong> number<br />

<strong>of</strong> turns, for each time a blob is not found. Having <strong>the</strong> ’counter’ less <strong>the</strong>n<br />

3, we increment <strong>the</strong> counter, and do not perform any turns. In <strong>the</strong> case<br />

<strong>the</strong> ’counter’ is greater than 3 or ’blob found=FALSE’, we perform a turn<br />

around <strong>the</strong> center, and set <strong>the</strong> ’blob found=FALSE’. That mechanism enabled<br />

us to detect a target, that was not detected even if it is on side. Even<br />

if <strong>the</strong> target is on side and it is not detected for 3 times, we perform <strong>the</strong><br />

turn. To process blob, in ’myBlob’ parameter, <strong>the</strong> first step is controlling<br />

<strong>the</strong> camera position. Depending to <strong>the</strong> camera position, <strong>the</strong> position <strong>of</strong> <strong>the</strong><br />

target in real world is calculated. The motor contributions are calculated<br />

using ’Triskar’ function. According to <strong>the</strong> calculated position <strong>of</strong> <strong>the</strong> target<br />

<strong>the</strong> following cases is executed. If <strong>the</strong> camera is set to SERVO TOP and <strong>the</strong><br />

distance <strong>of</strong> <strong>the</strong> robot to <strong>the</strong> target is:<br />

• Greater than 1200 mm.<br />

The motor speeds from Triskar are set with multiplier FAST<br />

• Between 1200 mm and 700 mm.<br />

The motor speeds from Triskar are set with multiplier NORMAL<br />

• Less than 700 mm.<br />

The camera head position is changed to SERVO MID

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

Saved successfully!

Ooh no, something went wrong!