summaryrefslogtreecommitdiffstats
path: root/source/Concept
diff options
context:
space:
mode:
authorsicarius <devnull@localhost>2007-02-26 22:25:01 +0100
committersicarius <devnull@localhost>2007-02-26 22:25:01 +0100
commitf61eb900879fe941460a284ff9e4681b0958b944 (patch)
treee32e6e091b0d025e071f3eab1dbf52c04d107d1d /source/Concept
parent343397ecf6e8ba9ca94fc61e27c241139eff120b (diff)
downloadrc2007-soccer-f61eb900879fe941460a284ff9e4681b0958b944.tar
rc2007-soccer-f61eb900879fe941460a284ff9e4681b0958b944.zip
SoccerTeam, Stuff from Magdeburg
Diffstat (limited to 'source/Concept')
-rw-r--r--source/Concept/Framework/RoboCode.aps2
-rw-r--r--source/Concept/Framework/default/Makefile10
-rw-r--r--source/Concept/Framework/defines.h46
-rwxr-xr-xsource/Concept/Framework/main.c165
-rwxr-xr-xsource/Concept/Framework/modules/executor/navigator.c6
-rwxr-xr-xsource/Concept/Framework/modules/executor/navigator.h15
-rwxr-xr-xsource/Concept/Framework/modules/input/mouse_sensor.h10
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/ball_tracker.c15
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/ball_tracker.h7
-rw-r--r--source/Concept/Framework/modules/interpreter/command_handler.c170
-rw-r--r--source/Concept/Framework/modules/interpreter/command_handler.h17
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/position_tracker.c16
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/position_tracker.h14
-rwxr-xr-xsource/Concept/Framework/modules/logic/logic.c257
-rwxr-xr-xsource/Concept/Framework/modules/logic/logic.h23
-rwxr-xr-xsource/Concept/Framework/robot.c8
-rw-r--r--source/Concept/Framework/stdafx.h1
17 files changed, 663 insertions, 119 deletions
diff --git a/source/Concept/Framework/RoboCode.aps b/source/Concept/Framework/RoboCode.aps
index ca29afc..2219005 100644
--- a/source/Concept/Framework/RoboCode.aps
+++ b/source/Concept/Framework/RoboCode.aps
@@ -1 +1 @@
-<AVRStudio><MANAGEMENT><ProjectName>RoboCode</ProjectName><Created>16-Feb-2007 15:16:46</Created><LastEdit>22-Feb-2007 19:27:13</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>16-Feb-2007 15:16:46</Created><Version>4</Version><Build>4, 12, 0, 462</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\RoboCode.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>Y:\Concept\Framework\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET></CURRENT_TARGET><CURRENT_PART></CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM></COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>modules\io_module.c</SOURCEFILE><SOURCEFILE>atmega128io.c</SOURCEFILE><SOURCEFILE>main.c</SOURCEFILE><SOURCEFILE>robot.c</SOURCEFILE><SOURCEFILE>tools.c</SOURCEFILE><SOURCEFILE>modules\input\distance_sensor.c</SOURCEFILE><SOURCEFILE>modules\input\ir_sensor.c</SOURCEFILE><SOURCEFILE>modules\input\keyboard.c</SOURCEFILE><SOURCEFILE>modules\input\mouse_sensor.c</SOURCEFILE><SOURCEFILE>modules\input\sensor.c</SOURCEFILE><SOURCEFILE>modules\interpreter\position_tracker.c</SOURCEFILE><SOURCEFILE>modules\output\display.c</SOURCEFILE><SOURCEFILE>modules\output\dribbler.c</SOURCEFILE><SOURCEFILE>modules\output\engine.c</SOURCEFILE><SOURCEFILE>modules\output\kicker.c</SOURCEFILE><SOURCEFILE>modules\output\led.c</SOURCEFILE><SOURCEFILE>modules\interpreter\ball_tracker.c</SOURCEFILE><SOURCEFILE>modules\executor\navigator.c</SOURCEFILE><SOURCEFILE>modules\executor\aktuator.c</SOURCEFILE><SOURCEFILE>modules\wireless.c</SOURCEFILE><SOURCEFILE>modules\logic\logic.c</SOURCEFILE><HEADERFILE>stdafx.h</HEADERFILE><HEADERFILE>tools.h</HEADERFILE><HEADERFILE>atmega128io.h</HEADERFILE><HEADERFILE>defines.h</HEADERFILE><HEADERFILE>robot.h</HEADERFILE><HEADERFILE>modules\input\distance_sensor.h</HEADERFILE><HEADERFILE>modules\input\ir_sensor.h</HEADERFILE><HEADERFILE>modules\input\keyboard.h</HEADERFILE><HEADERFILE>modules\input\mouse_sensor.h</HEADERFILE><HEADERFILE>modules\input\sensor.h</HEADERFILE><HEADERFILE>modules\output\display.h</HEADERFILE><HEADERFILE>modules\output\dribbler.h</HEADERFILE><HEADERFILE>modules\output\engine.h</HEADERFILE><HEADERFILE>modules\output\kicker.h</HEADERFILE><HEADERFILE>modules\output\led.h</HEADERFILE><HEADERFILE>modules\interpreter\position_tracker.h</HEADERFILE><HEADERFILE>modules\io_module.h</HEADERFILE><HEADERFILE>modules\interpreter\ball_tracker.h</HEADERFILE><HEADERFILE>modules\executor\navigator.h</HEADERFILE><HEADERFILE>modules\executor\aktuator.h</HEADERFILE><HEADERFILE>modules\wireless.h</HEADERFILE><HEADERFILE>modules\logic\logic.h</HEADERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega128</PART><HEX>1</HEX><LIST>0</LIST><MAP>0</MAP><OUTPUTFILENAME>RoboCode.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS><OPTION><FILE>atmega128io.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>main.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\executor\navigator.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\input\distance_sensor.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\input\ir_sensor.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\input\keyboard.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\input\mouse_sensor.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\input\sensor.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\interpreter\ball_tracker.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\interpreter\position_tracker.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\io_module.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\output\display.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\output\dribbler.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\output\engine.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\output\kicker.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\output\led.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>robot.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>tools.c</FILE><OPTIONLIST></OPTIONLIST></OPTION></OPTIONS><INCDIRS><INCLUDE>modules\</INCLUDE><INCLUDE>modules\executor\</INCLUDE><INCLUDE>modules\input\</INCLUDE><INCLUDE>modules\interpreter\</INCLUDE><INCLUDE>modules\logic\</INCLUDE><INCLUDE>modules\output\</INCLUDE></INCDIRS><LIBDIRS/><LIBS><LIB>libm.a</LIB></LIBS><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -DF_CPU=16000000ULUL -O3 -fsigned-char</OPTIONSFORALL><LINKEROPTIONS>-lm</LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>0</USES_WINAVR><GCC_LOC>C:\WinAVR\bin\avr-g++.exe</GCC_LOC><MAKE_LOC>C:\WinAVR\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><ProjectFiles><Files><Name>Y:\Concept\Framework\stdafx.h</Name><Name>Y:\Concept\Framework\tools.h</Name><Name>Y:\Concept\Framework\atmega128io.h</Name><Name>Y:\Concept\Framework\defines.h</Name><Name>Y:\Concept\Framework\robot.h</Name><Name>Y:\Concept\Framework\modules\input\distance_sensor.h</Name><Name>Y:\Concept\Framework\modules\input\ir_sensor.h</Name><Name>Y:\Concept\Framework\modules\input\keyboard.h</Name><Name>Y:\Concept\Framework\modules\input\mouse_sensor.h</Name><Name>Y:\Concept\Framework\modules\input\sensor.h</Name><Name>Y:\Concept\Framework\modules\output\display.h</Name><Name>Y:\Concept\Framework\modules\output\dribbler.h</Name><Name>Y:\Concept\Framework\modules\output\engine.h</Name><Name>Y:\Concept\Framework\modules\output\kicker.h</Name><Name>Y:\Concept\Framework\modules\output\led.h</Name><Name>Y:\Concept\Framework\modules\interpreter\position_tracker.h</Name><Name>Y:\Concept\Framework\modules\io_module.h</Name><Name>Y:\Concept\Framework\modules\interpreter\ball_tracker.h</Name><Name>Y:\Concept\Framework\modules\executor\navigator.h</Name><Name>Y:\Concept\Framework\modules\executor\aktuator.h</Name><Name>Y:\Concept\Framework\modules\wireless.h</Name><Name>Y:\Concept\Framework\modules\logic\logic.h</Name><Name>Y:\Concept\Framework\modules\io_module.c</Name><Name>Y:\Concept\Framework\atmega128io.c</Name><Name>Y:\Concept\Framework\main.c</Name><Name>Y:\Concept\Framework\robot.c</Name><Name>Y:\Concept\Framework\tools.c</Name><Name>Y:\Concept\Framework\modules\input\distance_sensor.c</Name><Name>Y:\Concept\Framework\modules\input\ir_sensor.c</Name><Name>Y:\Concept\Framework\modules\input\keyboard.c</Name><Name>Y:\Concept\Framework\modules\input\mouse_sensor.c</Name><Name>Y:\Concept\Framework\modules\input\sensor.c</Name><Name>Y:\Concept\Framework\modules\interpreter\position_tracker.c</Name><Name>Y:\Concept\Framework\modules\output\display.c</Name><Name>Y:\Concept\Framework\modules\output\dribbler.c</Name><Name>Y:\Concept\Framework\modules\output\engine.c</Name><Name>Y:\Concept\Framework\modules\output\kicker.c</Name><Name>Y:\Concept\Framework\modules\output\led.c</Name><Name>Y:\Concept\Framework\modules\interpreter\ball_tracker.c</Name><Name>Y:\Concept\Framework\modules\executor\navigator.c</Name><Name>Y:\Concept\Framework\modules\executor\aktuator.c</Name><Name>Y:\Concept\Framework\modules\wireless.c</Name><Name>Y:\Concept\Framework\modules\logic\logic.c</Name></Files></ProjectFiles><Files><File00000><FileId>00000</FileId><FileName>stdafx.h</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>defines.h</FileName><Status>1</Status></File00001><File00002><FileId>00002</FileId><FileName>robot.h</FileName><Status>1</Status></File00002><File00003><FileId>00003</FileId><FileName>atmega128io.h</FileName><Status>1</Status></File00003><File00004><FileId>00004</FileId><FileName>tools.h</FileName><Status>1</Status></File00004><File00005><FileId>00005</FileId><FileName>modules\interpreter\position_tracker.h</FileName><Status>1</Status></File00005><File00006><FileId>00006</FileId><FileName>modules\io_module.h</FileName><Status>1</Status></File00006><File00007><FileId>00007</FileId><FileName>modules\output\display.h</FileName><Status>1</Status></File00007><File00008><FileId>00008</FileId><FileName>modules\input\ir_sensor.h</FileName><Status>1</Status></File00008><File00009><FileId>00009</FileId><FileName>modules\output\engine.h</FileName><Status>1</Status></File00009><File00010><FileId>00010</FileId><FileName>modules\input\sensor.h</FileName><Status>1</Status></File00010><File00011><FileId>00011</FileId><FileName>modules\input\keyboard.h</FileName><Status>1</Status></File00011><File00012><FileId>00012</FileId><FileName>modules\io_module.c</FileName><Status>1</Status></File00012><File00013><FileId>00013</FileId><FileName>robot.c</FileName><Status>1</Status></File00013><File00014><FileId>00014</FileId><FileName>modules\input\ir_sensor.c</FileName><Status>1</Status></File00014><File00015><FileId>00015</FileId><FileName>modules\output\dribbler.h</FileName><Status>1</Status></File00015><File00016><FileId>00016</FileId><FileName>modules\output\kicker.h</FileName><Status>1</Status></File00016><File00017><FileId>00017</FileId><FileName>modules\output\led.h</FileName><Status>1</Status></File00017><File00018><FileId>00018</FileId><FileName>modules\input\distance_sensor.h</FileName><Status>1</Status></File00018><File00019><FileId>00019</FileId><FileName>modules\input\mouse_sensor.h</FileName><Status>1</Status></File00019><File00020><FileId>00020</FileId><FileName>modules\input\sensor.c</FileName><Status>1</Status></File00020><File00021><FileId>00021</FileId><FileName>main.c</FileName><Status>1</Status></File00021><File00022><FileId>00022</FileId><FileName>modules\interpreter\ball_tracker.h</FileName><Status>1</Status></File00022><File00023><FileId>00023</FileId><FileName>modules\interpreter\ball_tracker.c</FileName><Status>1</Status></File00023><File00024><FileId>00024</FileId><FileName>modules\interpreter\position_tracker.c</FileName><Status>1</Status></File00024><File00025><FileId>00025</FileId><FileName>modules\input\distance_sensor.c</FileName><Status>1</Status></File00025><File00026><FileId>00026</FileId><FileName>modules\output\engine.c</FileName><Status>1</Status></File00026><File00027><FileId>00027</FileId><FileName>modules\output\dribbler.c</FileName><Status>1</Status></File00027><File00028><FileId>00028</FileId><FileName>modules\executor\navigator.h</FileName><Status>1</Status></File00028><File00029><FileId>00029</FileId><FileName>modules\executor\navigator.c</FileName><Status>1</Status></File00029><File00030><FileId>00030</FileId><FileName>modules\output\display.c</FileName><Status>1</Status></File00030><File00031><FileId>00031</FileId><FileName>modules\input\mouse_sensor.c</FileName><Status>1</Status></File00031><File00032><FileId>00032</FileId><FileName>c:\WinAVR\avr\include\math.h</FileName><Status>1</Status></File00032><File00033><FileId>00033</FileId><FileName>modules\executor\aktuator.h</FileName><Status>1</Status></File00033><File00034><FileId>00034</FileId><FileName>modules\executor\aktuator.c</FileName><Status>1</Status></File00034><File00035><FileId>00035</FileId><FileName>modules\wireless.h</FileName><Status>1</Status></File00035><File00036><FileId>00036</FileId><FileName>modules\wireless.c</FileName><Status>1</Status></File00036><File00037><FileId>00037</FileId><FileName>atmega128io.c</FileName><Status>1</Status></File00037><File00038><FileId>00038</FileId><FileName>modules\logic\logic.c</FileName><Status>1</Status></File00038><File00039><FileId>00039</FileId><FileName>modules\logic\logic.h</FileName><Status>1</Status></File00039><File00040><FileId>00040</FileId><FileName>modules\output\kicker.c</FileName><Status>1</Status></File00040></Files><Workspace><File00000><Position>291 79 1017 560</Position><LineCol>25 0</LineCol></File00000><File00001><Position>282 66 1016 547</Position><LineCol>68 0</LineCol></File00001><File00002><Position>33038 32853 33638 33099</Position><LineCol>7 0</LineCol></File00002><File00003><Position>33038 32853 33638 33099</Position><LineCol>201 10</LineCol></File00003><File00004><Position>33038 32853 33638 33099</Position><LineCol>17 0</LineCol></File00004><File00005><Position>33038 32853 33638 33099</Position><LineCol>43 47</LineCol></File00005><File00006><Position>32267 32083 32993 32538</Position><LineCol>8 0</LineCol></File00006><File00007><Position>33038 32853 33764 33308</Position><LineCol>84 0</LineCol></File00007><File00008><Position>33038 32853 33638 33099</Position><LineCol>40 33</LineCol></File00008><File00009><Position>32364 32225 32990 32526</Position><LineCol>66 18</LineCol></File00009><File00010><Position>32276 32109 32906 32414</Position><LineCol>23 0</LineCol></File00010><File00011><Position>32301 32140 32931 32445</Position><LineCol>55 0</LineCol></File00011><File00012><Position>32323 32169 32953 32474</Position><LineCol>1 0</LineCol></File00012><File00013><Position>32345 32198 32975 32503</Position><LineCol>96 16</LineCol></File00013><File00014><Position>32367 32227 32997 32532</Position><LineCol>9 0</LineCol></File00014><File00015><Position>32279 32111 32909 32416</Position><LineCol>102 0</LineCol></File00015><File00016><Position>32301 32140 32931 32445</Position><LineCol>68 0</LineCol></File00016><File00017><Position>32323 32169 32953 32474</Position><LineCol>1 0</LineCol></File00017><File00018><Position>291 72 1025 553</Position><LineCol>56 32</LineCol><State>Maximized</State></File00018><File00019><Position>279 64 1005 519</Position><LineCol>199 15</LineCol></File00019><File00020><Position>32279 32111 32909 32416</Position><LineCol>1 0</LineCol></File00020><File00021><Position>273 60 999 515</Position><LineCol>219 5</LineCol></File00021><File00022><Position>32323 32169 32953 32474</Position><LineCol>27 0</LineCol></File00022><File00023><Position>267 56 993 511</Position><LineCol>31 4</LineCol></File00023><File00024><Position>288 70 1022 551</Position><LineCol>47 27</LineCol></File00024><File00025><Position>285 68 1019 549</Position><LineCol>52 31</LineCol></File00025><File00026><Position>32301 32140 32931 32445</Position><LineCol>1 0</LineCol></File00026><File00027><Position>32323 32169 32953 32474</Position><LineCol>1 0</LineCol></File00027><File00028><Position>32345 32198 32975 32503</Position><LineCol>63 0</LineCol></File00028><File00029><Position>276 62 1002 517</Position><LineCol>176 0</LineCol></File00029><File00030><Position>280 92 910 397</Position><LineCol>0 0</LineCol></File00030><File00031><Position>302 121 932 426</Position><LineCol>0 0</LineCol></File00031><File00032><Position>330 154 946 456</Position><LineCol>167 0</LineCol></File00032><File00033><Position>355 185 971 487</Position><LineCol>17 0</LineCol></File00033><File00034><Position>377 214 993 516</Position><LineCol>11 0</LineCol></File00034><File00035><Position>399 243 1015 545</Position><LineCol>48 0</LineCol></File00035><File00036><Position>289 98 905 400</Position><LineCol>1 0</LineCol></File00036><File00037><Position>311 127 927 429</Position><LineCol>657 43</LineCol></File00037><File00038><Position>333 156 949 458</Position><LineCol>23 19</LineCol></File00038><File00039><Position>355 185 971 487</Position><LineCol>28 7</LineCol></File00039><File00040><Position>377 214 993 516</Position><LineCol>1 0</LineCol></File00040></Workspace><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
+<AVRStudio><MANAGEMENT><ProjectName>RoboCode</ProjectName><Created>16-Feb-2007 15:16:46</Created><LastEdit>24-Feb-2007 18:46:56</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>16-Feb-2007 15:16:46</Created><Version>4</Version><Build>4, 12, 0, 462</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\RoboCode.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>Z:\rc2007-soccer\source\Concept\Framework\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET></CURRENT_TARGET><CURRENT_PART></CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM></COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>modules\io_module.c</SOURCEFILE><SOURCEFILE>atmega128io.c</SOURCEFILE><SOURCEFILE>main.c</SOURCEFILE><SOURCEFILE>robot.c</SOURCEFILE><SOURCEFILE>tools.c</SOURCEFILE><SOURCEFILE>modules\input\distance_sensor.c</SOURCEFILE><SOURCEFILE>modules\input\ir_sensor.c</SOURCEFILE><SOURCEFILE>modules\input\keyboard.c</SOURCEFILE><SOURCEFILE>modules\input\mouse_sensor.c</SOURCEFILE><SOURCEFILE>modules\input\sensor.c</SOURCEFILE><SOURCEFILE>modules\interpreter\position_tracker.c</SOURCEFILE><SOURCEFILE>modules\output\display.c</SOURCEFILE><SOURCEFILE>modules\output\dribbler.c</SOURCEFILE><SOURCEFILE>modules\output\engine.c</SOURCEFILE><SOURCEFILE>modules\output\kicker.c</SOURCEFILE><SOURCEFILE>modules\output\led.c</SOURCEFILE><SOURCEFILE>modules\interpreter\ball_tracker.c</SOURCEFILE><SOURCEFILE>modules\executor\navigator.c</SOURCEFILE><SOURCEFILE>modules\executor\aktuator.c</SOURCEFILE><SOURCEFILE>modules\wireless.c</SOURCEFILE><SOURCEFILE>modules\logic\logic.c</SOURCEFILE><SOURCEFILE>modules\interpreter\command_handler.c</SOURCEFILE><SOURCEFILE>modules\interpreter\obstacle_tracker.c</SOURCEFILE><HEADERFILE>stdafx.h</HEADERFILE><HEADERFILE>tools.h</HEADERFILE><HEADERFILE>atmega128io.h</HEADERFILE><HEADERFILE>defines.h</HEADERFILE><HEADERFILE>robot.h</HEADERFILE><HEADERFILE>modules\input\distance_sensor.h</HEADERFILE><HEADERFILE>modules\input\ir_sensor.h</HEADERFILE><HEADERFILE>modules\input\keyboard.h</HEADERFILE><HEADERFILE>modules\input\mouse_sensor.h</HEADERFILE><HEADERFILE>modules\input\sensor.h</HEADERFILE><HEADERFILE>modules\output\display.h</HEADERFILE><HEADERFILE>modules\output\dribbler.h</HEADERFILE><HEADERFILE>modules\output\engine.h</HEADERFILE><HEADERFILE>modules\output\kicker.h</HEADERFILE><HEADERFILE>modules\output\led.h</HEADERFILE><HEADERFILE>modules\interpreter\position_tracker.h</HEADERFILE><HEADERFILE>modules\io_module.h</HEADERFILE><HEADERFILE>modules\interpreter\ball_tracker.h</HEADERFILE><HEADERFILE>modules\executor\navigator.h</HEADERFILE><HEADERFILE>modules\executor\aktuator.h</HEADERFILE><HEADERFILE>modules\wireless.h</HEADERFILE><HEADERFILE>modules\logic\logic.h</HEADERFILE><HEADERFILE>modules\interpreter\command_handler.h</HEADERFILE><HEADERFILE>modules\interpreter\obstacle_tracker.h</HEADERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega128</PART><HEX>1</HEX><LIST>0</LIST><MAP>0</MAP><OUTPUTFILENAME>RoboCode.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS><OPTION><FILE>atmega128io.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>main.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\executor\aktuator.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\executor\navigator.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\input\distance_sensor.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\input\ir_sensor.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\input\keyboard.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\input\mouse_sensor.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\input\sensor.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\interpreter\ball_tracker.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\interpreter\command_handler.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\interpreter\position_tracker.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\io_module.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\logic\logic.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\output\display.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\output\dribbler.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\output\engine.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\output\kicker.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\output\led.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>modules\wireless.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>robot.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>tools.c</FILE><OPTIONLIST></OPTIONLIST></OPTION></OPTIONS><INCDIRS><INCLUDE>modules\</INCLUDE><INCLUDE>modules\executor\</INCLUDE><INCLUDE>modules\input\</INCLUDE><INCLUDE>modules\interpreter\</INCLUDE><INCLUDE>modules\logic\</INCLUDE><INCLUDE>modules\output\</INCLUDE></INCDIRS><LIBDIRS/><LIBS><LIB>libm.a</LIB></LIBS><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -DF_CPU=16000000ULUL -O3 -fsigned-char</OPTIONSFORALL><LINKEROPTIONS>-lm</LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>0</USES_WINAVR><GCC_LOC>C:\Programme\dev\WinAVR\bin\avr-g++.exe</GCC_LOC><MAKE_LOC>C:\Programme\dev\WinAVR\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><ProjectFiles><Files><Name>Z:\rc2007-soccer\source\Concept\Framework\stdafx.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\tools.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\atmega128io.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\defines.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\robot.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\input\distance_sensor.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\input\ir_sensor.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\input\keyboard.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\input\mouse_sensor.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\input\sensor.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\output\display.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\output\dribbler.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\output\engine.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\output\kicker.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\output\led.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\interpreter\position_tracker.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\io_module.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\interpreter\ball_tracker.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\executor\navigator.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\executor\aktuator.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\wireless.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\logic\logic.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\interpreter\command_handler.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\interpreter\obstacle_tracker.h</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\io_module.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\atmega128io.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\main.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\robot.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\tools.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\input\distance_sensor.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\input\ir_sensor.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\input\keyboard.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\input\mouse_sensor.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\input\sensor.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\interpreter\position_tracker.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\output\display.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\output\dribbler.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\output\engine.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\output\kicker.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\output\led.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\interpreter\ball_tracker.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\executor\navigator.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\executor\aktuator.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\wireless.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\logic\logic.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\interpreter\command_handler.c</Name><Name>Z:\rc2007-soccer\source\Concept\Framework\modules\interpreter\obstacle_tracker.c</Name></Files></ProjectFiles><Files><File00000><FileId>00000</FileId><FileName>stdafx.h</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>defines.h</FileName><Status>1</Status></File00001><File00002><FileId>00002</FileId><FileName>robot.h</FileName><Status>1</Status></File00002><File00003><FileId>00003</FileId><FileName>atmega128io.h</FileName><Status>1</Status></File00003><File00004><FileId>00004</FileId><FileName>tools.h</FileName><Status>1</Status></File00004><File00005><FileId>00005</FileId><FileName>modules\interpreter\position_tracker.h</FileName><Status>1</Status></File00005><File00006><FileId>00006</FileId><FileName>modules\io_module.h</FileName><Status>1</Status></File00006><File00007><FileId>00007</FileId><FileName>modules\output\display.h</FileName><Status>1</Status></File00007><File00008><FileId>00008</FileId><FileName>modules\input\ir_sensor.h</FileName><Status>1</Status></File00008><File00009><FileId>00009</FileId><FileName>modules\output\engine.h</FileName><Status>1</Status></File00009><File00010><FileId>00010</FileId><FileName>modules\input\sensor.h</FileName><Status>1</Status></File00010><File00011><FileId>00011</FileId><FileName>modules\input\keyboard.h</FileName><Status>1</Status></File00011><File00012><FileId>00012</FileId><FileName>modules\io_module.c</FileName><Status>1</Status></File00012><File00013><FileId>00013</FileId><FileName>robot.c</FileName><Status>1</Status></File00013><File00014><FileId>00014</FileId><FileName>modules\input\ir_sensor.c</FileName><Status>1</Status></File00014><File00015><FileId>00015</FileId><FileName>modules\output\dribbler.h</FileName><Status>1</Status></File00015><File00016><FileId>00016</FileId><FileName>modules\output\kicker.h</FileName><Status>1</Status></File00016><File00017><FileId>00017</FileId><FileName>modules\output\led.h</FileName><Status>1</Status></File00017><File00018><FileId>00018</FileId><FileName>modules\input\distance_sensor.h</FileName><Status>1</Status></File00018><File00019><FileId>00019</FileId><FileName>modules\input\mouse_sensor.h</FileName><Status>1</Status></File00019><File00020><FileId>00020</FileId><FileName>modules\input\sensor.c</FileName><Status>1</Status></File00020><File00021><FileId>00021</FileId><FileName>main.c</FileName><Status>1</Status></File00021><File00022><FileId>00022</FileId><FileName>modules\interpreter\ball_tracker.h</FileName><Status>1</Status></File00022><File00023><FileId>00023</FileId><FileName>modules\interpreter\ball_tracker.c</FileName><Status>1</Status></File00023><File00024><FileId>00024</FileId><FileName>modules\interpreter\position_tracker.c</FileName><Status>1</Status></File00024><File00025><FileId>00025</FileId><FileName>modules\input\distance_sensor.c</FileName><Status>1</Status></File00025><File00026><FileId>00026</FileId><FileName>modules\output\engine.c</FileName><Status>1</Status></File00026><File00027><FileId>00027</FileId><FileName>modules\output\dribbler.c</FileName><Status>1</Status></File00027><File00028><FileId>00028</FileId><FileName>modules\executor\navigator.h</FileName><Status>1</Status></File00028><File00029><FileId>00029</FileId><FileName>modules\executor\navigator.c</FileName><Status>1</Status></File00029><File00030><FileId>00030</FileId><FileName>modules\output\display.c</FileName><Status>1</Status></File00030><File00031><FileId>00031</FileId><FileName>modules\input\mouse_sensor.c</FileName><Status>1</Status></File00031><File00032><FileId>00032</FileId><FileName>modules\executor\aktuator.h</FileName><Status>1</Status></File00032><File00033><FileId>00033</FileId><FileName>modules\executor\aktuator.c</FileName><Status>1</Status></File00033><File00034><FileId>00034</FileId><FileName>modules\wireless.h</FileName><Status>1</Status></File00034><File00035><FileId>00035</FileId><FileName>modules\wireless.c</FileName><Status>1</Status></File00035><File00036><FileId>00036</FileId><FileName>atmega128io.c</FileName><Status>1</Status></File00036><File00037><FileId>00037</FileId><FileName>modules\logic\logic.c</FileName><Status>1</Status></File00037><File00038><FileId>00038</FileId><FileName>modules\logic\logic.h</FileName><Status>1</Status></File00038><File00039><FileId>00039</FileId><FileName>modules\output\kicker.c</FileName><Status>1</Status></File00039><File00040><FileId>00040</FileId><FileName>modules\interpreter\command_handler.c</FileName><Status>1</Status></File00040><File00041><FileId>00041</FileId><FileName>modules\interpreter\command_handler.h</FileName><Status>1</Status></File00041><File00042><FileId>00042</FileId><FileName>modules\interpreter\obstacle_tracker.h</FileName><Status>1</Status></File00042><File00043><FileId>00043</FileId><FileName>modules\interpreter\obstacle_tracker.c</FileName><Status>1</Status></File00043><File00044><FileId>00044</FileId><FileName>modules\input\keyboard.c</FileName><Status>1</Status></File00044><File00045><FileId>00045</FileId><FileName>modules\output\led.c</FileName><Status>1</Status></File00045></Files><Workspace><File00000><Position>376 84 1102 565</Position><LineCol>24 0</LineCol></File00000><File00001><Position>352 56 1086 537</Position><LineCol>64 0</LineCol></File00001><File00002><Position>32997 32843 33597 33089</Position><LineCol>7 0</LineCol></File00002><File00003><Position>32997 32843 33597 33089</Position><LineCol>201 0</LineCol></File00003><File00004><Position>32997 32843 33597 33089</Position><LineCol>17 0</LineCol></File00004><File00005><Position>32997 32843 33597 33089</Position><LineCol>55 0</LineCol></File00005><File00006><Position>32337 32073 33063 32528</Position><LineCol>8 0</LineCol></File00006><File00007><Position>32997 32843 33723 33298</Position><LineCol>189 0</LineCol></File00007><File00008><Position>32997 32843 33597 33089</Position><LineCol>40 0</LineCol></File00008><File00009><Position>32434 32215 33060 32516</Position><LineCol>66 0</LineCol></File00009><File00010><Position>32346 32099 32976 32404</Position><LineCol>23 0</LineCol></File00010><File00011><Position>32371 32130 33001 32435</Position><LineCol>55 0</LineCol></File00011><File00012><Position>32393 32159 33023 32464</Position><LineCol>1 0</LineCol></File00012><File00013><Position>32415 32188 33045 32493</Position><LineCol>98 0</LineCol></File00013><File00014><Position>32437 32217 33067 32522</Position><LineCol>9 0</LineCol></File00014><File00015><Position>32349 32101 32979 32406</Position><LineCol>102 0</LineCol></File00015><File00016><Position>32371 32130 33001 32435</Position><LineCol>68 0</LineCol></File00016><File00017><Position>32393 32159 33023 32464</Position><LineCol>1 0</LineCol></File00017><File00018><Position>361 62 1095 543</Position><LineCol>56 0</LineCol></File00018><File00019><Position>349 54 1075 509</Position><LineCol>51 0</LineCol></File00019><File00020><Position>32349 32101 32979 32406</Position><LineCol>1 0</LineCol></File00020><File00021><Position>232 72 1025 550</Position><LineCol>230 69</LineCol><State>Maximized</State></File00021><File00022><Position>32393 32159 33023 32464</Position><LineCol>27 0</LineCol></File00022><File00023><Position>337 46 1063 501</Position><LineCol>139 0</LineCol></File00023><File00024><Position>358 60 1092 541</Position><LineCol>79 0</LineCol></File00024><File00025><Position>355 58 1089 539</Position><LineCol>52 0</LineCol></File00025><File00026><Position>32371 32130 33001 32435</Position><LineCol>1 0</LineCol></File00026><File00027><Position>32393 32159 33023 32464</Position><LineCol>1 0</LineCol></File00027><File00028><Position>32415 32188 33045 32493</Position><LineCol>81 0</LineCol></File00028><File00029><Position>346 52 1072 507</Position><LineCol>28 0</LineCol></File00029><File00030><Position>350 82 980 387</Position><LineCol>0 0</LineCol></File00030><File00031><Position>372 111 1002 416</Position><LineCol>0 0</LineCol></File00031><File00032><Position>400 144 1016 446</Position><LineCol>27 0</LineCol></File00032><File00033><Position>425 175 1041 477</Position><LineCol>11 0</LineCol></File00033><File00034><Position>447 204 1063 506</Position><LineCol>40 0</LineCol></File00034><File00035><Position>469 233 1085 535</Position><LineCol>1 0</LineCol></File00035><File00036><Position>359 88 975 390</Position><LineCol>1 0</LineCol></File00036><File00037><Position>381 117 997 419</Position><LineCol>28 0</LineCol></File00037><File00038><Position>403 146 1019 448</Position><LineCol>30 0</LineCol></File00038><File00039><Position>425 175 1041 477</Position><LineCol>1 0</LineCol></File00039><File00040><Position>447 204 1063 506</Position><LineCol>160 0</LineCol></File00040><File00041><Position>363 66 873 379</Position><LineCol>53 0</LineCol></File00041><File00042><Position>230 98 874 415</Position><LineCol>40 0</LineCol></File00042><File00043><Position>252 127 896 444</Position><LineCol>83 0</LineCol></File00043><File00044><Position>274 156 918 473</Position><LineCol>1 0</LineCol></File00044><File00045><Position>299 187 974 486</Position><LineCol>1 0</LineCol></File00045></Workspace><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
diff --git a/source/Concept/Framework/default/Makefile b/source/Concept/Framework/default/Makefile
index 0411c61..e34755b 100644
--- a/source/Concept/Framework/default/Makefile
+++ b/source/Concept/Framework/default/Makefile
@@ -34,13 +34,13 @@ HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0
## Include Directories
-INCLUDES = -I"Y:\Concept\Framework\modules" -I"Y:\Concept\Framework\modules\executor" -I"Y:\Concept\Framework\modules\input" -I"Y:\Concept\Framework\modules\interpreter" -I"Y:\Concept\Framework\modules\logic" -I"Y:\Concept\Framework\modules\output"
+INCLUDES = -I"Z:\rc2007-soccer\source\Concept\Framework\modules" -I"Z:\rc2007-soccer\source\Concept\Framework\modules\executor" -I"Z:\rc2007-soccer\source\Concept\Framework\modules\input" -I"Z:\rc2007-soccer\source\Concept\Framework\modules\interpreter" -I"Z:\rc2007-soccer\source\Concept\Framework\modules\logic" -I"Z:\rc2007-soccer\source\Concept\Framework\modules\output"
## Libraries
LIBS = -lm
## Objects that must be built in order to link
-OBJECTS = io_module.o atmega128io.o main.o robot.o tools.o distance_sensor.o ir_sensor.o keyboard.o mouse_sensor.o sensor.o position_tracker.o display.o dribbler.o engine.o kicker.o led.o ball_tracker.o navigator.o aktuator.o wireless.o logic.o
+OBJECTS = io_module.o atmega128io.o main.o robot.o tools.o distance_sensor.o ir_sensor.o keyboard.o mouse_sensor.o sensor.o position_tracker.o display.o dribbler.o engine.o kicker.o led.o ball_tracker.o navigator.o aktuator.o wireless.o logic.o command_handler.o obstacle_tracker.o
## Objects explicitly added by the user
LINKONLYOBJECTS =
@@ -112,6 +112,12 @@ wireless.o: ../modules/wireless.c
logic.o: ../modules/logic/logic.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
+command_handler.o: ../modules/interpreter/command_handler.c
+ $(CC) $(INCLUDES) $(CFLAGS) -c $<
+
+obstacle_tracker.o: ../modules/interpreter/obstacle_tracker.c
+ $(CC) $(INCLUDES) $(CFLAGS) -c $<
+
##Link
$(TARGET): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)
diff --git a/source/Concept/Framework/defines.h b/source/Concept/Framework/defines.h
index 596126d..a86282c 100644
--- a/source/Concept/Framework/defines.h
+++ b/source/Concept/Framework/defines.h
@@ -60,6 +60,9 @@
#define DISTANCE_PER_VALUE 1
#define TICKS_PER_CM 205.0f
//#define TICKS_PER_CM 90.0f
+#define ULTRASONIC_PER_CM 2.0f
+
+#define WIRELESS_ACTIVE false
#define PI 3.14159265358979323846f
#define CYCLES_PER_CORRECTION 20
@@ -67,8 +70,39 @@
#define BALL_HELD_INTENSITY 900
+#define KEEPER_LEFT_ANGLE 20.0f * PI / 180.0f
+#define KEEPER_RIGHT_ANGLE (2 * PI) - (20.0f * PI / 180.0f)
+
#define COMMAND_BUFFER_SIZE 20
+#define DEFAULT_SPEED 200
+#define DEFAULT_ROTATION_SPEED 200
+
+#define AREA_BOUNDS_X 20000.0f
+#define AREA_BOUNDS_Y 5000.0f
+
+#define WALL_DISTANCE_TOLERANCE 30.0f
+#define ENEMY_ROBOT_RADIUS 40.0f
+
+#define HOME_LOC_X -500.0f
+#define HOME_LOC_Y 0
+#define ENEMY_LOC_X 500.0f
+#define ENEMY_LOC_Y 0
+#define DEFENCE_L_LOC_X -500.0f
+#define DEFENCE_L_LOC_Y 70.0f
+#define DEFENCE_R_LOC_X -500.0f
+#define DEFENCE_R_LOC_Y -70.0f
+
+#define DISTANCE_TOLERANCE 1.0f
+#define ORIENTATION_TOLERANCE 0.1f
+
+#define MAX_OBSTACLE_COUNT 20
+
+#define OBSTACLE_DECAY 100
+
+#define BALL_DIRECTION_FRONT_L 45.0f * PI / 180.0f
+#define BALL_DIRECTION_FRONT_R 315.0f * PI / 180.0f
+
#define WIRELESS_CODE "SPASS!"
enum WirelessCommands
{
@@ -183,9 +217,17 @@ enum IOModuleNames
IO_POSITION_TRACKER_END,
- //Position Tracker
+ //Obstacle Tracker
+
+ IO_OBSTACLE_TRACKER_START = IO_POSITION_TRACKER_END,
+
+ IO_OBSTACLE_TRACKER_MAIN,
+
+ IO_OBSTACLE_TRACKER_END,
+
+ //Ball Tracker
- IO_BALL_TRACKER_START = IO_POSITION_TRACKER_END,
+ IO_BALL_TRACKER_START = IO_OBSTACLE_TRACKER_END,
IO_BALL_TRACKER_MAIN,
diff --git a/source/Concept/Framework/main.c b/source/Concept/Framework/main.c
index ba0e280..27edce3 100755
--- a/source/Concept/Framework/main.c
+++ b/source/Concept/Framework/main.c
@@ -130,6 +130,14 @@ int main()
newCommandHandler = NULL;
}
+ //Init Obstacle Tracker
+ for(uint8 i = IO_OBSTACLE_TRACKER_START; i < IO_OBSTACLE_TRACKER_END; i++)
+ {
+ Obstacle_Tracker* newObstacleTracker = new Obstacle_Tracker(i);
+ localRobot->AddModule(newObstacleTracker);
+ newObstacleTracker = NULL;
+ }
+
//Init Position Tracker
for(uint8 i = IO_POSITION_TRACKER_START; i < IO_POSITION_TRACKER_END; i++)
{
@@ -179,33 +187,62 @@ int main()
Command_Handler* ourCommandHandler = localRobot->GetModule<Command_Handler>(IO_COMMAND_HANDLER_MAIN);
uint32 i = 1;
Navigator* ourNavigator = localRobot->GetModule<Navigator>(IO_NAVIGATOR_MAIN);
- Position_Tracker* ourPosition_Tracker = localRobot->GetModule<Position_Tracker>(IO_POSITION_TRACKER_MAIN);
+ Position_Tracker* ourPositionTracker = localRobot->GetModule<Position_Tracker>(IO_POSITION_TRACKER_MAIN);
Ball_Tracker* ourBallTracker = localRobot->GetModule<Ball_Tracker>(IO_BALL_TRACKER_MAIN);
Dribbler* ourDribbler = localRobot->GetModule<Dribbler>(IO_DRIBBLER_MAIN);
- ourDribbler->SetSpeed(1);
- ourDribbler->SetEnabled(true);
+ //ourDribbler->SetSpeed(1);
+ //ourDribbler->SetEnabled(true);
Aktuator* ourAktuator = localRobot->GetModule<Aktuator>(IO_AKTUATOR_MAIN);
Logic* ourLogic = localRobot->GetModule<Logic>(IO_LOGIC_MAIN);
+ Wireless* ourWireless = localRobot->GetModule<Wireless>(IO_WIRELESS_MAIN);
- float rotation = 0;
- float speed = 200;
+ //(localRobot->GetModule<Engine>(IO_ENGINE_DRIVE_BACK))->SetSpeed(200);
- //Mouse_Sensor* mouse_left = localRobot->GetModule<Mouse_Sensor>(IO_SENSOR_MOUSE_LEFT);
- //Mouse_Sensor* mouse_right = localRobot->GetModule<Mouse_Sensor>(IO_SENSOR_MOUSE_RIGHT);
+ //(localRobot->GetModule<Engine>(IO_ENGINE_DRIVE_LEFT))->SetSpeed(200);
+ //(localRobot->GetModule<Engine>(IO_ENGINE_DRIVE_LEFT))->SetEnabled(true);
- ourDisplay->Clear();
+ //sleep(2);
+
+ //(localRobot->GetModule<Engine>(IO_ENGINE_DRIVE_RIGHT))->SetSpeed(200);
+ //(localRobot->GetModule<Engine>(IO_ENGINE_DRIVE_RIGHT))->SetEnabled(true);
+
+ //sleep(2);
+
+
+
+ //(localRobot->GetModule<Engine>(IO_ENGINE_DRIVE_LEFT))->SetSpeed(200);
+ //(localRobot->GetModule<Engine>(IO_ENGINE_DRIVE_LEFT))->SetEnabled(true);
+
+ /*(localRobot->GetModule<Dribbler>(IO_DRIBBLER_MAIN))->SetSpeed(200);
+ (localRobot->GetModule<Dribbler>(IO_DRIBBLER_MAIN))->SetEnabled(true);*/
+
+ /*(localRobot->GetModule<Engine>(IO_ENGINE_DRIVE_RIGHT))->SetSpeed(80);
+ (localRobot->GetModule<Engine>(IO_ENGINE_DRIVE_RIGHT))->SetEnabled(true);*/
+
+ (localRobot->GetModule<Engine>(IO_ENGINE_DRIVE_BACK))->SetSpeed(255);
+ (localRobot->GetModule<Engine>(IO_ENGINE_DRIVE_BACK))->SetEnabled(true);
+
+ (localRobot->GetModule<Engine>(IO_ENGINE_DRIVE_LEFT))->SetSpeed(255);
+ (localRobot->GetModule<Engine>(IO_ENGINE_DRIVE_LEFT))->SetEnabled(true);
+
+ sleep(2);
//Run
while(true)
{
- ourDisplay->Print(i++,1,1);
-
- //msleep(50);
-
- if(ourCommandHandler->displayDistanceSensors && !(i % 20))
+ i++;
+
+ /*if(!(i % 20))
{
ourDisplay->Clear();
+ msleep(10);
+ ourCommandHandler->PrintCommand();
+ }
+
+ localRobot->Update();
+ if(ourCommandHandler->displayDistanceSensors && !(i % 20))
+ {
distanceSensor = localRobot->GetModule<Distance_Sensor>(IO_SENSOR_DISTANCE_0_DEG);
value = distanceSensor->GetDistance();
ourDisplay->Print(value, 1, 4);
@@ -223,69 +260,43 @@ int main()
ourDisplay->Print(value);
ourDisplay->Print(";");
}
-
- /*uint8 someInput = ourKeyboard->GetInput();
- //ourDisplay->Print("Ready to accept...", 1, 2);
- switch(someInput)
+
+ if(ourCommandHandler->ticksPerCmOffset && !(i % 20))
{
- case 0:
- ourNavigator->Stop();
- return 0;
- break;
- case 1:
- ourNavigator->Drive(225, rotation, speed, rotation);
- break;
- case 2:
- ourNavigator->Drive(180, rotation, speed, rotation);
- break;
- case 3:
- ourNavigator->Drive(135, rotation, speed, rotation);
- break;
- case 4:
- ourNavigator->Drive(270, rotation, speed, rotation);
- break;
- case 5:
- ourNavigator->Drive(0, rotation, 0, rotation);
- break;
- case 6:
- ourNavigator->Drive(90, rotation, speed, rotation);
- break;
- case 7:
- ourNavigator->Drive(315, rotation, speed, rotation);
- break;
- case 8:
- ourNavigator->Drive(0, rotation, speed, rotation);
- break;
- case 9:
- ourNavigator->Drive(45, rotation, speed, rotation);
- break;
- case 10:
- ourPosition_Tracker->SetPosition(0,0,0); // Reset Position_Tracker
- break;
- case 11:
- ourLogic->SetKeeper(true); // Reset Position_Tracker
- break;
- }*/
-
- //ourDisplay->Clear();
- if(!(i % 20))
+ ourDisplay->Print(ourCommandHandler->ticksPerCmOffset * 10.0f, 10, 1);
+ }
+
+ if(ourCommandHandler->displayPositionTracker && !(i % 20))
+ {
+ ourDisplay->Print(ourPositionTracker->GetPositionX(), 1, 2);
+ ourDisplay->Print(ourPositionTracker->GetPositionY(), 1, 3);
+ ourDisplay->Print(ourPositionTracker->GetOrientation(), 1, 4);
+ }
+
+ if(ourCommandHandler->displayPositionTracker && !(i % 20))
+ {
+ ourDisplay->Print(ourPositionTracker->GetPositionX(), 1, 2);
+ ourDisplay->Print(ourPositionTracker->GetPositionY(), 1, 3);
+ ourDisplay->Print(ourPositionTracker->GetOrientation() * 180.0f / PI, 1, 4);
+ }
+
+ if(ourCommandHandler->displayBallTracker && !(i % 20))
{
- /*ourDisplay->Clear();
ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_0_DEG);
value = ourSensor->GetIRIntensity();
ourDisplay->Print(value, 1, 2);
ourDisplay->Print(";");
ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_30_DEG);
value = ourSensor->GetIRIntensity();
- ourDisplay->Print(value);
+ ourDisplay->Print(value, 6, 2);
ourDisplay->Print(";");
ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_60_DEG);
value = ourSensor->GetIRIntensity();
- ourDisplay->Print(value);
+ ourDisplay->Print(value, 11, 2);
ourDisplay->Print(";");
ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_100_DEG);
value = ourSensor->GetIRIntensity();
- ourDisplay->Print(value);
+ ourDisplay->Print(value, 16, 2);
ourDisplay->Print(";");
ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_180_DEG);
value = ourSensor->GetIRIntensity();
@@ -293,15 +304,15 @@ int main()
ourDisplay->Print(";");
ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_260_DEG);
value = ourSensor->GetIRIntensity();
- ourDisplay->Print(value);
+ ourDisplay->Print(value, 6, 3);
ourDisplay->Print(";");
ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_300_DEG);
value = ourSensor->GetIRIntensity();
- ourDisplay->Print(value);
+ ourDisplay->Print(value, 11, 3);
ourDisplay->Print(";");
ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_330_DEG);
value = ourSensor->GetIRIntensity();
- ourDisplay->Print(value);
+ ourDisplay->Print(value, 16, 3);
ourDisplay->Print(";");
if(ourBallTracker->KnowsBallDirection())
{
@@ -309,15 +320,27 @@ int main()
}
else
{
- ourDisplay->Print("Not found oder so", 1, 4);
- }*/
+ ourDisplay->Print("Ball not found", 1, 4);
+ }
+
+ if(ourBallTracker->HasBall()) {
+ ourDisplay->Print("Has Ball", 5, 4);
+ }
}
-
- localRobot->Update();
- //ourDisplay->Print(ourBallTracker->GetBallDirection() * 180.0f / PI, 1, 4);
+ //if(!(i % 20))
+ //{
+ // ourDisplay->Print(ourWireless->Recieve(), 10, 1);
+ //}
- //ourNavigator->Drive(ourBallTracker->GetBallDirection() * 180.0f / PI, 0, 255, 0);
+ if(ourBallTracker->KnowsBallDirection())
+ {
+ ourNavigator->Drive(ourBallTracker->GetBallDirection() * 180.0f / PI, 0, 255, 0);
+ }
+ else
+ {
+ ourNavigator->Stop();
+ }*/
}
//Cleanup
diff --git a/source/Concept/Framework/modules/executor/navigator.c b/source/Concept/Framework/modules/executor/navigator.c
index 7c4618a..8320eca 100755
--- a/source/Concept/Framework/modules/executor/navigator.c
+++ b/source/Concept/Framework/modules/executor/navigator.c
@@ -59,7 +59,7 @@ void Navigator::Drive(float newDirection, float newAngle, float newSpeed, float
//-----------------------------------------------------------------------------
void Navigator::DriveTo(float newX, float newY, float newAngle, float newSpeed, float rotationSpeed)
{
- if(newX < 0 || newY < 0) return;
+ if(newX == EMPTY_FLOAT || newY == EMPTY_FLOAT) return;
Position_Tracker* locationeer = parent->GetModule<Position_Tracker>(IO_POSITION_TRACKER_MAIN);
@@ -125,7 +125,7 @@ bool Navigator::TargetReached()
bool targetReached = false;
- if(!HasTarget() || (distance2d(targetX, targetY, locationeer->GetPositionX(), locationeer->GetPositionY()) < 1.0f))
+ if(!HasTarget() || (distance2d(targetX, targetY, locationeer->GetPositionX(), locationeer->GetPositionY()) < DISTANCE_TOLERANCE))
{
targetReached = true;
}
@@ -230,7 +230,7 @@ void Navigator::CalculateEngines()
vBack = ((float)vBack * (float)((float)this->robotSpeed / (float)speedCorrection)) + this->rotationSpeed;
vRight = ((float)vRight * (float)((float)this->robotSpeed / (float)speedCorrection)) + this->rotationSpeed;
- //(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(vLeft,10,2);
+ (parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(vBack,10,2);
//(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(vBack,10,3);
//(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(vRight,10,4);
diff --git a/source/Concept/Framework/modules/executor/navigator.h b/source/Concept/Framework/modules/executor/navigator.h
index 53fa74b..989bc04 100755
--- a/source/Concept/Framework/modules/executor/navigator.h
+++ b/source/Concept/Framework/modules/executor/navigator.h
@@ -67,6 +67,21 @@ public:
return (targetX != EMPTY_FLOAT && targetY != EMPTY_FLOAT);
}
+ float GetTargetX()
+ {
+ return targetX;
+ }
+
+ float GetTargetY()
+ {
+ return targetY;
+ }
+
+ float GetDirection()
+ {
+ return direction;
+ }
+
bool HasTargetAngle()
{
return (targetAngle != EMPTY_FLOAT);
diff --git a/source/Concept/Framework/modules/input/mouse_sensor.h b/source/Concept/Framework/modules/input/mouse_sensor.h
index b3d1b1a..1f2922a 100755
--- a/source/Concept/Framework/modules/input/mouse_sensor.h
+++ b/source/Concept/Framework/modules/input/mouse_sensor.h
@@ -214,6 +214,16 @@ public:
{
return positionY;
}
+
+ void AdjustPositionX(float newPosX)
+ {
+ this->positionX = newPosX;
+ }
+
+ void AdjustPositionY(float newPosY)
+ {
+ this->positionY = newPosY;
+ }
};
#endif
diff --git a/source/Concept/Framework/modules/interpreter/ball_tracker.c b/source/Concept/Framework/modules/interpreter/ball_tracker.c
index 16fdfb4..a882abb 100755
--- a/source/Concept/Framework/modules/interpreter/ball_tracker.c
+++ b/source/Concept/Framework/modules/interpreter/ball_tracker.c
@@ -3,6 +3,8 @@
//-----------------------------------------------------------------------------
void Ball_Tracker::Update()
{
+ Position_Tracker* ourPositionTracker = parent->GetModule<Position_Tracker>(IO_POSITION_TRACKER_MAIN);
+
uint8 sensorCount = (IO_SENSOR_IR_330_DEG - IO_SENSOR_IR_0_DEG) + 1;
uint16 intensity[sensorCount];
uint8 greatestIntensity = 0;
@@ -26,15 +28,12 @@ void Ball_Tracker::Update()
{
if(intensity[i] > BALL_HELD_INTENSITY) // Ball derzeit sehr nah dran
{
- ballHeld = true;
- ballHeldCounter = 100;
+ if(ballHeldCounter < 10) ballHeldCounter++;
}
- else if(ballHeldCounter > 0) // Oder vor kurzem erst sehr nah dran
+ else if(ballHeldCounter > 0)
{
- ballHeld = true;
ballHeldCounter--;
}
- else ballHeld = false; // ansonsten hat er den Ball nicht
}
}
@@ -132,13 +131,15 @@ void Ball_Tracker::Update()
direction = (intensity[greatestIntensity] * mainDirection +
intensity[secondIntensity] * secondDirection) /
(intensity[greatestIntensity] + intensity[secondIntensity]);
-
- direction = easyAngle(direction);
}
else
{
direction = mainDirection;
}
+
+ direction += ourPositionTracker->GetOrientation();
+
+ direction = easyAngle(direction);
}
else
{
diff --git a/source/Concept/Framework/modules/interpreter/ball_tracker.h b/source/Concept/Framework/modules/interpreter/ball_tracker.h
index cb90ff2..756a09f 100755
--- a/source/Concept/Framework/modules/interpreter/ball_tracker.h
+++ b/source/Concept/Framework/modules/interpreter/ball_tracker.h
@@ -12,7 +12,6 @@ public:
this->moduleId = 0;
this->direction = EMPTY_FLOAT;
this->ballHeldCounter = 0;
- this->ballHeld = false;
}
Ball_Tracker(uint32 trackerId)
@@ -21,13 +20,11 @@ public:
this->moduleId = trackerId;
this->direction = EMPTY_FLOAT;
this->ballHeldCounter = 0;
- this->ballHeld = false;
}
protected:
float direction;
uint8 ballHeldCounter;
- bool ballHeld;
public:
void Update();
@@ -42,9 +39,9 @@ public:
return (direction != EMPTY_FLOAT);
}
- bool RobotHasBall()
+ bool HasBall()
{
- return ballHeld;
+ return (ballHeldCounter >= 3);
}
};
diff --git a/source/Concept/Framework/modules/interpreter/command_handler.c b/source/Concept/Framework/modules/interpreter/command_handler.c
index 7d8937b..e2a9ba2 100644
--- a/source/Concept/Framework/modules/interpreter/command_handler.c
+++ b/source/Concept/Framework/modules/interpreter/command_handler.c
@@ -3,6 +3,7 @@
//-----------------------------------------------------------------------------
void Command_Handler::Update()
{
+ Display* ourDisplay = parent->GetModule<Display>(IO_DISPLAY_MAIN);
Keyboard* ourKeyboard = parent->GetModule<Keyboard>(IO_KEYBOARD_MAIN);
uint8 curInput = ourKeyboard->GetInput();
@@ -13,11 +14,20 @@ void Command_Handler::Update()
if(curInput == 10)
{
ExecuteCommand();
+
+ for(uint8 i = 0; i < this->currentCommandLength; i++)
+ {
+ this->buffer[i] = NULL;
+ ourDisplay->Print(" ", i + 1, 1);
+ }
+
+ this->currentCommandLength = 0;
}
else if(curInput == 11)
{
if(this->currentCommandLength > 0)
{
+ ourDisplay->Print(" ", this->currentCommandLength, 1);
this->currentCommandLength--;
this->buffer[currentCommandLength] = NULL;
}
@@ -28,6 +38,7 @@ void Command_Handler::Update()
{
this->buffer[this->currentCommandLength] = curInput;
this->currentCommandLength++;
+ ourDisplay->Print(curInput, this->currentCommandLength, 1);
}
}
@@ -38,8 +49,163 @@ void Command_Handler::Update()
//-----------------------------------------------------------------------------
void Command_Handler::ExecuteCommand()
{
- if(this->buffer[0] == 5)
+ if(this->buffer[0] == 1)
+ {
+ if(this->buffer[1] == 1)
+ {
+ this->displayDistanceSensors = true;
+ this->displayPositionTracker = false;
+ this->displayBallTracker = false;
+ this->displayMouseSensors = false;
+ }
+ else if(this->buffer[1] == 2)
+ {
+ this->displayDistanceSensors = false;
+ this->displayPositionTracker = true;
+ this->displayBallTracker = false;
+ this->displayMouseSensors = false;
+ }
+ else if(this->buffer[1] == 3)
+ {
+ this->displayDistanceSensors = false;
+ this->displayPositionTracker = false;
+ this->displayBallTracker = true;
+ this->displayMouseSensors = false;
+ }
+ else if(this->buffer[1] == 4)
+ {
+ this->displayDistanceSensors = false;
+ this->displayPositionTracker = false;
+ this->displayBallTracker = false;
+ this->displayMouseSensors = true;
+ }
+ else if(this->buffer[1] == 0)
+ {
+ this->displayDistanceSensors = false;
+ this->displayPositionTracker = false;
+ this->displayBallTracker = false;
+ this->displayMouseSensors = false;
+ }
+ }
+ else if(this->buffer[0] == 2)
+ {
+ Logic* ourLogic = parent->GetModule<Logic>(IO_LOGIC_MAIN);
+ if(this->buffer[1] == 1)
+ {
+ ourLogic->SetKeeper(true);
+ }
+ else if(this->buffer[1] == 2)
+ {
+ ourLogic->SetKeeper(false);
+ }
+ }
+ else if(this->buffer[0] == 3)
+ {
+ if(this->buffer[1] == 1)
+ {
+ Navigator* ourNavigator = parent->GetModule<Navigator>(IO_NAVIGATOR_MAIN);
+ ourNavigator->RotateTo(180, 200);
+ }
+ else if(this->buffer[1] == 2)
+ {
+ Aktuator* ourAktuator = parent->GetModule<Aktuator>(IO_AKTUATOR_MAIN);
+ ourAktuator->Kick();
+ }
+ else if(this->buffer[1] == 3)
+ {
+ Navigator* ourNavigator = parent->GetModule<Navigator>(IO_NAVIGATOR_MAIN);
+ ourNavigator->RotateTo(float(buffer[2]) * 100.0f + float(buffer[3]) * 10.0f + float(buffer[4]), 200);
+ }
+ else if(this->buffer[1] == 4)
+ {
+ Mouse_Sensor* ourLeftMouse = parent->GetModule<Mouse_Sensor>(IO_SENSOR_MOUSE_LEFT);
+ Mouse_Sensor* ourRightMouse = parent->GetModule<Mouse_Sensor>(IO_SENSOR_MOUSE_RIGHT);
+
+ this->ticksPerCmOffset += 2.5f;
+ ourLeftMouse->AdjustPositionX(-3.88f * (TICKS_PER_CM + this->ticksPerCmOffset));
+ ourLeftMouse->AdjustPositionY(-3.88f * (TICKS_PER_CM + this->ticksPerCmOffset));
+ ourRightMouse->AdjustPositionX(-3.88f * (TICKS_PER_CM + this->ticksPerCmOffset));
+ ourRightMouse->AdjustPositionY(3.88f * (TICKS_PER_CM + this->ticksPerCmOffset));
+ }
+ else if(this->buffer[1] == 5)
+ {
+ Mouse_Sensor* ourLeftMouse = parent->GetModule<Mouse_Sensor>(IO_SENSOR_MOUSE_LEFT);
+ Mouse_Sensor* ourRightMouse = parent->GetModule<Mouse_Sensor>(IO_SENSOR_MOUSE_RIGHT);
+
+ this->ticksPerCmOffset -= 2.5f;
+ ourLeftMouse->AdjustPositionX(-3.88f * (TICKS_PER_CM + this->ticksPerCmOffset));
+ ourLeftMouse->AdjustPositionY(-3.88f * (TICKS_PER_CM + this->ticksPerCmOffset));
+ ourRightMouse->AdjustPositionX(-3.88f * (TICKS_PER_CM + this->ticksPerCmOffset));
+ ourRightMouse->AdjustPositionY(3.88f * (TICKS_PER_CM + this->ticksPerCmOffset));
+ }
+ }
+ else if(this->buffer[0] == 4)
+ {
+ Navigator* ourNavigator = parent->GetModule<Navigator>(IO_NAVIGATOR_MAIN);
+ int16 speed = 200;
+ switch(this->buffer[1])
+ {
+ case 1:
+ ourNavigator->Drive(225, 0, speed, 0);
+ break;
+ case 2:
+ ourNavigator->Drive(180, 0, speed, 0);
+ break;
+ case 3:
+ ourNavigator->Drive(135, 0, speed, 0);
+ break;
+ case 4:
+ ourNavigator->Drive(270, 0, speed, 0);
+ break;
+ case 5:
+ ourNavigator->Rotate(DEFAULT_ROTATION_SPEED);
+ break;
+ case 6:
+ ourNavigator->Drive(90, 0, speed, 0);
+ break;
+ case 7:
+ ourNavigator->Drive(315, 0, speed, 0);
+ break;
+ case 8:
+ ourNavigator->Drive(0, 0, speed, 0);
+ break;
+ case 9:
+ ourNavigator->Drive(45, 0, speed, 0);
+ break;
+ case 0:
+ ourNavigator->Stop();
+ break;
+ }
+ }
+ else if(this->buffer[0] == 5)
+ {
+ Position_Tracker* ourPositionTracker = parent->GetModule<Position_Tracker>(IO_POSITION_TRACKER_MAIN);
+ if(this->buffer[1] == 1)
+ {
+ ourPositionTracker->SetPosition(float(), ourPositionTracker->GetPositionY(), ourPositionTracker->GetOrientation());
+ }
+ else if(this->buffer[1] == 0)
+ {
+ ourPositionTracker->SetPosition(0, 0, 0);
+ }
+ }
+ else if(this->buffer[0] == 6)
+ {
+ if(this->buffer[1] == 1)
+ {
+ Wireless* ourWireless = parent->GetModule<Wireless>(IO_WIRELESS_MAIN);
+ ourWireless->Send("Heyho!");
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+void Command_Handler::PrintCommand()
+{
+ Display* ourDisplay = parent->GetModule<Display>(IO_DISPLAY_MAIN);
+
+ for(uint8 i = 0; i < currentCommandLength; i++)
{
- this->displayDistanceSensors = true;
+ ourDisplay->Print(this->buffer[i], i + 1, 1);
}
}
diff --git a/source/Concept/Framework/modules/interpreter/command_handler.h b/source/Concept/Framework/modules/interpreter/command_handler.h
index c3bc5bb..f376e96 100644
--- a/source/Concept/Framework/modules/interpreter/command_handler.h
+++ b/source/Concept/Framework/modules/interpreter/command_handler.h
@@ -12,6 +12,10 @@ public:
this->moduleId = 0;
this->currentCommandLength = 0;
this->displayDistanceSensors = false;
+ this->displayPositionTracker = false;
+ this->displayBallTracker = false;
+ this->displayMouseSensors = false;
+ this->ticksPerCmOffset = 0;
for(uint8 i = 0; i < COMMAND_BUFFER_SIZE; i++)
{
@@ -25,6 +29,10 @@ public:
this->moduleId = commandHandlerId;
this->currentCommandLength = 0;
this->displayDistanceSensors = false;
+ this->displayPositionTracker = false;
+ this->displayBallTracker = false;
+ this->displayMouseSensors = false;
+ this->ticksPerCmOffset = 0;
for(uint8 i = 0; i < COMMAND_BUFFER_SIZE; i++)
{
@@ -39,10 +47,17 @@ protected:
void ExecuteCommand();
public:
- void Update();
+ void Update();
+
+ void PrintCommand();
//Command variables
bool displayDistanceSensors;
+ bool displayPositionTracker;
+ bool displayBallTracker;
+ bool displayMouseSensors;
+
+ float ticksPerCmOffset;
};
#endif
diff --git a/source/Concept/Framework/modules/interpreter/position_tracker.c b/source/Concept/Framework/modules/interpreter/position_tracker.c
index f6d67ac..fab8085 100755
--- a/source/Concept/Framework/modules/interpreter/position_tracker.c
+++ b/source/Concept/Framework/modules/interpreter/position_tracker.c
@@ -3,6 +3,9 @@
//-----------------------------------------------------------------------------
void Position_Tracker::Update()
{
+ Command_Handler* ourCommandHandler = parent->GetModule<Command_Handler>(IO_COMMAND_HANDLER_MAIN);
+ Display* ourDisplay = parent->GetModule<Display>(IO_DISPLAY_MAIN);
+
// We want to use the mouse-sensors
Mouse_Sensor* mouseLeft = parent->GetModule<Mouse_Sensor>(IO_SENSOR_MOUSE_LEFT);
Mouse_Sensor* mouseRight = parent->GetModule<Mouse_Sensor>(IO_SENSOR_MOUSE_RIGHT);
@@ -40,6 +43,14 @@ void Position_Tracker::Update()
movementRightY = 0;
}
+ if(ourCommandHandler->displayMouseSensors)
+ {
+ ourDisplay->Print(movementLeftX, 1, 2);
+ ourDisplay->Print(movementLeftY, 10, 2);
+ ourDisplay->Print(movementRightX, 1, 3);
+ ourDisplay->Print(movementRightY, 10, 3);
+ }
+
// Generate vector from P:left to P:right
float movementDifferenceX = movementRightX - movementLeftX;
float movementDifferenceY = (movementRightY + mouseRight->GetPositionY()) - (movementLeftY + mouseLeft->GetPositionY());
@@ -47,6 +58,11 @@ void Position_Tracker::Update()
// Calculate the difference of orientation
float orientationDiff = atan2(movementDifferenceY, movementDifferenceX) - (PI / 2.0f);
+ if(ourCommandHandler->displayMouseSensors)
+ {
+ ourDisplay->Print(orientationDiff * 180.0f / PI, 1, 4);
+ }
+
float robotMovementX = movementDifferenceX / 2.0f;
float robotMovementY = movementDifferenceY / 2.0f;
robotMovementX += movementLeftX + mouseLeft->GetPositionX() + (-mouseLeft->GetPositionX() * cos(orientationDiff));
diff --git a/source/Concept/Framework/modules/interpreter/position_tracker.h b/source/Concept/Framework/modules/interpreter/position_tracker.h
index 56b16c4..7a5781f 100755
--- a/source/Concept/Framework/modules/interpreter/position_tracker.h
+++ b/source/Concept/Framework/modules/interpreter/position_tracker.h
@@ -40,18 +40,20 @@ public:
}
// returns x-koordinate in mm
- int GetPositionX() {
- return (int)((positionX*10.0f)/TICKS_PER_CM);
+ int16 GetPositionX()
+ {
+ return (int16)((positionX*10.0f)/TICKS_PER_CM);
}
// returns y-koordinate in mm
- int GetPositionY() {
- return (int)((positionY*10.0f)/TICKS_PER_CM);
+ int16 GetPositionY()
+ {
+ return (int16)((positionY*10.0f)/TICKS_PER_CM);
}
// returns orientation
- float GetOrientation() {
- //return 0.0f; //tmp!!!!!!!!!!
+ float GetOrientation()
+ {
return orientation;
}
};
diff --git a/source/Concept/Framework/modules/logic/logic.c b/source/Concept/Framework/modules/logic/logic.c
index f698495..239e426 100755
--- a/source/Concept/Framework/modules/logic/logic.c
+++ b/source/Concept/Framework/modules/logic/logic.c
@@ -3,16 +3,51 @@
//-----------------------------------------------------------------------------
void Logic::OnBallOwned()
{
+ bool wasKeeper = this->IsKeeper();
+
this->SetKeeper(false);
+
+ if(!WIRELESS_ACTIVE)
+ {
+ Aktuator* ourAktuator = parent->GetModule<Aktuator>(IO_AKTUATOR_MAIN);
+
+ ourAktuator->Kick();
+ this->SetKeeper(wasKeeper);
+ }
}
//-----------------------------------------------------------------------------
void Logic::OnBallLost()
{
- Wireless* ourWireless = parent->GetModule<Wireless>(IO_WIRELESS_MAIN);
- //ourWireless->Send(WIRELESS_CODE);
- //ourWireless->Send();
+}
+
+//-----------------------------------------------------------------------------
+void Logic::OnBecomeKeeper()
+{
+ Position_Tracker* ourPositionTracker = parent->GetModule<Position_Tracker>(IO_POSITION_TRACKER_MAIN);
+ Navigator* ourNavigator = parent->GetModule<Navigator>(IO_NAVIGATOR_MAIN);
+
+ if(distance2d(HOME_LOC_X, HOME_LOC_Y, ourPositionTracker->GetPositionX(), ourPositionTracker->GetPositionY()) > DISTANCE_TOLERANCE)
+ {
+ status = STATUS_KEEPER_RETURN_HOME;
+
+ ourNavigator->DriveTo(HOME_LOC_X, HOME_LOC_Y, ourPositionTracker->GetOrientation(), DEFAULT_SPEED, 0);
+ }
+ else
+ {
+ UpdateKeeperMovement();
+ }
+}
+
+//-----------------------------------------------------------------------------
+void Logic::OnBecomeAttacker()
+{
+ Navigator* ourNavigator = parent->GetModule<Navigator>(IO_NAVIGATOR_MAIN);
+
+ ourNavigator->Stop();
+
+ UpdateAttackerMovement();
}
//-----------------------------------------------------------------------------
@@ -20,21 +55,217 @@ void Logic::Update()
{
// We want to use a navigator
Navigator* ourNavigator = parent->GetModule<Navigator>(IO_NAVIGATOR_MAIN);
+ Ball_Tracker* ourBallTracker = parent->GetModule<Ball_Tracker>(IO_BALL_TRACKER_MAIN);
+ Display* ourDisplay = parent->GetModule<Display>(IO_DISPLAY_MAIN);
+ Position_Tracker* ourPositionTracker = parent->GetModule<Position_Tracker>(IO_POSITION_TRACKER_MAIN);
+ Obstacle_Tracker* ourObstacleTracker = parent->GetModule<Obstacle_Tracker>(IO_OBSTACLE_TRACKER_MAIN);
+
+ if(!this->HasBall() && ourBallTracker->HasBall())
+ {
+ this->hasBall = true;
+ this->OnBallOwned();
+ }
+ else if(this->HasBall() && !ourBallTracker->HasBall())
+ {
+ this->hasBall = false;
+ this->OnBallLost();
+ }
- // is Keeper?
- if(isKeeper) {
- // turn around al little bit...
- if((status == STATUS_KEEPER_TURN_LEFT && !ourNavigator->IsMoving()) ||
- (status != STATUS_KEEPER_TURN_LEFT && status != STATUS_KEEPER_TURN_RIGHT)) {
+ switch(status)
+ {
+ case STATUS_ATTACKER_SEARCHING_AT_HOME:
+ case STATUS_ATTACKER_SEARCHING_AT_ENEMY:
+ if(ourBallTracker->KnowsBallDirection())
+ {
+ ourNavigator->Stop();
+ }
+ break;
+ case STATUS_KEEPER_HUNT_BALL:
+ if(ourBallTracker->KnowsBallDirection())
+ {
+ ourNavigator->Drive(ourBallTracker->GetBallDirection(), EMPTY_FLOAT, DEFAULT_SPEED, 0);
+ }
+ else
+ {
+ ourNavigator->Stop();
+ }
+ break;
+ }
+
+ if(!ourNavigator->IsMoving())
+ {
+ if(this->IsKeeper())
+ {
+ UpdateKeeperMovement();
+ }
+ else
+ {
+ UpdateAttackerMovement();
+ }
+ }
+
+ if(ourNavigator->IsMoving())
+ {
+ if(ourObstacleTracker->IsObstacleOnPath())
+ {
+ avoidsObstacle = true;
+ for(uint8 i = 0; i < 5; i++)
+ {
+ if(ourObstacleTracker->IsObstacleOnPath(easyAngle(ourNavigator->GetDirection() - ((i - 2) * PI / 4.0f))))
+ {
+ }
+ ourNavigator->GetDirection();
+ }
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+void Logic::UpdateKeeperMovement()
+{
+ Ball_Tracker* ourBallTracker = parent->GetModule<Ball_Tracker>(IO_BALL_TRACKER_MAIN);
+ Position_Tracker* ourPositionTracker = parent->GetModule<Position_Tracker>(IO_POSITION_TRACKER_MAIN);
+ Navigator* ourNavigator = parent->GetModule<Navigator>(IO_NAVIGATOR_MAIN);
+
+ if(ourBallTracker->KnowsBallDirection())
+ {
+ if(ourBallTracker->GetBallDirection() > KEEPER_LEFT_ANGLE &&
+ ourBallTracker->GetBallDirection() <= PI)
+ {
+ if(distance2d(DEFENCE_L_LOC_X, DEFENCE_L_LOC_Y, ourPositionTracker->GetPositionX(), ourPositionTracker->GetPositionY()) < DISTANCE_TOLERANCE)
+ {
+ float angleDifference = fabs(ourBallTracker->GetBallDirection() - ourPositionTracker->GetOrientation());
+ if(angleDifference > PI)
+ {
+ angleDifference = (2 * PI) - angleDifference;
+ }
+
+ if(angleDifference > ORIENTATION_TOLERANCE)
+ {
+ status = STATUS_KEEPER_TURN_TO_BALL;
+ ourNavigator->RotateTo(ourBallTracker->GetBallDirection(), DEFAULT_ROTATION_SPEED);
+ }
+ else
+ {
+ status = STATUS_KEEPER_HUNT_BALL;
+ ourNavigator->Drive(ourBallTracker->GetBallDirection(), EMPTY_FLOAT, DEFAULT_SPEED, 0);
+ }
+ }
+ else
+ {
+ status = STATUS_KEEPER_DRIVE_TO_DEFEND;
+ ourNavigator->DriveTo(DEFENCE_L_LOC_X, DEFENCE_L_LOC_Y, EMPTY_FLOAT, DEFAULT_SPEED, 0);
+ }
+ }
+ else if(ourBallTracker->GetBallDirection() < KEEPER_RIGHT_ANGLE &&
+ ourBallTracker->GetBallDirection() >= PI)
+ {
+ if(distance2d(DEFENCE_R_LOC_X, DEFENCE_R_LOC_Y, ourPositionTracker->GetPositionX(), ourPositionTracker->GetPositionY()) < DISTANCE_TOLERANCE)
+ {
+ float angleDifference = fabs(ourBallTracker->GetBallDirection() - ourPositionTracker->GetOrientation());
+ if(angleDifference > PI)
+ {
+ angleDifference = (2 * PI) - angleDifference;
+ }
+
+ if(angleDifference > ORIENTATION_TOLERANCE)
+ {
+ status = STATUS_KEEPER_TURN_TO_BALL;
+ ourNavigator->RotateTo(ourBallTracker->GetBallDirection(), DEFAULT_ROTATION_SPEED);
+ }
+ else
+ {
+ status = STATUS_KEEPER_HUNT_BALL;
+ ourNavigator->Drive(ourBallTracker->GetBallDirection(), EMPTY_FLOAT, DEFAULT_SPEED, 0);
+ }
+ }
+ else
+ {
+ status = STATUS_KEEPER_DRIVE_TO_DEFEND;
+ ourNavigator->DriveTo(DEFENCE_R_LOC_X, DEFENCE_R_LOC_Y, EMPTY_FLOAT, DEFAULT_SPEED, 0);
+ }
+ }
+ else
+ {
+ if(distance2d(HOME_LOC_X, HOME_LOC_Y, ourPositionTracker->GetPositionX(), ourPositionTracker->GetPositionY()) < DISTANCE_TOLERANCE)
+ {
+ float angleDifference = fabs(ourBallTracker->GetBallDirection() - ourPositionTracker->GetOrientation());
+ if(angleDifference > PI)
+ {
+ angleDifference = (2 * PI) - angleDifference;
+ }
+
+ if(angleDifference > ORIENTATION_TOLERANCE)
+ {
+ status = STATUS_KEEPER_TURN_TO_BALL;
+ ourNavigator->RotateTo(ourBallTracker->GetBallDirection(), DEFAULT_ROTATION_SPEED);
+ }
+ else
+ {
+ status = STATUS_KEEPER_HUNT_BALL;
+ ourNavigator->Drive(ourBallTracker->GetBallDirection(), EMPTY_FLOAT, DEFAULT_SPEED, 0);
+ }
+ }
+ else
+ {
+ status = STATUS_KEEPER_DRIVE_TO_DEFEND;
+ ourNavigator->DriveTo(HOME_LOC_X, HOME_LOC_Y, EMPTY_FLOAT, DEFAULT_SPEED, 0);
+ }
+ }
+ }
+ else
+ {
+ if(status == STATUS_KEEPER_TURN_LEFT)
+ {
status = STATUS_KEEPER_TURN_RIGHT;
- ourNavigator->RotateTo(315,200);
+ ourNavigator->RotateTo(315, DEFAULT_ROTATION_SPEED);
}
- else if(status == STATUS_KEEPER_TURN_RIGHT && !ourNavigator->IsMoving()) {
+ else
+ {
status = STATUS_KEEPER_TURN_LEFT;
- ourNavigator->RotateTo(45, 200);
+ ourNavigator->RotateTo(45, DEFAULT_ROTATION_SPEED);
}
}
- else { // is Player?
-
+}
+
+//-----------------------------------------------------------------------------
+void Logic::UpdateAttackerMovement()
+{
+ Ball_Tracker* ourBallTracker = parent->GetModule<Ball_Tracker>(IO_BALL_TRACKER_MAIN);
+ Position_Tracker* ourPositionTracker = parent->GetModule<Position_Tracker>(IO_POSITION_TRACKER_MAIN);
+ Navigator* ourNavigator = parent->GetModule<Navigator>(IO_NAVIGATOR_MAIN);
+
+ if(ourBallTracker->KnowsBallDirection())
+ {
+ float angleDifference = fabs(ourBallTracker->GetBallDirection() - ourPositionTracker->GetOrientation());
+
+ if(angleDifference > PI)
+ {
+ angleDifference = (2 * PI) - angleDifference;
+ }
+
+ if(angleDifference > ORIENTATION_TOLERANCE)
+ {
+ status = STATUS_ATTACKER_TURN_TO_BALL;
+ ourNavigator->RotateTo(ourBallTracker->GetBallDirection(), DEFAULT_ROTATION_SPEED);
+ }
+ else
+ {
+ status = STATUS_ATTACKER_DRIVE_TO_BALL;
+ ourNavigator->Drive(ourBallTracker->GetBallDirection(), EMPTY_FLOAT, DEFAULT_SPEED, 0);
+ }
+ }
+ else
+ {
+ if(ourPositionTracker->GetPositionX() > 0)
+ {
+ status = STATUS_ATTACKER_SEARCHING_AT_HOME;
+ ourNavigator->DriveTo(HOME_LOC_X, HOME_LOC_Y, EMPTY_FLOAT, DEFAULT_SPEED, 0);
+ }
+ else
+ {
+ status = STATUS_ATTACKER_SEARCHING_AT_ENEMY;
+ ourNavigator->DriveTo(ENEMY_LOC_X, ENEMY_LOC_Y, EMPTY_FLOAT, DEFAULT_SPEED, 0);
+ }
}
}
diff --git a/source/Concept/Framework/modules/logic/logic.h b/source/Concept/Framework/modules/logic/logic.h
index ad8bad7..031e0b6 100755
--- a/source/Concept/Framework/modules/logic/logic.h
+++ b/source/Concept/Framework/modules/logic/logic.h
@@ -12,6 +12,8 @@ public:
this->moduleId = 0;
this->isKeeper = false;
this->status = 0;
+ this->hasBall = false;
+ this->avoidsObstacle = false;
}
Logic(uint32 logicId)
@@ -20,16 +22,29 @@ public:
this->moduleId = logicId;
this->isKeeper = false;
this->status = 0;
+ this->hasBall = false;
+ this->avoidsObstacle = false;
}
protected:
bool isKeeper;
uint8 status;
+ bool hasBall;
+ bool avoidsObstacle;
enum LogicalStatus
{
STATUS_KEEPER_TURN_RIGHT,
STATUS_KEEPER_TURN_LEFT,
+ STATUS_KEEPER_RETURN_HOME,
+ STATUS_KEEPER_HUNT_BALL,
+ STATUS_KEEPER_TURN_TO_BALL,
+ STATUS_KEEPER_DRIVE_TO_DEFEND,
+
+ STATUS_ATTACKER_TURN_TO_BALL,
+ STATUS_ATTACKER_DRIVE_TO_BALL,
+ STATUS_ATTACKER_SEARCHING_AT_HOME,
+ STATUS_ATTACKER_SEARCHING_AT_ENEMY,
};
void OnBallOwned();
@@ -51,7 +66,8 @@ public:
return !isKeeper;
}
- void SetKeeper(bool newStatus) {
+ void SetKeeper(bool newStatus)
+ {
if(!this->isKeeper && newStatus)
{
this->OnBecomeKeeper();
@@ -65,8 +81,11 @@ public:
bool HasBall()
{
- //fill me!
+ return this->hasBall;
}
+
+ void UpdateKeeperMovement();
+ void UpdateAttackerMovement();
};
#endif
diff --git a/source/Concept/Framework/robot.c b/source/Concept/Framework/robot.c
index 7653c61..9dc564d 100755
--- a/source/Concept/Framework/robot.c
+++ b/source/Concept/Framework/robot.c
@@ -90,15 +90,15 @@ void Robot::Update()
{
GetModule<Command_Handler>(IO_COMMAND_HANDLER_MAIN)->Update();
+ GetModule<Position_Tracker>(IO_POSITION_TRACKER_MAIN)->Update();
+
GetModule<Ball_Tracker>(IO_BALL_TRACKER_MAIN)->Update();
- GetModule<Position_Tracker>(IO_POSITION_TRACKER_MAIN)->Update();
+ GetModule<Obstacle_Tracker>(IO_OBSTACLE_TRACKER_MAIN)->Update();
- GetModule<Logic>(IO_LOGIC_MAIN)->Update();
+ //GetModule<Logic>(IO_LOGIC_MAIN)->Update();
GetModule<Navigator>(IO_NAVIGATOR_MAIN)->Update();
-
- //insert code here
}
//-----------------------------------------------------------------------------
diff --git a/source/Concept/Framework/stdafx.h b/source/Concept/Framework/stdafx.h
index 88d8c85..6e3f031 100644
--- a/source/Concept/Framework/stdafx.h
+++ b/source/Concept/Framework/stdafx.h
@@ -22,6 +22,7 @@
#include "mouse_sensor.h"
#include "command_handler.h"
#include "position_tracker.h"
+#include "obstacle_tracker.h"
#include "ball_tracker.h"
#include "navigator.h"
#include "logic.h"