Nedenfor findes den tilstandsmaskine, Willy brugte til at køre gennem RoboCup banen i 2005.
Hver state består af tre ting:
- Initial: Det som sker, førtste gang robotten kommer ind i den pågældende tilstand.
- Action: Det som skal ske, så længe robotten er i tilstanden.
- Goto: Betingelser, der skal være opfyldt, for at robotten skifter til en anden tilstand.
Tilstandsmaskinen består af 62 tilstande.
| Start | |
|---|---|
| Initial | Set speed=1.25 m/s acc=5 dacc=1 Set linesensor threshold=160, background=100, line color=black Reset encoders Set servo 1 to position 127 |
| Action | Follow line at center edge |
| Goto | Mod væg port if left encoder > 349.7 cm |
| Mod væg port | |
|---|---|
| Initial | Set speed=1.00 m/s acc=1 dacc=1 Reset encoders Set servo 0 to position -61 Reset encoders |
| Action | Do nothing |
| Goto | Lige mod væg if right encoder > 49.9 cm |
| Lige mod væg | |
|---|---|
| Initial | Reset encoders Set speed=0.62 m/s acc=1 dacc=1 |
| Action | Drive straight |
| Goto | Finde streg ved væg if left encoder > 175.8 cm |
| Finde streg ved væg | |
|---|---|
| Initial | Set servo 0 to position -80 |
| Action | Do nothing |
| Goto | Streg ved væg if left encoder > 34.8 cm |
| Streg ved væg | |
|---|---|
| Initial | Set speed=0.25 m/s acc=2 dacc=2 |
| Action | Follow line at center edge |
| Goto | Drej tæt på væg if All line |
| Drej tæt på væg | |
|---|---|
| Initial | Set speed=0.50 m/s acc=1 dacc=1 Set servo 0 to position -127 Reset encoders |
| Action | Do nothing |
| Goto | Drej ud fra væg if right encoder > 80.4 cm |
| Drej ud fra væg | |
|---|---|
| Initial | Set servo 0 to position 90 Reset encoders |
| Action | Do nothing |
| Goto | Følge væg 1 if left encoder > 30.5 cm |
| Følge væg 1 | |
|---|---|
| Initial | Set speed=0.50 m/s acc=1 dacc=1 |
| Action | Follow wall at distance 20.0 cm |
| Goto | Dreje rundt om væg if distance sensor 1 > 50.0 cm |
| Dreje rundt om væg | |
|---|---|
| Initial | Set servo 0 to position -120 Reset encoders Set speed=0.50 m/s acc=2 dacc=1 |
| Action | Do nothing |
| Goto | Følge væg 2 if right encoder > 120.0 cm |
| Følge væg 2 | |
|---|---|
| Initial | Set speed=0.38 m/s acc=1 dacc=1 |
| Action | Follow wall at distance 30.0 cm |
| Goto | Drej ind på streg if One line |
| Drej ind på streg | |
|---|---|
| Initial | Set servo 0 to position -127 Set speed=0.38 m/s acc=5 dacc=5 Reset encoders |
| Action | Do nothing |
| Goto | Tilbage for at undgå portben if right encoder > 21.8 cm |
| Tilbage for at undgå portben | |
|---|---|
| Initial | Set speed=-0.25 m/s acc=1 dacc=10 Reset encoders Set servo 0 to position 60 |
| Action | Do nothing |
| Goto | Efter væg if One line |
| Efter væg | |
|---|---|
| Initial | Set speed=0.50 m/s acc=2 dacc=1 Reset encoders Set linesensor threshold=160, background=127, line color=black |
| Action | Follow line at center edge |
| Goto | Venstre kant mod fri port if left encoder > 59.8 cm |
| Venstre kant mod fri port | |
|---|---|
| Følger flisekant | |
| Initial | Reset encoders Set speed=0.50 m/s acc=1 dacc=1 |
| Action | Follow line at left edge |
| Goto | Drej ud til fri if left encoder > 135.4 cm |
| Drej ud til fri | |
|---|---|
| Initial | Set servo 0 to position -80 Reset encoders |
| Action | Do nothing |
| Goto | Ret op mod tunnel if right encoder > 33.7 cm |
| Ret op mod tunnel | |
|---|---|
| Initial | Set servo 0 to position 60 Reset encoders |
| Action | Do nothing |
| Goto | Forbi fliser if left encoder > 53.9 cm |
| Forbi fliser | |
|---|---|
| Initial | Reset encoders Set servo 0 to position 0 |
| Action | Drive straight |
| Goto | Find linie ved tunnel if left encoder > 160.0 cm |
| Find linie ved tunnel | |
|---|---|
| Initial | Reset encoders |
| Action | Drive straight |
| Goto | Drej ind på linie ved tunnel if left encoder > 69.7 cm Drej ind på linie ved tunnel if One line |
| Drej ind på linie ved tunnel | |
|---|---|
| Initial | Set servo 0 to position -40 Reset encoders |
| Action | Do nothing |
| Goto | Følg linie mod tunnel if right encoder > 14.7 cm |
| Følg linie mod tunnel | |
|---|---|
| Initial | Set speed=0.25 m/s acc=1 dacc=1 Set linesensor threshold=160, background=127, line color=black |
| Action | Follow line at center edge |
| Goto | Bak tilbage ved tunnel if button front left, or front right is on |
| Bak tilbage ved tunnel | |
|---|---|
| Initial | Set servo 0 to position -100 Set speed=-0.55 m/s acc=1 dacc=10 Reset encoders |
| Action | Do nothing |
| Goto | Fortsæt bagud forbi låge if right encoder < -155.6 cm |
| Fortsæt bagud forbi låge | |
|---|---|
| Initial | Set servo 0 to position 0 Reset encoders |
| Action | Do nothing |
| Goto | Ret op if left encoder < -59.8 cm |
| Ret op | |
|---|---|
| Så robotten er parallel med tunnel side | |
| Initial | Set servo 0 to position 52 Reset encoders |
| Action | Do nothing |
| Goto | Fremad for at åbne tunnel dør if left encoder < -24.9 cm |
| Fremad for at åbne tunnel dør | |
|---|---|
| Initial | Set speed=0.75 m/s acc=10 dacc=1 Set servo 0 to position 0 Reset encoders |
| Action | Do nothing |
| Goto | Lidt væk fra tunnel if right encoder > 29.7 cm |
| Lidt væk fra tunnel | |
|---|---|
| Robotten kan ikke dreje helt skarpt nok ind til linien, så den skal lige lidt væk først | |
| Initial | Set speed=0.50 m/s acc=40 dacc=40 Reset encoders Set servo 0 to position 60 |
| Action | Do nothing |
| Goto | Gennem åben dør if right encoder > 24.9 cm |
| Gennem åben dør | |
|---|---|
| Initial | Set servo 0 to position -127 Reset encoders Set speed=0.50 m/s acc=1 dacc=1 |
| Action | Do nothing |
| Goto | Linie gennem tunnel if right encoder > 104.9 cm |
| Linie gennem tunnel | |
|---|---|
| Initial | Set speed=0.38 m/s acc=1 dacc=1 Reset encoders |
| Action | Follow line at center edge |
| Goto | Forbi flise efter tunnel if All line |
| Forbi flise efter tunnel | |
|---|---|
| Robotten har problemer med fliserne, så der køres med fast vinkel på forhjulene, når fliserne nås.Denne state kan også være nået, hvis robotten ikke ramte lågen, som derfor ikke er åbnet. I så fald vil robotten nu være kørt ind i lågen, hvorfor den nu skal forsøge at åbne den igen | |
| Initial | Set servo 0 to position 75 Reset encoders |
| Action | Do nothing |
| Goto | Linje før racerbane if left encoder > 50.7 cm Bak tilbage ved tunnel if button front left, or front right is on |
| Linje før racerbane | |
|---|---|
| Initial | Set speed=0.75 m/s acc=2 dacc=1 Set linesensor threshold=160, background=100, line color=black |
| Action | Follow line at left edge |
| Goto | Flise før racerbane if All line |
| Flise før racerbane | |
|---|---|
| Robot har problemer med fliserne, så der køres med fast vinkel på forhjulene, når fliserne nås. | |
| Initial | Set servo 0 to position -17 Set speed=1.50 m/s acc=3 dacc=1 Reset encoders |
| Action | Do nothing |
| Goto | Racerbane 1 if left encoder > 49.9 cm |
| Racerbane 1 | |
|---|---|
| Initial | Reset encoders |
| Action | Follow line at center edge |
| Goto | Racerbane 2 if left encoder > 269.3 cm |
| Racerbane 2 | |
|---|---|
| Sving tages med lavere hastighed | |
| Initial | Set speed=1.12 m/s acc=5 dacc=1 Reset encoders |
| Action | Follow line at center edge |
| Goto | Racerbane 3 if left encoder > 219.4 cm |
| Racerbane 3 | |
|---|---|
| Sving tages med lavere hastighed | |
| Initial | Set speed=1.12 m/s acc=2 dacc=1 Reset encoders |
| Action | Do nothing |
| Goto | Racerbane 4 if left encoder > 59.8 cm |
| Racerbane 4 | |
|---|---|
| Lige ud, så sæt farten op (lav acceleration) | |
| Initial | Set speed=1.50 m/s acc=1 dacc=5 Reset encoders |
| Action | Follow line at center edge |
| Goto | Flise efter racerbane if All line |
| Flise efter racerbane | |
|---|---|
| Initial | Set servo 0 to position -10 Reset encoders Set speed=0.75 m/s acc=5 dacc=5 |
| Action | Do nothing |
| Goto | Linje efter racerbane if left encoder > 49.9 cm |
| Linje efter racerbane | |
|---|---|
| Initial | Set speed=0.50 m/s acc=5 dacc=5 Set linesensor threshold=160, background=127, line color=black |
| Action | Follow line at center edge |
| Goto | Flise før rampe if All line |
| Flise før rampe | |
|---|---|
| Initial | Set servo 0 to position -43 Reset encoders |
| Action | Do nothing |
| Goto | Op ad rampe if right encoder > 40.0 cm |
| Op ad rampe | |
|---|---|
| Initial | Reset encoders Set linesensor threshold=160, background=127, line color=black Set speed=1.25 m/s acc=2 dacc=5 |
| Action | Follow line at center edge |
| Goto | Forbi forgrening mod trappe if left encoder > 480.0 cm |
| Forbi forgrening mod trappe | |
|---|---|
| Initial | Reset encoders Set linesensor threshold=80, background=127, line color=black Reset encoders Set speed=1.00 m/s acc=3 dacc=3 |
| Action | Follow line at right edge |
| Goto | Ned af rampe if left encoder > 109.7 cm |
| Ned af rampe | |
|---|---|
| Initial | Set speed=0.25 m/s acc=1 dacc=1 Set linesensor threshold=100, background=127, line color=black Reset encoders |
| Action | Follow line at center edge |
| Goto | Bakke op ad rampe if right encoder > 209.9 cm |
| Bakke op ad rampe | |
|---|---|
| Langsomt, da hjulene skrider på rampen. | |
| Initial | Set servo 0 to position 0 Set speed=-0.25 m/s acc=50 dacc=50 Reset encoders |
| Action | Do nothing |
| Goto | Bakke op ad rampe 2 if left encoder < -29.7 cm |
| Bakke op ad rampe 2 | |
|---|---|
| Det bakkes indtil motorregulerings I-værdi begynder at stige (fra meget negativ mod 0), hvilket er ensbetydende med, at robotten nu står på podiet. (forige state hvor der bakkes 30 cm tilbage er indsat, for at I-værdien kan nå at blive meget negativ) | |
| Initial | Reset encoders |
| Action | Do nothing |
| Goto | På podie 1 if I-value > -1700 |
| På podie 1 | |
|---|---|
| Bak tilbage | |
| Initial | Set servo 0 to position -90 Reset encoders |
| Action | Do nothing |
| Goto | På podie 2 if left encoder < -24.9 cm |
| På podie 2 | |
|---|---|
| Bak tilbage | |
| Initial | Set servo 0 to position 90 Reset encoders |
| Action | Do nothing |
| Goto | På podie 3 if right encoder < -27.7 cm |
| På podie 3 | |
|---|---|
| Frem mod trappe | |
| Initial | Set servo 0 to position -100 Set speed=0.25 m/s acc=10 dacc=10 Reset encoders |
| Action | Do nothing |
| Goto | På podie 4 if left encoder > 17.8 cm |
| På podie 4 | |
|---|---|
| Mod steg ved trappe | |
| Initial | Set servo 0 to position 116 Reset encoders |
| Action | Do nothing |
| Goto | Før trappe if One line |
| Før trappe | |
|---|---|
| Initial | Set speed=0.50 m/s acc=2 dacc=2 Set linesensor threshold=160, background=127, line color=black Reset encoders |
| Action | Follow line at center edge |
| Goto | Efter trappe if left encoder > 259.8 cm |
| Efter trappe | |
|---|---|
| Bak tilbage for at rette op | |
| Initial | Set servo 0 to position 0 Reset encoders Set speed=-0.50 m/s acc=3 dacc=3 Set servo 1 to position 100 |
| Action | Do nothing |
| Goto | Frem mod bold if right encoder < -49.9 cm |
| Frem mod bold | |
|---|---|
| Sænk boldfanger halvt ned | |
| Initial | Reset encoders Set speed=0.62 m/s acc=1 dacc=1 Set servo 0 to position 13 Set servo 1 to position -90 |
| Action | Do nothing |
| Goto | Dreje mod bold if left encoder > 109.7 cm |
| Dreje mod bold | |
|---|---|
| Initial | Set servo 0 to position -127 Reset encoders |
| Action | Do nothing |
| Goto | Hen til bold if right encoder > 54.6 cm |
| Hen til bold | |
|---|---|
| Bolden ender under boldfanger i denne state | |
| Initial | Set speed=0.38 m/s acc=1 dacc=1 Reset encoders |
| Action | Follow line at center edge |
| Goto | Med bold if left encoder > 69.7 cm |
| Med bold | |
|---|---|
| Boldfanger sænkes yderligere | |
| Initial | Set speed=0.75 m/s acc=1 dacc=1 Set servo 1 to position -120 |
| Action | Follow line at center edge |
| Goto | Efter bold-port, søg efter flisekant if left encoder > 329.9 cm |
| Efter bold-port, søg efter flisekant | |
|---|---|
| Initial | Set speed=0.25 m/s acc=1 dacc=1 Set linesensor threshold=160, background=127, line color=black |
| Action | Follow line at center edge |
| Goto | Flise før rød port if All line |
| Flise før rød port | |
|---|---|
| Boldfanger hæves, så bold kan trille væk samtidig med at der drejes | |
| Initial | Set servo 0 to position -52 Set speed=0.50 m/s acc=1 dacc=1 Reset encoders Set servo 1 to position 127 |
| Action | Do nothing |
| Goto | Lige ud før rød port if right encoder > 114.8 cm |
| Lige ud før rød port | |
|---|---|
| For at komme forbi kabelbrønden, så flisernes kant kan følges | |
| Initial | Reset encoders |
| Action | Drive straight |
| Goto | Følg flisekant if left encoder > 40.0 cm |
| Følg flisekant | |
|---|---|
| Initial | Reset encoders Set speed=0.75 m/s acc=1 dacc=1 |
| Action | Follow line at right edge |
| Goto | Efter rød port if left encoder > 94.6 cm |
| Efter rød port | |
|---|---|
| Drej væk fra flisekant | |
| Initial | Set servo 0 to position 110 Reset encoders |
| Action | Do nothing |
| Goto | Efter rød port if left encoder > 44.7 cm |
| Efter rød port | |
|---|---|
| Drej mod streg | |
| Initial | Set servo 0 to position -90 |
| Action | Do nothing |
| Goto | Linje efter rød port if One line |
| Linje efter rød port | |
|---|---|
| Initial | Set speed=0.75 m/s acc=1 dacc=1 |
| Action | Follow line at center edge |
| Goto | Sidste flise if All line |
| Sidste flise | |
|---|---|
| Initial | Set servo 0 to position -35 Reset encoders |
| Action | Do nothing |
| Goto | Til mål if right encoder > 40.0 cm |
| Til mål | |
|---|---|
| Action | Follow line at center edge |
| Goto | Slut if button front left, or front right is on |
| Slut | |
|---|---|
| Stop robotten | |
| Initial | Set speed=0.00 m/s acc=5 dacc=5 |
| Action | Do nothing |
| Goto | Slut if Never |