summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source/Concept/Framework/RoboCode.aps2
-rw-r--r--source/Concept/Framework/atmega128io.h4
-rw-r--r--source/Concept/Framework/defines.h2
-rwxr-xr-xsource/Concept/Framework/main.c130
-rwxr-xr-xsource/Concept/Framework/modules/executor/navigator.c52
-rwxr-xr-xsource/Concept/Framework/modules/executor/navigator.h4
-rwxr-xr-xsource/Concept/Framework/modules/input/distance_sensor.c96
-rwxr-xr-xsource/Concept/Framework/modules/input/distance_sensor.h47
-rwxr-xr-xsource/Concept/Framework/modules/input/ir_sensor.h4
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/ball_tracker.c15
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/ball_tracker.h10
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/position_tracker.c21
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/position_tracker.h4
-rwxr-xr-xsource/Concept/Framework/robot.c2
14 files changed, 238 insertions, 155 deletions
diff --git a/source/Concept/Framework/RoboCode.aps b/source/Concept/Framework/RoboCode.aps
index 609c3cf..ca29afc 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>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>
+<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>
diff --git a/source/Concept/Framework/atmega128io.h b/source/Concept/Framework/atmega128io.h
index a3384a4..7f94c6c 100644
--- a/source/Concept/Framework/atmega128io.h
+++ b/source/Concept/Framework/atmega128io.h
@@ -6,6 +6,8 @@
#include <avr/io.h>
#include <avr/interrupt.h>
+#include "defines.h"
+
/************************************************************************
Title: Interrupt UART library with receive/transmit circular buffers
Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury
@@ -197,7 +199,7 @@ extern void uart1_puts_p(const char *s );
uint8 slave_adr; /*!< Slave Adresse and W/R byte */
uint8 size; /*!< Anzahl der Bytes, die gesendet oder empfagen werden sollen */
uint8 *data_ptr; /*!< Pointer zum Sende und Empfangs Puffer */
- }tx_type;
+ }tx_type;
/*!
* Hier wird der eigentliche TWI-Treiber angesprochen
diff --git a/source/Concept/Framework/defines.h b/source/Concept/Framework/defines.h
index 6e62143..9a7c12b 100644
--- a/source/Concept/Framework/defines.h
+++ b/source/Concept/Framework/defines.h
@@ -65,6 +65,8 @@
#define CYCLES_PER_CORRECTION 20
#define EMPTY_FLOAT 81188.1484f
+#define BALL_HELD_INTENSITY 900
+
#define WIRELESS_CODE "SPASS!"
enum WirelessCommands
{
diff --git a/source/Concept/Framework/main.c b/source/Concept/Framework/main.c
index 1875847..ffc4cc9 100755
--- a/source/Concept/Framework/main.c
+++ b/source/Concept/Framework/main.c
@@ -159,6 +159,8 @@ int main()
//Debug code
Display* ourDisplay = localRobot->GetModule<Display>(IO_DISPLAY_MAIN);
ourDisplay->Clear();
+ ourDisplay->Print("Roboter fertig gestartet",1,1);
+ sleep(1);
IR_Sensor* ourSensor = NULL;
@@ -175,51 +177,49 @@ int main()
ourDribbler->SetSpeed(1);
ourDribbler->SetEnabled(true);
Aktuator* ourAktuator = localRobot->GetModule<Aktuator>(IO_AKTUATOR_MAIN);
-
+ Logic* ourLogic = localRobot->GetModule<Logic>(IO_LOGIC_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);
+ ourDisplay->Clear();
//Run
while(true)
{
ourDisplay->Print(i++,1,1);
- msleep(100);
+ //msleep(50);
- if(!(i % 1))
+ if(!(i % 20))
{
ourDisplay->Clear();
- //ourDisplay->Print(ourPosition_Tracker->GetPositionX(),1,2);
- //ourDisplay->Print(ourPosition_Tracker->GetPositionY(),1,3);
- //ourDisplay->Print(ourPosition_Tracker->GetOrientation() * 180.0f / PI,1,4);
+
+ distanceSensor = localRobot->GetModule<Distance_Sensor>(IO_SENSOR_DISTANCE_0_DEG);
+ value = distanceSensor->GetDistance();
+ ourDisplay->Print(value, 1, 4);
+ ourDisplay->Print(";");
+ distanceSensor = localRobot->GetModule<Distance_Sensor>(IO_SENSOR_DISTANCE_90_DEG);
+ value = distanceSensor->GetDistance();
+ ourDisplay->Print(value);
+ ourDisplay->Print(";");
+ distanceSensor = localRobot->GetModule<Distance_Sensor>(IO_SENSOR_DISTANCE_180_DEG);
+ value = distanceSensor->GetDistance();
+ ourDisplay->Print(value);
+ ourDisplay->Print(";");
+ distanceSensor = localRobot->GetModule<Distance_Sensor>(IO_SENSOR_DISTANCE_270_DEG);
+ value = distanceSensor->GetDistance();
+ ourDisplay->Print(value);
+ ourDisplay->Print(";");
}
- if(!(i % 50))
+ if(!(i % 20))
{
- ourAktuator->Kick();
+ //ourAktuator->Kick();
}
-
-
- distanceSensor = localRobot->GetModule<Distance_Sensor>(IO_SENSOR_DISTANCE_0_DEG);
- value = distanceSensor->GetDistance();
- ourDisplay->Print(value, 1, 2);
- ourDisplay->Print(";");
- distanceSensor = localRobot->GetModule<Distance_Sensor>(IO_SENSOR_DISTANCE_90_DEG);
- value = distanceSensor->GetDistance();
- ourDisplay->Print(value);
- ourDisplay->Print(";");
- distanceSensor = localRobot->GetModule<Distance_Sensor>(IO_SENSOR_DISTANCE_180_DEG);
- value = distanceSensor->GetDistance();
- 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(";");
uint8 someInput = ourKeyboard->GetInput();
//ourDisplay->Print("Ready to accept...", 1, 2);
@@ -260,43 +260,55 @@ int main()
ourPosition_Tracker->SetPosition(0,0,0); // Reset Position_Tracker
break;
case 12:
- ourPosition_Tracker->SetPosition(0,0,0); // Reset Position_Tracker
+ ourLogic->SetKeeper(true); // Reset Position_Tracker
break;
}
//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(";");
- ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_60_DEG);
- value = ourSensor->GetIRIntensity();
- ourDisplay->Print(value);
- ourDisplay->Print(";");
- ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_100_DEG);
- value = ourSensor->GetIRIntensity();
- ourDisplay->Print(value);
- ourDisplay->Print(";");
- ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_180_DEG);
- value = ourSensor->GetIRIntensity();
- ourDisplay->Print(value, 1, 3);
- ourDisplay->Print(";");
- ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_260_DEG);
- value = ourSensor->GetIRIntensity();
- ourDisplay->Print(value);
- ourDisplay->Print(";");
- ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_300_DEG);
- value = ourSensor->GetIRIntensity();
- ourDisplay->Print(value);
- ourDisplay->Print(";");
- ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_330_DEG);
- value = ourSensor->GetIRIntensity();
- ourDisplay->Print(value);
- ourDisplay->Print(";");*/
+ if(!(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(";");
+ ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_60_DEG);
+ value = ourSensor->GetIRIntensity();
+ ourDisplay->Print(value);
+ ourDisplay->Print(";");
+ ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_100_DEG);
+ value = ourSensor->GetIRIntensity();
+ ourDisplay->Print(value);
+ ourDisplay->Print(";");
+ ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_180_DEG);
+ value = ourSensor->GetIRIntensity();
+ ourDisplay->Print(value, 1, 3);
+ ourDisplay->Print(";");
+ ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_260_DEG);
+ value = ourSensor->GetIRIntensity();
+ ourDisplay->Print(value);
+ ourDisplay->Print(";");
+ ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_300_DEG);
+ value = ourSensor->GetIRIntensity();
+ ourDisplay->Print(value);
+ ourDisplay->Print(";");
+ ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_330_DEG);
+ value = ourSensor->GetIRIntensity();
+ ourDisplay->Print(value);
+ ourDisplay->Print(";");
+ if(ourBallTracker->KnowsBallDirection())
+ {
+ ourDisplay->Print(ourBallTracker->GetBallDirection() * 180.0f / PI, 1, 4);
+ }
+ else
+ {
+ ourDisplay->Print("Not found oder so", 1, 4);
+ }*/
+ }
localRobot->Update();
diff --git a/source/Concept/Framework/modules/executor/navigator.c b/source/Concept/Framework/modules/executor/navigator.c
index 928a5ff..552c494 100755
--- a/source/Concept/Framework/modules/executor/navigator.c
+++ b/source/Concept/Framework/modules/executor/navigator.c
@@ -86,15 +86,36 @@ void Navigator::DriveTo(float newX, float newY, float newAngle, float newSpeed,
}
CalculateDirection();
+}
+
+void Navigator::RotateTo(float newAngle, float rotationSpeed) {
+ Position_Tracker* locationeer = parent->GetModule<Position_Tracker>(IO_POSITION_TRACKER_MAIN);
+
+ this->rotationSpeed = min(rotationSpeed, 255.0f);
+ this->targetAngle = newAngle * PI / 180.0f;
+
+ if(targetAngle - locationeer->GetOrientation() > PI)
+ {
+ if(rotationSpeed > 0)
+ {
+ rotationSpeed = -rotationSpeed;
+ }
+ }
+ else
+ {
+ if(rotationSpeed < 0)
+ {
+ rotationSpeed = -rotationSpeed;
+ }
+ }
+
+ CalculateDirection();
}
-
-//-----------------------------------------------------------------------------
-void Navigator::Update()
-{
+
+bool Navigator::TargetReached() {
Position_Tracker* locationeer = parent->GetModule<Position_Tracker>(IO_POSITION_TRACKER_MAIN);
bool targetReached = false;
- bool targetAngleReached = false;
if(HasTarget() && distance2d(targetX, targetY, locationeer->GetPositionX(), locationeer->GetPositionY()) < 1.0f)
{
@@ -106,6 +127,14 @@ void Navigator::Update()
targetReached = true;
}
+ return targetReached;
+}
+
+bool Navigator::AngleReached() {
+ Position_Tracker* locationeer = parent->GetModule<Position_Tracker>(IO_POSITION_TRACKER_MAIN);
+
+ bool targetAngleReached = false;
+
if(targetAngle != EMPTY_FLOAT && fabs(targetAngle - locationeer->GetOrientation()) < 0.1f)
{
targetAngle = EMPTY_FLOAT;
@@ -113,15 +142,20 @@ void Navigator::Update()
targetAngleReached = true;
}
-
- if(targetReached && targetAngleReached)
+ return targetAngleReached;
+}
+
+//-----------------------------------------------------------------------------
+void Navigator::Update()
+{
+ if(TargetReached() && AngleReached())
{
Stop();
}
- else if(targetReached || targetAngleReached)
+ /*else if(HasTarget() && !TargetReached())
{
CalculateDirection();
- }
+ }*/
if(!(correctionCountdown--))
{
diff --git a/source/Concept/Framework/modules/executor/navigator.h b/source/Concept/Framework/modules/executor/navigator.h
index 81919f9..7f4b36d 100755
--- a/source/Concept/Framework/modules/executor/navigator.h
+++ b/source/Concept/Framework/modules/executor/navigator.h
@@ -49,6 +49,7 @@ public:
void Drive(float newDirection, float newAngle, float newSpeed, float rotationSpeed);
void DriveTo(float newX, float newY, float newAngle, float newSpeed, float rotationSpeed);
+ void RotateTo(float newAngle,float roationSpeed);
void Rotate(float rotationSpeed);
@@ -65,6 +66,9 @@ public:
{
return (targetX != EMPTY_FLOAT && targetY != EMPTY_FLOAT);
}
+
+ bool TargetReached();
+ bool AngleReached();
};
#endif
diff --git a/source/Concept/Framework/modules/input/distance_sensor.c b/source/Concept/Framework/modules/input/distance_sensor.c
index 1ab3755..239e63b 100755
--- a/source/Concept/Framework/modules/input/distance_sensor.c
+++ b/source/Concept/Framework/modules/input/distance_sensor.c
@@ -1,22 +1,12 @@
-#include "distance_sensor.h"
-
-/*!
- * SRF10 initialsieren
- */
-
-void Distance_Sensor::srf10_init(void){
- srf10_set_range(SRF10_MAX_RANGE);
- //srf10_set_range(6); //Mit diesem Wert muss man spielen um das Optimum zu ermitteln
-return;
-}
-
-/*!
- * Verstaerkungsfaktor setzen
- * @param gain Verstaerkungsfaktor
- */
-
-void Distance_Sensor::srf10_set_gain(unsigned char gain){
- if(gain>16) { gain=16; }
+#include "distance_sensor.h"
+
+//-----------------------------------------------------------------------------
+void Distance_Sensor::SetSignalFactor(uint8 factor)
+{
+ if(factor > 16)
+ {
+ factor = 16;
+ }
uint8 temp[2];
uint8 state;
@@ -24,30 +14,59 @@ void Distance_Sensor::srf10_set_gain(unsigned char gain){
state = SUCCESS;
- tx_frame[0].slave_adr = this->slaveAddr+W;
+ tx_frame[0].slave_adr = this->slaveAddr + W;
tx_frame[0].size = 2;
tx_frame[0].data_ptr = temp;
tx_frame[0].data_ptr[0] = 1;
- tx_frame[0].data_ptr[1] = gain;
+ tx_frame[0].data_ptr[1] = factor;
tx_frame[1].slave_adr = OWN_ADR;
state = Send_to_TWI(tx_frame);
+}
+
+//-----------------------------------------------------------------------------
+void Distance_Sensor::SetSlaveAddress(uint8 newSlaveAddress)
+{
+ uint8 temp[2];
+ uint8 state;
+ tx_type tx_frame[2];
+
+ state = SUCCESS;
+
+ tx_frame[0].slave_adr = this->slaveAddr + W;
+ tx_frame[0].size = 2;
+ tx_frame[0].data_ptr = temp;
+ tx_frame[0].data_ptr[0] = 0;
+ tx_frame[0].data_ptr[1] = 160;
+ tx_frame[1].slave_adr = OWN_ADR;
+ state = Send_to_TWI(tx_frame);
+
+ msleep(60);
+
+ tx_frame[0].data_ptr[1] = 170;
+ state = Send_to_TWI(tx_frame);
+
+ msleep(60);
+
+ tx_frame[0].data_ptr[1] = 165;
+ state = Send_to_TWI(tx_frame);
+
+ msleep(60);
+
+ tx_frame[0].data_ptr[1] = newSlaveAddress;
+ state = Send_to_TWI(tx_frame);
}
-/*!
- * Reichweite setzen, hat auch Einfluss auf die Messdauer
- * @param millimeters Reichweite in mm
- */
-
-void Distance_Sensor::srf10_set_range(unsigned int millimeters){
+//-----------------------------------------------------------------------------
+void Distance_Sensor::SetRange(unsigned int millimeters){
uint8 temp[2];
uint8 state;
tx_type tx_frame[2];
state = SUCCESS;
- millimeters= (millimeters/43);
+ millimeters = (millimeters/43);
tx_frame[0].slave_adr = this->slaveAddr+W;
tx_frame[0].size = 2;
@@ -85,14 +104,9 @@ uint8 Distance_Sensor::srf10_ping(uint8 metric_unit){
return state;
}
-
-/*!
- * Register auslesen
- * @param srf10_register welches Register soll ausgelsen werden
- * @return Inhalt des Registers
- */
-
-uint8 Distance_Sensor::srf10_read_register(uint8 srf10_register){
+
+//-----------------------------------------------------------------------------
+uint8 Distance_Sensor::ReadRegister(uint8 registerToRead){
uint8 temp;
uint8 value;
uint8 state;
@@ -104,7 +118,7 @@ uint8 Distance_Sensor::srf10_read_register(uint8 srf10_register){
tx_frame[0].slave_adr = this->slaveAddr+W;
tx_frame[0].size = 1;
tx_frame[0].data_ptr = &temp;
- tx_frame[0].data_ptr[0] = srf10_register;
+ tx_frame[0].data_ptr[0] = registerToRead;
tx_frame[1].slave_adr = this->slaveAddr+R;
tx_frame[1].size = 1;
@@ -130,10 +144,10 @@ uint16 Distance_Sensor::srf10_get_measure(){
state = SUCCESS;
state = srf10_ping(SRF10_CENTIMETERS);
- usleep(10); //Optimierungs Potential
- lob=srf10_read_register(SRF10_LOB);
- usleep(10); //Optimierungs Potential
- hib=srf10_read_register(SRF1sr0_HIB);
+ msleep(10); //Optimierungs Potential
+ lob=ReadRegister(SRF10_LOB);
+ msleep(10); //Optimierungs Potential
+ hib=ReadRegister(SRF10_HIB);
return (hib*256)+lob;
}
diff --git a/source/Concept/Framework/modules/input/distance_sensor.h b/source/Concept/Framework/modules/input/distance_sensor.h
index 9fb2c58..0bb2baf 100755
--- a/source/Concept/Framework/modules/input/distance_sensor.h
+++ b/source/Concept/Framework/modules/input/distance_sensor.h
@@ -9,9 +9,9 @@
#define SRF10_MIN_RANGE 0 /*!< Minimale Reichweite 43mm */
#define SRF10_MAX_RANGE 5977 /*!< Maximale Reichweite 5977mm */
-#define SRF10_INCHES 0X50 /*!< Messung in INCHES */
-#define SRF10_CENTIMETERS 0X51 /*!< Messung in CM */
-#define SRF10_MICROSECONDS 0X52 /*!< Messung in Millisekunden */
+#define SRF10_INCHES 0x50 /*!< Messung in INCHES */
+#define SRF10_CENTIMETERS 0x51 /*!< Messung in CM */
+#define SRF10_MICROSECONDS 0x52 /*!< Messung in Millisekunden */
#define SRF10_COMMAND 0 /*!< W=Befehls-Register R=Firmware*/
#define SRF10_LIGHT 1 /*!< W=Verstaerkungsfaktor R=Nicht benutzt */
@@ -50,55 +50,44 @@ public:
default:
this->slaveAddr = 0;
break;
- }
-
- // initialiate the sensor
- srf10_init();
+ }
+
+ //SetRange(100);
+ SetRange(2000);
+ SetSignalFactor(0x06);
}
protected:
//Hardware
- slaveAddr;
-
- /*!
- * SRF10 initialsieren
- */
-extern void srf10_init(void);
-
-/*!
- * Verstaerkungsfaktor setzen
- * @param gain Verstaerkungsfaktor
- */
-extern void srf10_set_gain(uint8 gain);
-
-/*!
- * Reichweite setzen, hat auch Einfluss auf die Messdauer
- * @param millimeters Reichweite in mm
- */
-extern void srf10_set_range(uint16 millimeters);
+ uint8 slaveAddr;
+
+ void SetSignalFactor(uint8 factor);
+
+ void SetRange(uint16 millimeters);
/*!
* Messung ausloesen
* @param metric_unit 0x50 in Zoll, 0x51 in cm, 0x52 ms
* @return Resultat der Aktion
*/
-extern uint8 srf10_ping(uint8 metric_unit);
+ uint8 srf10_ping(uint8 metric_unit);
/*!
* Register auslesen
* @param srf10_register welches Register soll ausgelsen werden
* @return Inhalt des Registers
*/
-extern uint8 srf10_read_register(uint8 SRF10_register);
+ uint8 ReadRegister(uint8 registerToRead);
/*!
* Messung starten Ergebniss aufbereiten und zurueckgeben
* @return Messergebniss
*/
-extern uint16 srf10_get_measure(void);
+ uint16 srf10_get_measure(void);
public:
- float GetDistance();
+ uint16 GetDistance();
+ void SetSlaveAddress(uint8 newSlaveAddress);
};
#endif
diff --git a/source/Concept/Framework/modules/input/ir_sensor.h b/source/Concept/Framework/modules/input/ir_sensor.h
index 74396ec..c8f692b 100755
--- a/source/Concept/Framework/modules/input/ir_sensor.h
+++ b/source/Concept/Framework/modules/input/ir_sensor.h
@@ -34,11 +34,11 @@ public:
break;
case IO_SENSOR_IR_100_DEG:
this->channel = 3;
- this->intensityCorrection = 40;
+ this->intensityCorrection = 80;
break;
case IO_SENSOR_IR_180_DEG:
this->channel = 4;
- this->intensityCorrection = 50;
+ this->intensityCorrection = 70;
break;
case IO_SENSOR_IR_260_DEG:
this->channel = 5;
diff --git a/source/Concept/Framework/modules/interpreter/ball_tracker.c b/source/Concept/Framework/modules/interpreter/ball_tracker.c
index 2d85b96..16fdfb4 100755
--- a/source/Concept/Framework/modules/interpreter/ball_tracker.c
+++ b/source/Concept/Framework/modules/interpreter/ball_tracker.c
@@ -21,6 +21,21 @@ void Ball_Tracker::Update()
{
greatestIntensity = i;
}
+
+ if(i == 0)
+ {
+ if(intensity[i] > BALL_HELD_INTENSITY) // Ball derzeit sehr nah dran
+ {
+ ballHeld = true;
+ ballHeldCounter = 100;
+ }
+ else if(ballHeldCounter > 0) // Oder vor kurzem erst sehr nah dran
+ {
+ ballHeld = true;
+ ballHeldCounter--;
+ }
+ else ballHeld = false; // ansonsten hat er den Ball nicht
+ }
}
if(intensity[greatestIntensity])
diff --git a/source/Concept/Framework/modules/interpreter/ball_tracker.h b/source/Concept/Framework/modules/interpreter/ball_tracker.h
index c62f05e..cb90ff2 100755
--- a/source/Concept/Framework/modules/interpreter/ball_tracker.h
+++ b/source/Concept/Framework/modules/interpreter/ball_tracker.h
@@ -11,6 +11,8 @@ public:
this->parent = NULL;
this->moduleId = 0;
this->direction = EMPTY_FLOAT;
+ this->ballHeldCounter = 0;
+ this->ballHeld = false;
}
Ball_Tracker(uint32 trackerId)
@@ -18,10 +20,14 @@ public:
this->parent = NULL;
this->moduleId = trackerId;
this->direction = EMPTY_FLOAT;
+ this->ballHeldCounter = 0;
+ this->ballHeld = false;
}
protected:
float direction;
+ uint8 ballHeldCounter;
+ bool ballHeld;
public:
void Update();
@@ -33,12 +39,12 @@ public:
bool KnowsBallDirection()
{
- return direction != EMPTY_FLOAT;
+ return (direction != EMPTY_FLOAT);
}
bool RobotHasBall()
{
- //fill me!
+ return ballHeld;
}
};
diff --git a/source/Concept/Framework/modules/interpreter/position_tracker.c b/source/Concept/Framework/modules/interpreter/position_tracker.c
index a64ab60..f6d67ac 100755
--- a/source/Concept/Framework/modules/interpreter/position_tracker.c
+++ b/source/Concept/Framework/modules/interpreter/position_tracker.c
@@ -10,6 +10,10 @@ void Position_Tracker::Update()
// Generate a vector for the left mouse
int8 leftX = mouseLeft->GetXMovement();
int8 leftY = mouseLeft->GetYMovement();
+ // Generate a vector for the right mouse
+ int8 rightX = mouseRight->GetXMovement();
+ int8 rightY = mouseRight->GetYMovement();
+
float distanceLeft = sqrt(leftX * leftX + leftY * leftY);
float angleLeft = easyAngle(atan2(leftY, leftX) + (225.0f * PI / 180.0f));
@@ -23,9 +27,6 @@ void Position_Tracker::Update()
movementLeftY = 0;
}
- // Generate a vector for the right mouse
- int8 rightX = mouseRight->GetXMovement();
- int8 rightY = mouseRight->GetYMovement();
float distanceRight = sqrt(rightX * rightX + rightY * rightY);
float angleRight = easyAngle(atan2(rightY, rightX) - (45.0f * PI / 180.0f));
@@ -50,13 +51,9 @@ void Position_Tracker::Update()
float robotMovementY = movementDifferenceY / 2.0f;
robotMovementX += movementLeftX + mouseLeft->GetPositionX() + (-mouseLeft->GetPositionX() * cos(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;
- float absoluteDiffY = sin(this->orientation + (orientationDiff / 2.0f) + PI / 2.0f) * robotMovementY + cos(this->orientation + (orientationDiff / 2.0f) - PI / 2.0f) * robotMovementX;
- //float absoluteDiffX = cos(this->orientation + (orientationDiff / 2.0f)) * robotDistance * sign(robotMovementX);
- //float absoluteDiffY = sin(this->orientation + (orientationDiff / 2.0f)) * robotDistance * sign(robotMovementY);
+ float absoluteDiffX = cos(this->orientation + (orientationDiff / 2.0f)) * robotMovementX + sin(this->orientation + (orientationDiff / 2.0f)) * robotMovementY;
+ float absoluteDiffY = sin(this->orientation + (orientationDiff / 2.0f) + PI / 2.0f) * robotMovementY - cos(this->orientation + (orientationDiff / 2.0f) - PI / 2.0f) * robotMovementX;
if(!robotMovementX && !robotMovementY)
{
@@ -74,4 +71,10 @@ void Position_Tracker::Update()
this->orientation += orientationDiff;
this->orientation = easyAngle(this->orientation);
+
+ //(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(" ", 5, 1);
+ /*(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Clear();
+ (parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(this->orientation * 180.0f / PI, 5, 1);
+ (parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(this->positionX, 1, 2);
+ (parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(this->positionY, 1, 3);*/
}
diff --git a/source/Concept/Framework/modules/interpreter/position_tracker.h b/source/Concept/Framework/modules/interpreter/position_tracker.h
index 47d0740..56b16c4 100755
--- a/source/Concept/Framework/modules/interpreter/position_tracker.h
+++ b/source/Concept/Framework/modules/interpreter/position_tracker.h
@@ -51,8 +51,8 @@ public:
// returns orientation
float GetOrientation() {
- return 0.0f; //tmp!!!!!!!!!!
- //return orientation;
+ //return 0.0f; //tmp!!!!!!!!!!
+ return orientation;
}
};
diff --git a/source/Concept/Framework/robot.c b/source/Concept/Framework/robot.c
index 9985463..a630d4a 100755
--- a/source/Concept/Framework/robot.c
+++ b/source/Concept/Framework/robot.c
@@ -92,6 +92,8 @@ void Robot::Update()
GetModule<Position_Tracker>(IO_POSITION_TRACKER_MAIN)->Update();
+ GetModule<Logic>(IO_LOGIC_MAIN)->Update();
+
GetModule<Navigator>(IO_NAVIGATOR_MAIN)->Update();
//insert code here