summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/Concept/Framework/RoboCode.aps2
-rw-r--r--source/Concept/Framework/default/Makefile11
-rw-r--r--source/Concept/Framework/defines.h34
-rwxr-xr-xsource/Concept/Framework/main.c86
-rwxr-xr-xsource/Concept/Framework/modules/executor/navigator.c149
-rwxr-xr-xsource/Concept/Framework/modules/input/distance_sensor.c19
-rwxr-xr-xsource/Concept/Framework/modules/input/ir_sensor.c2
-rwxr-xr-xsource/Concept/Framework/modules/input/ir_sensor.h7
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/ball_tracker.c7
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/ball_tracker.h10
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/position_tracker.c13
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/position_tracker.h26
-rwxr-xr-xsource/Concept/Framework/modules/output/dribbler.h7
-rw-r--r--source/Concept/Framework/stdafx.h5
14 files changed, 212 insertions, 166 deletions
diff --git a/source/Concept/Framework/RoboCode.aps b/source/Concept/Framework/RoboCode.aps
index 83aaae6..609c3cf 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>20-Feb-2007 21:59:37</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><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></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>0</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\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></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></Files><Workspace><File00000><Position>291 76 1017 557</Position><LineCol>6 0</LineCol></File00000><File00001><Position>291 72 1025 553</Position><LineCol>53 14</LineCol><State>Maximized</State></File00001><File00002><Position>33047 32859 33647 33105</Position><LineCol>45 0</LineCol></File00002><File00003><Position>33047 32859 33647 33105</Position><LineCol>16 0</LineCol></File00003><File00004><Position>33047 32859 33647 33105</Position><LineCol>16 22</LineCol></File00004><File00005><Position>33047 32859 33647 33105</Position><LineCol>14 0</LineCol></File00005><File00006><Position>32276 32089 33002 32544</Position><LineCol>8 0</LineCol></File00006><File00007><Position>33047 32859 33773 33314</Position><LineCol>107 69</LineCol></File00007><File00008><Position>33047 32859 33647 33105</Position><LineCol>2 0</LineCol></File00008><File00009><Position>32373 32231 32999 32532</Position><LineCol>101 30</LineCol></File00009><File00010><Position>32285 32115 32915 32420</Position><LineCol>27 0</LineCol></File00010><File00011><Position>32310 32146 32940 32451</Position><LineCol>6 0</LineCol></File00011><File00012><Position>32332 32175 32962 32480</Position><LineCol>1 0</LineCol></File00012><File00013><Position>32354 32204 32984 32509</Position><LineCol>93 0</LineCol></File00013><File00014><Position>32376 32233 33006 32538</Position><LineCol>9 0</LineCol></File00014><File00015><Position>32288 32117 32918 32422</Position><LineCol>3 0</LineCol></File00015><File00016><Position>32310 32146 32940 32451</Position><LineCol>21 0</LineCol></File00016><File00017><Position>32332 32175 32962 32480</Position><LineCol>1 0</LineCol></File00017><File00018><Position>32354 32204 32984 32509</Position><LineCol>71 0</LineCol></File00018><File00019><Position>288 70 1014 525</Position><LineCol>68 22</LineCol></File00019><File00020><Position>32288 32117 32918 32422</Position><LineCol>1 0</LineCol></File00020><File00021><Position>282 66 1008 521</Position><LineCol>159 4</LineCol></File00021><File00022><Position>32332 32175 32962 32480</Position><LineCol>3 0</LineCol></File00022><File00023><Position>276 62 1002 517</Position><LineCol>65 0</LineCol></File00023><File00024><Position>32376 32233 33006 32538</Position><LineCol>55 0</LineCol></File00024><File00025><Position>32288 32117 32918 32422</Position><LineCol>1 0</LineCol></File00025><File00026><Position>32310 32146 32940 32451</Position><LineCol>1 0</LineCol></File00026><File00027><Position>32332 32175 32962 32480</Position><LineCol>1 0</LineCol></File00027><File00028><Position>32354 32204 32984 32509</Position><LineCol>49 0</LineCol></File00028><File00029><Position>285 68 1011 523</Position><LineCol>184 43</LineCol></File00029><File00030><Position>289 98 919 403</Position><LineCol>0 0</LineCol></File00030><File00031><Position>311 127 941 432</Position><LineCol>0 0</LineCol></File00031><File00032><Position>339 160 955 462</Position><LineCol>144 0</LineCol></File00032></Workspace><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
+<AVRStudio><MANAGEMENT><ProjectName>RoboCode</ProjectName><Created>16-Feb-2007 15:16:46</Created><LastEdit>21-Feb-2007 23:27:30</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 77 1017 558</Position><LineCol>25 18</LineCol></File00000><File00001><Position>288 70 1022 551</Position><LineCol>78 1</LineCol></File00001><File00002><Position>33044 32857 33644 33103</Position><LineCol>7 13</LineCol></File00002><File00003><Position>33044 32857 33644 33103</Position><LineCol>16 0</LineCol></File00003><File00004><Position>33044 32857 33644 33103</Position><LineCol>17 1</LineCol></File00004><File00005><Position>33044 32857 33644 33103</Position><LineCol>48 23</LineCol></File00005><File00006><Position>32273 32087 32999 32542</Position><LineCol>8 0</LineCol></File00006><File00007><Position>33044 32857 33770 33312</Position><LineCol>84 27</LineCol></File00007><File00008><Position>33044 32857 33644 33103</Position><LineCol>44 33</LineCol></File00008><File00009><Position>32370 32229 32996 32530</Position><LineCol>101 0</LineCol></File00009><File00010><Position>32282 32113 32912 32418</Position><LineCol>23 7</LineCol></File00010><File00011><Position>32307 32144 32937 32449</Position><LineCol>55 30</LineCol></File00011><File00012><Position>32329 32173 32959 32478</Position><LineCol>1 0</LineCol></File00012><File00013><Position>32351 32202 32981 32507</Position><LineCol>87 24</LineCol></File00013><File00014><Position>32373 32231 33003 32536</Position><LineCol>9 0</LineCol></File00014><File00015><Position>32285 32115 32915 32420</Position><LineCol>102 20</LineCol></File00015><File00016><Position>32307 32144 32937 32449</Position><LineCol>68 16</LineCol></File00016><File00017><Position>32329 32173 32959 32478</Position><LineCol>1 0</LineCol></File00017><File00018><Position>32351 32202 32981 32507</Position><LineCol>22 28</LineCol></File00018><File00019><Position>285 68 1011 523</Position><LineCol>68 22</LineCol></File00019><File00020><Position>32285 32115 32915 32420</Position><LineCol>1 0</LineCol></File00020><File00021><Position>279 64 1005 519</Position><LineCol>227 10</LineCol></File00021><File00022><Position>32329 32173 32959 32478</Position><LineCol>34 2</LineCol></File00022><File00023><Position>273 60 999 515</Position><LineCol>125 3</LineCol></File00023><File00024><Position>32373 32231 33003 32536</Position><LineCol>63 20</LineCol></File00024><File00025><Position>291 72 1025 553</Position><LineCol>30 22</LineCol><State>Maximized</State></File00025><File00026><Position>32307 32144 32937 32449</Position><LineCol>1 0</LineCol></File00026><File00027><Position>32329 32173 32959 32478</Position><LineCol>1 0</LineCol></File00027><File00028><Position>32351 32202 32981 32507</Position><LineCol>63 10</LineCol></File00028><File00029><Position>282 66 1008 521</Position><LineCol>176 108</LineCol></File00029><File00030><Position>286 96 916 401</Position><LineCol>0 0</LineCol></File00030><File00031><Position>308 125 938 430</Position><LineCol>0 0</LineCol></File00031><File00032><Position>336 158 952 460</Position><LineCol>167 4</LineCol></File00032><File00033><Position>361 189 977 491</Position><LineCol>17 30</LineCol></File00033><File00034><Position>383 218 999 520</Position><LineCol>9 60</LineCol></File00034><File00035><Position>405 247 1021 549</Position><LineCol>48 21</LineCol></File00035><File00036><Position>295 102 911 404</Position><LineCol>1 0</LineCol></File00036><File00037><Position>317 131 933 433</Position><LineCol>227 4</LineCol></File00037><File00038><Position>339 160 955 462</Position><LineCol>8 3</LineCol></File00038><File00039><Position>361 189 977 491</Position><LineCol>18 26</LineCol></File00039><File00040><Position>383 218 999 520</Position><LineCol>0 0</LineCol></File00040></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 d401a7f..0411c61 100644
--- a/source/Concept/Framework/default/Makefile
+++ b/source/Concept/Framework/default/Makefile
@@ -40,7 +40,7 @@ INCLUDES = -I"Y:\Concept\Framework\modules" -I"Y:\Concept\Framework\modules\exec
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
+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 explicitly added by the user
LINKONLYOBJECTS =
@@ -103,6 +103,15 @@ ball_tracker.o: ../modules/interpreter/ball_tracker.c
navigator.o: ../modules/executor/navigator.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
+aktuator.o: ../modules/executor/aktuator.c
+ $(CC) $(INCLUDES) $(CFLAGS) -c $<
+
+wireless.o: ../modules/wireless.c
+ $(CC) $(INCLUDES) $(CFLAGS) -c $<
+
+logic.o: ../modules/logic/logic.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 586a3d8..6e62143 100644
--- a/source/Concept/Framework/defines.h
+++ b/source/Concept/Framework/defines.h
@@ -59,11 +59,19 @@
#define SPEED_PER_PWM 1
#define DISTANCE_PER_VALUE 1
#define TICKS_PER_CM 205.0f
+//#define TICKS_PER_CM 90.0f
#define PI 3.14159265358979323846f
#define CYCLES_PER_CORRECTION 20
#define EMPTY_FLOAT 81188.1484f
+#define WIRELESS_CODE "SPASS!"
+enum WirelessCommands
+{
+ WLESS_CMD_CONFIRM,
+ WLESS_CMD_RECIEVED_BALL,
+};
+
//IO Module Names
enum IOModuleNames
{
@@ -94,9 +102,25 @@ enum IOModuleNames
IO_KICKER_MAIN = IO_KICKER_START,
IO_KICKER_END,
+
+ // Aktuator
+
+ IO_AKTUATOR_START = IO_KICKER_END,
+
+ IO_AKTUATOR_MAIN = IO_AKTUATOR_START,
+
+ IO_AKTUATOR_END,
+
+ // Wireless
+
+ IO_WIRELESS_START = IO_AKTUATOR_END,
+
+ IO_WIRELESS_MAIN = IO_WIRELESS_START,
+
+ IO_WIRELESS_END,
//Sensors
- IO_SENSOR_START = IO_KICKER_END,
+ IO_SENSOR_START = IO_WIRELESS_END,
IO_SENSOR_IR_0_DEG = IO_SENSOR_START,
IO_SENSOR_IR_30_DEG,
@@ -163,6 +187,14 @@ enum IOModuleNames
IO_NAVIGATOR_END,
+ //Logics
+
+ IO_LOGIC_START = IO_NAVIGATOR_END,
+
+ IO_LOGIC_MAIN,
+
+ IO_LOGIC_END,
+
//General
IO_END = IO_NAVIGATOR_END,
};
diff --git a/source/Concept/Framework/main.c b/source/Concept/Framework/main.c
index b0fc96b..1875847 100755
--- a/source/Concept/Framework/main.c
+++ b/source/Concept/Framework/main.c
@@ -39,6 +39,22 @@ int main()
newKicker = NULL;
}
+ //Init Aktuator
+ for(uint8 i = IO_AKTUATOR_START; i < IO_AKTUATOR_END; i++)
+ {
+ Aktuator* newAktuator = new Aktuator(i);
+ localRobot->AddModule(newAktuator);
+ newAktuator = NULL;
+ }
+
+ //Init Wireless
+ for(uint8 i = IO_WIRELESS_START; i < IO_WIRELESS_END; i++)
+ {
+ Wireless* newWireless = new Wireless(i);
+ localRobot->AddModule(newWireless);
+ newWireless = NULL;
+ }
+
//Init Sensors
for(uint8 i = IO_SENSOR_START; i < IO_SENSOR_END; i++)
{
@@ -130,6 +146,14 @@ int main()
newNavigator = NULL;
}
+ //Init Logics
+ for(uint8 i = IO_LOGIC_START; i < IO_LOGIC_END; i++)
+ {
+ Logic* newLogic = new Logic(i);
+ localRobot->AddModule(newLogic);
+ newLogic = NULL;
+ }
+
sleep(1);
//Debug code
@@ -146,8 +170,14 @@ int main()
uint32 i = 1;
Navigator* ourNavigator = localRobot->GetModule<Navigator>(IO_NAVIGATOR_MAIN);
Position_Tracker* ourPosition_Tracker = 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);
+ Aktuator* ourAktuator = localRobot->GetModule<Aktuator>(IO_AKTUATOR_MAIN);
float rotation = 0;
+ float speed = 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);
@@ -157,19 +187,26 @@ int main()
while(true)
{
ourDisplay->Print(i++,1,1);
+
+ msleep(100);
- if(!(i % 200))
+ if(!(i % 1))
{
ourDisplay->Clear();
- ourDisplay->PrintFloat(ourPosition_Tracker->GetPositionX(),1,2);
- ourDisplay->PrintFloat(ourPosition_Tracker->GetPositionY(),1,3);
- ourDisplay->PrintFloat(ourPosition_Tracker->GetOrientation() * 180.0f / PI,1,4);
+ //ourDisplay->Print(ourPosition_Tracker->GetPositionX(),1,2);
+ //ourDisplay->Print(ourPosition_Tracker->GetPositionY(),1,3);
+ //ourDisplay->Print(ourPosition_Tracker->GetOrientation() * 180.0f / PI,1,4);
+ }
+
+ if(!(i % 50))
+ {
+ ourAktuator->Kick();
}
- /*distanceSensor = localRobot->GetModule<Distance_Sensor>(IO_SENSOR_DISTANCE_0_DEG);
+ distanceSensor = localRobot->GetModule<Distance_Sensor>(IO_SENSOR_DISTANCE_0_DEG);
value = distanceSensor->GetDistance();
- ourDisplay->Print(value, 1, 4);
+ ourDisplay->Print(value, 1, 2);
ourDisplay->Print(";");
distanceSensor = localRobot->GetModule<Distance_Sensor>(IO_SENSOR_DISTANCE_90_DEG);
value = distanceSensor->GetDistance();
@@ -177,12 +214,12 @@ int main()
ourDisplay->Print(";");
distanceSensor = localRobot->GetModule<Distance_Sensor>(IO_SENSOR_DISTANCE_180_DEG);
value = distanceSensor->GetDistance();
- ourDisplay->Print(value);
+ ourDisplay->Print(value, 1, 3);
ourDisplay->Print(";");
distanceSensor = localRobot->GetModule<Distance_Sensor>(IO_SENSOR_DISTANCE_270_DEG);
value = distanceSensor->GetDistance();
ourDisplay->Print(value);
- ourDisplay->Print(";"); */
+ ourDisplay->Print(";");
uint8 someInput = ourKeyboard->GetInput();
//ourDisplay->Print("Ready to accept...", 1, 2);
@@ -190,46 +227,45 @@ int main()
{
case 0:
ourNavigator->Stop();
+ return 0;
break;
case 1:
- ourNavigator->Drive(225, rotation, 100, rotation);
+ ourNavigator->Drive(225, rotation, speed, rotation);
break;
case 2:
- ourNavigator->Drive(180, rotation, 100, rotation);
+ ourNavigator->Drive(180, rotation, speed, rotation);
break;
case 3:
- ourNavigator->Drive(135, rotation, 100, rotation);
+ ourNavigator->Drive(135, rotation, speed, rotation);
break;
case 4:
- ourNavigator->Drive(270, rotation, 100, rotation);
+ ourNavigator->Drive(270, rotation, speed, rotation);
break;
case 5:
ourNavigator->Drive(0, rotation, 0, rotation);
break;
case 6:
- ourNavigator->Drive(90, rotation, 100, rotation);
+ ourNavigator->Drive(90, rotation, speed, rotation);
break;
case 7:
- ourNavigator->Drive(315, rotation, 100, rotation);
+ ourNavigator->Drive(315, rotation, speed, rotation);
break;
case 8:
- ourNavigator->Drive(0, rotation, 100, rotation);
+ ourNavigator->Drive(0, rotation, speed, rotation);
break;
case 9:
- ourNavigator->Drive(45, rotation, 100, rotation);
+ ourNavigator->Drive(45, rotation, speed, rotation);
break;
case 10:
- rotation += 10;
+ ourPosition_Tracker->SetPosition(0,0,0); // Reset Position_Tracker
break;
case 12:
- rotation -= 10;
+ ourPosition_Tracker->SetPosition(0,0,0); // Reset Position_Tracker
break;
}
- /*
//ourDisplay->Clear();
- ourDisplay->Print(i++,1,1);
- ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_0_DEG);
+ /*ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_0_DEG);
value = ourSensor->GetIRIntensity();
ourDisplay->Print(value, 1, 2);
ourDisplay->Print(";");
@@ -260,13 +296,13 @@ int main()
ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_330_DEG);
value = ourSensor->GetIRIntensity();
ourDisplay->Print(value);
- ourDisplay->Print(";");
+ ourDisplay->Print(";");*/
- msleep(500);
- */
localRobot->Update();
- //ourDisplay->PrintFloat(ourBallTracker->GetBallDirection(), 1, 4);
+ //ourDisplay->Print(ourBallTracker->GetBallDirection() * 180.0f / PI, 1, 4);
+
+ //ourNavigator->Drive(ourBallTracker->GetBallDirection() * 180.0f / PI, 0, 255, 0);
}
//Cleanup
diff --git a/source/Concept/Framework/modules/executor/navigator.c b/source/Concept/Framework/modules/executor/navigator.c
index 5dbf8bf..928a5ff 100755
--- a/source/Concept/Framework/modules/executor/navigator.c
+++ b/source/Concept/Framework/modules/executor/navigator.c
@@ -54,30 +54,6 @@ void Navigator::Drive(float newDirection, float newAngle, float newSpeed, float
}
CalculateEngines();
-
- //dings,,,
-
- /*float xDrive = cos(direction + PI / 6.0f);
- float yDrive = sin(direction + PI / 6.0f);
-
- float vLeft = xDrive;
- float vBack = (-xDrive + sqrt(3) * yDrive) / 2.0f;
- float vRight = (-xDrive - sqrt(3) * yDrive) / 2.0f;
-
- vLeft = vLeft * this->robotSpeed + rotationSpeed;
- vBack = vBack * this->robotSpeed + rotationSpeed;
- vRight = vRight * this->robotSpeed + rotationSpeed;
-
- Engine* curEngine = parent->GetModule<Engine>(IO_ENGINE_DRIVE_LEFT);
- curEngine->SetSpeed(vLeft);
- curEngine->SetEnabled(true);
- curEngine = parent->GetModule<Engine>(IO_ENGINE_DRIVE_BACK);
- curEngine->SetSpeed(vBack);
- curEngine->SetEnabled(true);
- curEngine = parent->GetModule<Engine>(IO_ENGINE_DRIVE_RIGHT);
- curEngine->SetSpeed(vRight);
- curEngine->SetEnabled(true);
- curEngine = NULL;*/
}
//-----------------------------------------------------------------------------
@@ -178,108 +154,43 @@ void Navigator::CalculateDirection()
//-----------------------------------------------------------------------------
void Navigator::CalculateEngines()
{
+ // Use the position_tracker
Position_Tracker* locationeer = parent->GetModule<Position_Tracker>(IO_POSITION_TRACKER_MAIN);
-
- if(direction != EMPTY_FLOAT)
- {
- float relativeDirection = this->direction - locationeer->GetOrientation();
-
- float xDrive = cos(relativeDirection + PI / 6.0f);
- float yDrive = sin(relativeDirection + PI / 6.0f);
-
- float vLeft = xDrive;
- float vBack = (-xDrive + sqrt(3) * yDrive) / 2.0f;
- float vRight = (-xDrive - sqrt(3) * yDrive) / 2.0f;
-
- /*float speedCorrection = 1.0f;
-
- float maxEngineSpeed = 255.0f;
- float minEngineSpeed = -255.0f;
+ // get the relative position of the robot
+ float relativeDirection = this->direction - locationeer->GetOrientation();
- float maxSingleSpeed = max(max(fabs(vLeft), fabs(vBack)), fabs(vRight));
+ // calculate x and y-koordinates
+ float xDrive = cos(relativeDirection + PI / 6.0f);
+ float yDrive = sin(relativeDirection + PI / 6.0f);
- float calcSpeed = 1.0f;//sqrt(vLeft * vLeft - vLeft * vRight + vRight * vRight +
- // vBack * (vBack + vLeft + vRight));
+ // calculate relative speed of engines
+ float vLeft = xDrive;
+ float vBack = (-xDrive + sqrt(3) * yDrive) / 2.0f;
+ float vRight = (-xDrive - sqrt(3) * yDrive) / 2.0f;
- if(calcSpeed != 1.0f)
- {
- speedCorrection = 1.0f / calcSpeed;
- }
+ // Get the maximal value
+ float speedCorrection = (float)max(max(fabs(vLeft),fabs(vBack)),fabs(vRight));
- float maxOverallSpeed = robotSpeed * maxSingleSpeed * speedCorrection;
- if(maxOverallSpeed > maxEngineSpeed)
- {
- robotSpeed = maxEngineSpeed / (maxSingleSpeed * speedCorrection);
- }*/
-
+ // calculate the correct speeds of the engines
+ vLeft = ((float)vLeft * (float)((float)this->robotSpeed / (float)speedCorrection)) + this->rotationSpeed;
+ vBack = ((float)vBack * (float)((float)this->robotSpeed / (float)speedCorrection)) + this->rotationSpeed;
+ vRight = ((float)vRight * (float)((float)this->robotSpeed / (float)speedCorrection)) + this->rotationSpeed;
- vLeft = vLeft * this->robotSpeed;// * speedCorrection;
- vBack = vBack * this->robotSpeed;// * speedCorrection;
- vRight = vRight * this->robotSpeed;// * speedCorrection;
+ //(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(vLeft,10,2);
+ //(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(vBack,10,3);
+ //(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(vRight,10,4);
- /*maxSingleSpeed = max(max(fabs(vLeft), fabs(vBack)), fabs(vRight));
- float minSingleSpeed = min(min(vLeft, vBack), vRight);
- if(rotationSpeed)
- {
- if(this->rotationSpeed > 0)
- {
- if(maxEngineSpeed - maxSingleSpeed < this->rotationSpeed)
- {
- vLeft += maxEngineSpeed - maxSingleSpeed;
- vBack += maxEngineSpeed - maxSingleSpeed;
- vRight += maxEngineSpeed - maxSingleSpeed;
- }
- else
- {
- vLeft += this->rotationSpeed;
- vBack += this->rotationSpeed;
- vRight += this->rotationSpeed;
- }
- }
- else
- {
- if((minEngineSpeed - minSingleSpeed) < this->rotationSpeed)
- {
- vLeft -= minEngineSpeed - minSingleSpeed;
- vBack -= minEngineSpeed - minSingleSpeed;
- vRight -= minEngineSpeed - minSingleSpeed;
- }
- else
- {
- vLeft -= this->rotationSpeed;
- vBack -= this->rotationSpeed;
- vRight -= this->rotationSpeed;
- }
- }
- }*/
- Engine* curEngine = parent->GetModule<Engine>(IO_ENGINE_DRIVE_LEFT);
- curEngine->SetSpeed(vLeft);
- curEngine->SetEnabled(true);
- curEngine = parent->GetModule<Engine>(IO_ENGINE_DRIVE_BACK);
- curEngine->SetSpeed(vBack);
- curEngine->SetEnabled(true);
- curEngine = parent->GetModule<Engine>(IO_ENGINE_DRIVE_RIGHT);
- curEngine->SetSpeed(vRight);
- curEngine->SetEnabled(true);
- curEngine = NULL;
- }
- else if(rotationSpeed)
- {
- Engine* curEngine = parent->GetModule<Engine>(IO_ENGINE_DRIVE_LEFT);
- curEngine->SetSpeed(this->rotationSpeed);
- curEngine->SetEnabled(true);
- curEngine = parent->GetModule<Engine>(IO_ENGINE_DRIVE_BACK);
- curEngine->SetSpeed(this->rotationSpeed);
- curEngine->SetEnabled(true);
- curEngine = parent->GetModule<Engine>(IO_ENGINE_DRIVE_RIGHT);
- curEngine->SetSpeed(this->rotationSpeed);
- curEngine->SetEnabled(true);
- curEngine = NULL;
- }
- else
- {
- Stop();
- }
+ // Transfer the values to the engines
+ Engine* curEngine = parent->GetModule<Engine>(IO_ENGINE_DRIVE_LEFT);
+ curEngine->SetSpeed(vLeft);
+ curEngine->SetEnabled(true);
+ curEngine = parent->GetModule<Engine>(IO_ENGINE_DRIVE_BACK);
+ curEngine->SetSpeed(vBack);
+ curEngine->SetEnabled(true);
+ curEngine = parent->GetModule<Engine>(IO_ENGINE_DRIVE_RIGHT);
+ curEngine->SetSpeed(vRight);
+ curEngine->SetEnabled(true);
+ curEngine = NULL;
}
diff --git a/source/Concept/Framework/modules/input/distance_sensor.c b/source/Concept/Framework/modules/input/distance_sensor.c
index 262d35f..e6fd3f8 100755
--- a/source/Concept/Framework/modules/input/distance_sensor.c
+++ b/source/Concept/Framework/modules/input/distance_sensor.c
@@ -5,21 +5,36 @@ float Distance_Sensor::GetDistance()
{
uint32 result = 0;
+ //(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print("Gen Pulse; Pin:",1,4);
+ //(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print((int)(*hardwarePin & pin));
+
+ msleep(500);
+
//Generate pulse
*hardwareDDR |= pin;//Set pin output
*hardwarePort |= pin;//Activate port
usleep(10);//Wait for 10µs
- *hardwarePort &= ~pin;//Deactivate port
*hardwareDDR &= ~pin;//Set pin input
+ *hardwarePort &= ~pin;//Deactivate port
+ //(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print("Wait response; Pin:",1,4);
+ //(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print((int)(*hardwarePin & pin));
+
+ uint16 i;
//Wait for response
- for(uint16 i = 0; (!(*hardwarePin & pin)) && (i < 1000); i++) { asm volatile("nop"); }
+ for(i = 0; (!(*hardwarePin & pin)) && (i < 1000); i++) { asm volatile("nop"); }
//Calculate duration of response
while((*hardwarePin & pin)&&(result < 300000))
{
result++;
asm volatile("nop");
+ asm volatile("nop");
+ asm volatile("nop");
+ asm volatile("nop");
+ asm volatile("nop");
+ asm volatile("nop");
+ asm volatile("nop");
}
return (float(result) * DISTANCE_PER_VALUE);
diff --git a/source/Concept/Framework/modules/input/ir_sensor.c b/source/Concept/Framework/modules/input/ir_sensor.c
index c34feed..12d74e0 100755
--- a/source/Concept/Framework/modules/input/ir_sensor.c
+++ b/source/Concept/Framework/modules/input/ir_sensor.c
@@ -5,5 +5,5 @@ uint16 IR_Sensor::GetIRIntensity()
{
if(!parent) return 0;
- return parent->GetADCValue(channel);
+ return min(parent->GetADCValue(channel) + this->intensityCorrection, 1023);
}
diff --git a/source/Concept/Framework/modules/input/ir_sensor.h b/source/Concept/Framework/modules/input/ir_sensor.h
index 30e6ea4..74396ec 100755
--- a/source/Concept/Framework/modules/input/ir_sensor.h
+++ b/source/Concept/Framework/modules/input/ir_sensor.h
@@ -12,12 +12,14 @@ public:
{
this->parent = NULL;
this->moduleId = 0;
+ this->intensityCorrection = 0;
}
IR_Sensor(uint32 sensorId)
{
this->parent = NULL;
this->moduleId = sensorId;
+ this->intensityCorrection = 0;
switch(sensorId)
{
@@ -32,12 +34,15 @@ public:
break;
case IO_SENSOR_IR_100_DEG:
this->channel = 3;
+ this->intensityCorrection = 40;
break;
case IO_SENSOR_IR_180_DEG:
this->channel = 4;
+ this->intensityCorrection = 50;
break;
case IO_SENSOR_IR_260_DEG:
this->channel = 5;
+ this->intensityCorrection = 70;
break;
case IO_SENSOR_IR_300_DEG:
this->channel = 6;
@@ -55,6 +60,8 @@ protected:
//Hardware
uint8 channel;
+ uint8 intensityCorrection;
+
public:
uint16 GetIRIntensity();
};
diff --git a/source/Concept/Framework/modules/interpreter/ball_tracker.c b/source/Concept/Framework/modules/interpreter/ball_tracker.c
index 1701121..2d85b96 100755
--- a/source/Concept/Framework/modules/interpreter/ball_tracker.c
+++ b/source/Concept/Framework/modules/interpreter/ball_tracker.c
@@ -109,9 +109,16 @@ void Ball_Tracker::Update()
break;
}
+ if(fabs(mainDirection - secondDirection) > PI)
+ {
+ min(mainDirection, secondDirection) += 2.0f * PI;
+ }
+
direction = (intensity[greatestIntensity] * mainDirection +
intensity[secondIntensity] * secondDirection) /
(intensity[greatestIntensity] + intensity[secondIntensity]);
+
+ 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 bea4a19..c62f05e 100755
--- a/source/Concept/Framework/modules/interpreter/ball_tracker.h
+++ b/source/Concept/Framework/modules/interpreter/ball_tracker.h
@@ -30,6 +30,16 @@ public:
{
return direction;
}
+
+ bool KnowsBallDirection()
+ {
+ return direction != EMPTY_FLOAT;
+ }
+
+ bool RobotHasBall()
+ {
+ //fill me!
+ }
};
#endif
diff --git a/source/Concept/Framework/modules/interpreter/position_tracker.c b/source/Concept/Framework/modules/interpreter/position_tracker.c
index 63a7f5f..a64ab60 100755
--- a/source/Concept/Framework/modules/interpreter/position_tracker.c
+++ b/source/Concept/Framework/modules/interpreter/position_tracker.c
@@ -3,9 +3,11 @@
//-----------------------------------------------------------------------------
void Position_Tracker::Update()
{
+ // 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);
+ // Generate a vector for the left mouse
int8 leftX = mouseLeft->GetXMovement();
int8 leftY = mouseLeft->GetYMovement();
float distanceLeft = sqrt(leftX * leftX + leftY * leftY);
@@ -14,12 +16,14 @@ void Position_Tracker::Update()
float movementLeftX = cos(angleLeft) * distanceLeft;
float movementLeftY = sin(angleLeft) * distanceLeft;
+ // AVR calculates a little bit strange ;)
if(!leftX && !leftY)
{
movementLeftX = 0;
movementLeftY = 0;
}
+ // Generate a vector for the right mouse
int8 rightX = mouseRight->GetXMovement();
int8 rightY = mouseRight->GetYMovement();
float distanceRight = sqrt(rightX * rightX + rightY * rightY);
@@ -28,21 +32,24 @@ void Position_Tracker::Update()
float movementRightX = cos(angleRight) * distanceRight;
float movementRightY = sin(angleRight) * distanceRight;
+ // AVR calculates a little bit strange ;)
if(!rightX && !rightY)
{
movementRightX = 0;
movementRightY = 0;
}
- float movementDifferenceX = (movementRightX + mouseRight->GetPositionX()) - (movementLeftX + mouseLeft->GetPositionX());
+ // Generate vector from P:left to P:right
+ float movementDifferenceX = movementRightX - movementLeftX;
float movementDifferenceY = (movementRightY + mouseRight->GetPositionY()) - (movementLeftY + mouseLeft->GetPositionY());
+ // Calculate the difference of orientation
float orientationDiff = atan2(movementDifferenceY, movementDifferenceX) - (PI / 2.0f);
float robotMovementX = movementDifferenceX / 2.0f;
float robotMovementY = movementDifferenceY / 2.0f;
robotMovementX += movementLeftX + mouseLeft->GetPositionX() + (-mouseLeft->GetPositionX() * cos(orientationDiff));
- robotMovementY += movementLeftY + mouseLeft->GetPositionY() + (-mouseLeft->GetPositionX() * sin(orientationDiff));
+ robotMovementY += movementLeftY + mouseLeft->GetPositionY() + (mouseLeft->GetPositionX() * sin(orientationDiff));
//float robotDistance = sqrt(robotMovementX * robotMovementX + robotMovementY * robotMovementY);
float absoluteDiffX = cos(this->orientation + (orientationDiff / 2.0f)) * robotMovementX - sin(this->orientation + (orientationDiff / 2.0f)) * robotMovementY;
@@ -58,7 +65,7 @@ void Position_Tracker::Update()
}
//(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(" ", 5, 1);
- //(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(absoluteDiffX, 5, 1);
+ //(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(robotMovementY + movementLeftY + mouseLeft->GetPositionY() + (mouseLeft->GetPositionX() * sin(orientationDiff)), 5, 1);
//(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(absoluteDiffY, 12, 1);
this->positionX += absoluteDiffX;
diff --git a/source/Concept/Framework/modules/interpreter/position_tracker.h b/source/Concept/Framework/modules/interpreter/position_tracker.h
index e93ef0c..47d0740 100755
--- a/source/Concept/Framework/modules/interpreter/position_tracker.h
+++ b/source/Concept/Framework/modules/interpreter/position_tracker.h
@@ -32,19 +32,27 @@ protected:
public:
void Update();
- float GetPositionX()
- {
- return positionX;
+ // Sets the current position; x and y in mm
+ void SetPosition(int newPositionX, int newPositionY, float newOrientation) {
+ positionX = newPositionX*(TICKS_PER_CM/10.0f);
+ positionY = newPositionY*(TICKS_PER_CM/10.0f);
+ orientation = easyAngle(newOrientation);
}
- float GetPositionY()
- {
- return positionY;
+ // returns x-koordinate in mm
+ int GetPositionX() {
+ return (int)((positionX*10.0f)/TICKS_PER_CM);
}
- float GetOrientation()
- {
- return orientation;
+ // returns y-koordinate in mm
+ int GetPositionY() {
+ return (int)((positionY*10.0f)/TICKS_PER_CM);
+ }
+
+ // returns orientation
+ float GetOrientation() {
+ return 0.0f; //tmp!!!!!!!!!!
+ //return orientation;
}
};
diff --git a/source/Concept/Framework/modules/output/dribbler.h b/source/Concept/Framework/modules/output/dribbler.h
index b11af69..8544698 100755
--- a/source/Concept/Framework/modules/output/dribbler.h
+++ b/source/Concept/Framework/modules/output/dribbler.h
@@ -66,19 +66,20 @@ protected:
{
*hardwarePort |= pinForward;
*hardwarePort &= ~pinReverse;
+ *portPower |= pinPower;
}
else if(curSpeed < 0)
{
*hardwarePort |= pinReverse;
*hardwarePort &= ~pinForward;
+ *portPower |= pinPower;
}
else
{
*hardwarePort |= pinForward;
*hardwarePort |= pinReverse;
- }
-
- *portPower |= pinPower;
+ *portPower &= ~pinPower;
+ }
}
else
{
diff --git a/source/Concept/Framework/stdafx.h b/source/Concept/Framework/stdafx.h
index af60c6e..a4054e3 100644
--- a/source/Concept/Framework/stdafx.h
+++ b/source/Concept/Framework/stdafx.h
@@ -14,6 +14,8 @@
#include "engine.h"
#include "dribbler.h"
#include "kicker.h"
+#include "aktuator.h"
+#include "wireless.h"
#include "led.h"
#include "distance_sensor.h"
#include "ir_sensor.h"
@@ -21,4 +23,5 @@
#include "position_tracker.h"
#include "ball_tracker.h"
#include "navigator.h"
-#include "robot.h"
+#include "logic.h"
+#include "robot.h"