Nedenfor findes den tilstandsmaskine, Willy brugte til at køre gennem RoboCup banen i 2007.
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 76 tilstande.
| Start |
|---|
| Initial | Set speed=0.75 m/s acc=3 dacc=3
Reset encoders
|
| Action | Follow line at center edge, offset 0 |
| Goto | Racerbane 1 if right encoder > 1009.8 cm
|
| Racerbane 1 |
|---|
| Initial | Set speed=1.62 m/s acc=10 dacc=3
Reset encoders
|
| Action | Follow line at center edge, offset 0 |
| Goto | Racerbane 2 if left encoder > 430.5 cm
|
| Racerbane 2 |
|---|
| Initial | Set speed=0.75 m/s acc=1 dacc=20
Reset encoders
|
| Action | Follow line at center edge, offset 2 |
| Goto | Racerbane 3 if left encoder > 360.0 cm
|
| Racerbane 3 |
|---|
| Initial | Set speed=1.62 m/s acc=3 dacc=3
Reset encoders
|
| Action | Follow line at center edge, offset 0 |
| Goto | Racerbane 4 if left encoder > 229.7 cm
|
| Racerbane 4 |
|---|
| Initial | Reset encoders
Set speed=1.38 m/s acc=3 dacc=20
|
| Action | Follow line at center edge, offset 0 |
| Goto | Efter racerbane if left encoder > 99.8 cm
|
| Efter racerbane |
|---|
| Initial | Set speed=0.00 m/s acc=20 dacc=20
|
| Action | Follow line at center edge, offset 0 |
| Goto | Krydse flisen efter racerbanen if Time > 1.00 s
|
| Krydse flisen efter racerbanen |
|---|
| Initial | Set speed=0.25 m/s acc=1 dacc=1
Reset encoders
Camera Light = [1]
|
| Action | Follow line at left edge, offset 0 |
| Goto | Krydse flisen før den blinkende port if left encoder > 200.0 cm
|
| Krydse flisen før den blinkende port |
|---|
| Initial | Set speed=0.25 m/s acc=1 dacc=1
Set servo 1 to position 100
|
| Action | Follow line at center edge, offset 0 |
| Goto | Frem mod den blinkende port if background is dark
|
| Frem mod den blinkende port |
|---|
| Initial | Set speed=0.25 m/s acc=1 dacc=1
Reset encoders
|
| Action | Follow line at center edge, offset 0 |
| Goto | Det sidste stykke til portbenet if left encoder > 149.7 cm
|
| Det sidste stykke til portbenet |
|---|
| Initial | Reset encoders
|
| Action | Drive straight distance 42.8 cm at maximum speed 10 |
| Goto | Afvent beslutning if At position
|
| Afvent beslutning |
|---|
| Action | Do nothing |
| Goto | Beslutning if Time > 1.50 s
|
| Uden om første port i blinkende port forhindringen |
|---|
| Initial | Reset encoders
|
| Action | Drive straight distance -19.8 cm at maximum speed 20 |
| Goto | Lidt frem drejende mod venstre if At position
|
| Lidt frem drejende mod venstre |
|---|
| Initial | Reset encoders
|
| Action | Drive radius 28 cm -42 deg. at maximum speed 20 |
| Goto | Halvbue uden om porten if At position
|
| Halvbue uden om porten |
|---|
| Initial | Reset encoders
|
| Action | Drive radius 40 cm 135 deg. at maximum speed 20 |
| Goto | Ind på streg igen if At position
|
| Følg streg gennem anden port |
|---|
| Initial | Set speed=0.25 m/s acc=1 dacc=1
Reset encoders
|
| Action | Follow line at center edge, offset 0 |
| Goto | Efter blinkende port forhindringen if left encoder > 49.9 cm
|
| Gennem første port i blinkende port forhindringen |
|---|
| Initial | Reset encoders
|
| Action | Drive straight distance -49.9 cm at maximum speed 10 |
| Goto | Gennem ikke blinkende port if At position
|
| Gennem ikke blinkende port |
|---|
| Initial | Reset encoders
Set speed=0.25 m/s acc=1 dacc=1
|
| Action | Follow line at center edge, offset 0 |
| Goto | Drej væk fra linien før anden port if left encoder > 109.7 cm
|
| Drej væk fra linien før anden port |
|---|
| Action | Drive radius 33 cm -90 deg. at maximum speed 20 |
| Goto | Rundt om anden port if At position
|
| Rundt om anden port |
|---|
| Action | Drive radius 30 cm 180 deg. at maximum speed 20 |
| Goto | Ind på stregen igen if At position
|
| Efter blinkende port forhindringen |
|---|
| Initial | Set speed=0.50 m/s acc=1 dacc=1
Reset encoders
|
| Action | Follow line at center edge, offset 0 |
| Goto | Mod golfbold if left encoder > 80.0 cm
|
| Mod golfbold |
|---|
| Initial | Set speed=0.50 m/s acc=1 dacc=1
Set servo 1 to position 100
Camera Light = [1]
|
| Action | Follow line at center edge, offset 0 |
| Goto | Bold fundet if Analog input 0 > 2500
|
| Bold fundet |
|---|
| Initial | Set servo 1 to position -100
Set speed=0.50 m/s acc=1 dacc=1
Reset encoders
|
| Action | Follow line at center edge, offset 0 |
| Goto | Op ad rampen if left encoder > 200.0 cm
|
| Op ad rampen |
|---|
| Initial | Reset encoders
|
| Action | Follow line at right edge, offset 0 |
| Goto | Lige frem mod hul if left encoder > 509.7 cm
|
| Lige frem mod hul |
|---|
| Initial | Reset encoders
|
| Action | Drive straight distance 59.8 cm at maximum speed 5 |
| Goto | Dreje mod hul if At position
|
| Dreje mod hul |
|---|
| Initial | Reset encoders
|
| Action | Drive radius 60 cm 23 deg. at maximum speed 5 |
| Goto | Tilbage mod linje if At position
|
| Tilbage mod linje |
|---|
| Initial | Reset encoders
|
| Action | Drive straight distance -59.8 cm at maximum speed 10 |
| Goto | Følge streg ned af rampe if At position
|
| Følge streg ned af rampe |
|---|
| Initial | Set speed=0.50 m/s acc=1 dacc=1
Set servo 1 to position 100
|
| Action | Follow line at center edge, offset 0 |
| Goto | Vende 1 if left encoder > 259.8 cm
|
| Vende 1 |
|---|
| Action | Drive radius 28 cm -90 deg. at maximum speed 20 |
| Goto | Vende 2 if At position
|
| Vende 2 |
|---|
| Action | Drive radius 28 cm 270 deg. at maximum speed 20 |
| Goto | Op ad rampen igen if At position
|
| Op ad rampen igen |
|---|
| Initial | Reset encoders
Set speed=0.50 m/s acc=1 dacc=1
Set servo 1 to position 100
|
| Action | Follow line at center edge, offset 0 |
| Goto | Op ad rampe 2 if left encoder > 120.0 cm
|
| Op ad rampe 2 |
|---|
| Initial | Set speed=0.25 m/s acc=1 dacc=1
|
| Action | Follow line at center edge, offset 0 |
| Goto | Cirkelbue mod bold if I-value < 2500
|
| Cirkelbue mod bold |
|---|
| Action | Drive radius 52 cm 142 deg. at maximum speed 10 |
| Goto | Bakke med bold if At position
Bakke med bold if Analog input 0 > 2500
|
| Bakke med bold |
|---|
| Initial | Set servo 0 to position -127
Set speed=-0.25 m/s acc=1 dacc=1
Reset encoders
Set servo 1 to position -100
|
| Action | Do nothing |
| Goto | Følge linje mod hul if right encoder < -69.7 cm
|
| Følge linje mod hul |
|---|
| Initial | Set speed=0.25 m/s acc=1 dacc=1
Reset encoders
|
| Action | Follow line at center edge, offset 0 |
| Goto | Mod hul (uden linje) if left encoder > 49.9 cm
|
| Mod hul (uden linje) |
|---|
| Action | Drive radius 57 cm 45 deg. at maximum speed 10 |
| Goto | Tilbage efter hul if At position
|
| Tilbage efter hul |
|---|
| Initial | Set speed=-0.25 m/s acc=1 dacc=1
Set servo 0 to position -127
Reset encoders
|
| Action | Do nothing |
| Goto | Ned af rampe if right encoder < -45.5 cm
|
| Ned af rampe |
|---|
| Initial | Set speed=0.25 m/s acc=1 dacc=1
Reset encoders
|
| Action | Follow line at center edge, offset 0 |
| Goto | Finde streg til højre if right encoder > 249.9 cm
|
| Finde streg til højre |
|---|
| Initial | Set speed=0.12 m/s acc=1 dacc=1
Reset encoders
Set servo 1 to position 100
|
| Action | Follow line at center edge, offset 0 |
| Goto | Dreje ud mod vippe if line to the right
|
| Dreje ud mod vippe |
|---|
| Initial | Reset encoders
Set servo 1 to position 100
|
| Action | Drive radius 28 cm 95 deg. at maximum speed 10 |
| Goto | Lidt frem på vippe if At position
|
| Lidt frem på vippe |
|---|
| Initial | Reset encoders
|
| Action | Drive straight distance 19.8 cm at maximum speed 10 |
| Goto | På vippe if At position
|
| På vippe |
|---|
| Initial | Set speed=0.25 m/s acc=1 dacc=1
|
| Action | Follow line at center edge, offset 0 |
| Goto | Efter vippe if No line
|
| Efter vippe |
|---|
| Initial | Reset encoders
|
| Action | Drive straight distance 55.0 cm at maximum speed 10 |
| Goto | Dreje mod tunnel if At position
|
| Dreje mod tunnel |
|---|
| Initial | Reset encoders
|
| Action | Drive radius 65 cm -90 deg. at maximum speed 15 |
| Goto | Frem mod tunnel if At position
|
| Frem mod tunnel |
|---|
| Initial | Reset encoders
Set speed=0.50 m/s acc=1 dacc=1
|
| Action | Drive straight |
| Goto | Vent if left encoder > 19.8 cm
|
| Vent |
|---|
| Initial | Set speed=0.00 m/s acc=10 dacc=10
|
| Action | Do nothing |
| Goto | Væk fra tunnel if Time > 1.50 s
|
| Væk fra tunnel |
|---|
| Initial | Reset encoders
Set speed=-0.25 m/s acc=1 dacc=1
Set servo 0 to position 0
|
| Action | Do nothing |
| Goto | Åbne dør if left encoder < -44.7 cm
|
| Åbne dør |
|---|
| Action | Drive radius 40 cm 115 deg. at maximum speed 25 |
| Goto | Gennem åben dør if At position
|
| Gennem åben dør |
|---|
| Initial | Reset encoders
|
| Action | Drive radius 33 cm -197 deg. at maximum speed 20 |
| Goto | Frem gennem tunnel if At position
|
| Frem gennem tunnel |
|---|
| Initial | Reset encoders
|
| Action | Drive straight distance 120.0 cm at maximum speed 10 |
| Goto | Efter tunnel 1 if At position
|
| Efter tunnel 1 |
|---|
| Initial | Reset encoders
|
| Action | Drive radius 40 cm 180 deg. at maximum speed 20 |
| Goto | Efter tunnel 2 if At position
|
| Efter tunnel 2 |
|---|
| Initial | Reset encoders
|
| Action | Drive straight distance 169.9 cm at maximum speed 20 |
| Goto | Efter tunnel 3 if At position
|
| Efter tunnel 3 |
|---|
| Action | Drive radius 35 cm -180 deg. at maximum speed 20 |
| Goto | Frem mod linje if At position
|
| Frem mod linje |
|---|
| Initial | Set speed=0.25 m/s acc=1 dacc=1
Reset encoders
|
| Action | Drive straight |
| Goto | Frem mod keglebane 1 if One line
|
| Frem mod keglebane 1 |
|---|
| Initial | Set speed=0.75 m/s acc=1 dacc=1
Reset encoders
|
| Action | Follow line at center edge, offset 0 |
| Goto | Frem mod keglebane 2 if right encoder > 400.0 cm
|
| Frem mod keglebane 2 |
|---|
| Initial | Set speed=0.25 m/s acc=1 dacc=1
|
| Action | Follow line at center edge, offset 0 |
| Goto | Frem mod keglebane 3 if background is dark
|
| Frem mod keglebane 3 |
|---|
| Initial | Set speed=0.75 m/s acc=1 dacc=1
Reset encoders
|
| Action | Follow line at left edge, offset 0 |
| Goto | Frem mod keglebane 4 if left encoder > 99.8 cm
|
| Frem mod keglebane 4 |
|---|
| Initial | Set speed=0.75 m/s acc=1 dacc=1
Reset encoders
|
| Action | Follow line at right edge, offset 0 |
| Goto | Frem mod keglebane 5 if left encoder > 789.6 cm
|
| Frem mod keglebane 5 |
|---|
| Initial | Set speed=0.25 m/s acc=1 dacc=1
Reset encoders
|
| Action | Follow line at center edge, offset 0 |
| Goto | Frem mod keglebane 6 if left encoder > 99.8 cm
|
| Frem mod keglebane 6 |
|---|
| Initial | Reset encoders
|
| Action | Drive radius 35 cm -90 deg. at maximum speed 20 |
| Goto | Frem mod keglebane 7 if At position
|
| Find tværstreg ved kegler |
|---|
| Initial | Set speed=0.12 m/s acc=1 dacc=1
|
| Action | Follow line at center edge, offset 0 |
| Goto | Dreje ind til kegler if button front left is on
|
| Dreje ind til kegler |
|---|
| Action | Drive radius 28 cm -85 deg. at maximum speed 10 |
| Goto | Linje ved kegler if At position
|
| Linje ved kegler |
|---|
| Initial | Set speed=0.12 m/s acc=1 dacc=1
|
| Action | Follow line at center edge, offset 0 |
| Goto | Ud fra streg if No line
|
| Ud fra streg |
|---|
| Action | Drive radius 90 cm -48 deg. at maximum speed 20 |
| Goto | Rundt om kegler if At position
|
| Rundt om kegler |
|---|
| Action | Drive radius 102 cm 274 deg. at maximum speed 20 |
| Goto | Ind mod streg if At position
|
| Find streg efter kegler |
|---|
| Initial | Set speed=0.12 m/s acc=1 dacc=1
|
| Action | Follow line at center edge, offset 0 |
| Goto | Drej mod mål if All line
|
| Drej mod mål |
|---|
| Action | Drive radius 28 cm -85 deg. at maximum speed 10 |
| Goto | Mod mål if At position
|
| Mod mål |
|---|
| Initial | Set speed=0.25 m/s acc=1 dacc=1
Reset encoders
Set servo 1 to position 100
|
| Action | Follow line at center edge, offset 0 |
| Goto | Delay if left encoder > 259.8 cm
|
| Væk fra mål |
|---|
| Initial | Set servo 0 to position 0
Set speed=-0.25 m/s acc=1 dacc=1
Reset encoders
Set servo 1 to position -100
|
| Action | Do nothing |
| Goto | Tilbage mod mål if left encoder < -9.9 cm
|
| Tilbage mod mål |
|---|
| Initial | Reset encoders
|
| Action | Drive straight distance 34.8 cm at maximum speed 10 |
| Goto | Slut if At position
|
| Slut |
|---|
| Initial | Set speed=0.00 m/s acc=10 dacc=10
Set servo 1 to position -100
|
| Action | Do nothing |
| Goto | Slut if Never
|