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 ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
68 Chapter 6. Game<br />
rect target is found, we calculate <strong>the</strong> distance <strong>of</strong> <strong>the</strong> object from <strong>the</strong> robot.<br />
According to <strong>the</strong> distance found, <strong>the</strong> motor contributions are calculated and<br />
<strong>the</strong> robot starts going to <strong>the</strong> target.<br />
We introduced two different camera head positions. At <strong>the</strong> start <strong>the</strong><br />
camera is always set at <strong>the</strong> normal position (which can see <strong>the</strong> environment<br />
from 750 mm from <strong>the</strong> robot up to 4-5 meters). According to <strong>the</strong> result<br />
<strong>of</strong> <strong>the</strong> distance calculated at <strong>the</strong> previous step, <strong>the</strong> camera head position<br />
maybe be lowered in order to detect and go to <strong>the</strong> target in <strong>the</strong> next step.<br />
The target is set as acquired when <strong>the</strong> distance between <strong>the</strong> robot and <strong>the</strong><br />
target is below a certain threshold. The whole algorithm we can be seen in<br />
Appendix A A.2 in a clear way.<br />
The s<strong>of</strong>tware that is running <strong>the</strong> robot is working on-board, on <strong>the</strong> microcontroller.<br />
The s<strong>of</strong>tware is divided into sub-modules in order to ease<br />
<strong>the</strong> development <strong>of</strong> <strong>the</strong> process. In this section, we will give <strong>the</strong> details <strong>of</strong><br />
<strong>the</strong> s<strong>of</strong>tware, introducing <strong>the</strong> sub-modules, supporting with <strong>the</strong> diagrams.<br />
The s<strong>of</strong>tware is composed <strong>of</strong> low-level and high-level modules. The lowlevel<br />
modules are <strong>the</strong> assembly code that is coming with <strong>the</strong> ST tool-chain,<br />
which already defines <strong>the</strong> registers, memory mappings, all <strong>the</strong> communications<br />
with <strong>the</strong> chips. We did not concentrate on <strong>the</strong> assembly code; all <strong>the</strong><br />
written s<strong>of</strong>tware implements <strong>the</strong> high level part.<br />
Thedevelopmentmainlyfocusedon<strong>the</strong>generation<strong>of</strong>PWMusingtimers,<br />
initialization <strong>of</strong> components, algorithms and utilities. Like all <strong>the</strong> microcontroller<br />
programs <strong>the</strong> core runs in <strong>the</strong> main loop. Before entering <strong>the</strong> main<br />
loop we initialize all <strong>the</strong> components first. Initialization is made step by<br />
step as follows:<br />
• Configure <strong>the</strong> system clocks<br />
• Configure <strong>the</strong> GPIO ports<br />
• Configure x24 Camera<br />
• Configure <strong>the</strong> USB<br />
• Initialize camera parameters<br />
• Initialize motors<br />
• Set initial camera position