# Option joystick-controlled Root option of the joystick controlled behavior ## State Machine ## State initial
This state is a target state.
If that state is active,
> | The option joystick-head-control is executed.
> | These output symbols are set:
| sent-game-state | = | sent-game-state.initial
| leds.back-front-white | = | back-front-white.lloo
| leds.back-middle-white | = | back-middle-white.lloo
| leds.back-rear-white | = | back-rear-white.lloo
The decision tree:
Pseudo code of the decision tree:
if ( | game.own-team-scored | ) | // own team scored
{
transition-to-state(ready);
}
else if ( | game.opponent-team-scored | ) | // opponent team scored
{
transition-to-state(ready);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.initial | )
| ) | // initial message received
{
transition-to-state(initial);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.ready | )
| ) | // ready message received
{
transition-to-state(ready);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.set | )
| ) | // set message received
{
transition-to-state(set);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.penalized | )
| ) | // penalized message received
{
transition-to-state(penalized);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.finished | )
| ) | // finished message received
{
transition-to-state(finished);
}
else
{
if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.playing | )
| ) | // playing message received
{
transition-to-state(playing);
}
else if ( | another-player-is-in-ready-state | ) | // another player is in ready state yet
{
transition-to-state(ready);
}
else if ( | time-of-state-execution < 1000 | ) | // state running less than 1 second
{
transition-to-state(initial);
}
else if ( | robot-state.head-button-pressed-short | ) | // head pressed short
{
transition-to-state(ready);
}
else
{
transition-to-state(initial);
}
}
## State ready
If that state is active,
> | The option joystick-head-control is executed.
> | These output symbols are set:
| sent-game-state | = | sent-game-state.ready
| leds.back-front-white | = | back-front-white.llll
| leds.back-middle-white | = | back-middle-white.oooo
| leds.back-rear-white | = | back-rear-white.llll
The decision tree:
Pseudo code of the decision tree:
if ( | game.own-team-scored | ) | // own team scored
{
transition-to-state(ready);
}
else if ( | game.opponent-team-scored | ) | // opponent team scored
{
transition-to-state(ready);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.initial | )
| ) | // initial message received
{
transition-to-state(initial);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.ready | )
| ) | // ready message received
{
transition-to-state(ready);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.set | )
| ) | // set message received
{
transition-to-state(set);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.penalized | )
| ) | // penalized message received
{
transition-to-state(penalized);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.finished | )
| ) | // finished message received
{
transition-to-state(finished);
}
else
{
if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.playing | )
| ) | // playing message received
{
transition-to-state(playing);
}
else if ( | subsequent-option-reached-target-state | ) | // ready is in target state
{
transition-to-state(set);
}
else if ( | time-of-state-execution < 1000 | ) | // state running less than 1 second
{
transition-to-state(ready);
}
else if ( | robot-state.head-button-pressed-short | ) | // head pressed short
{
transition-to-state(set);
}
else
{
transition-to-state(ready);
}
}
## State set
If that state is active,
> | The basic behavior stand is executed.
> | These output symbols are set:
| sent-game-state | = | sent-game-state.set
| leds.back-front-white | = | back-front-white.llll
| leds.back-middle-white | = | back-middle-white.lloo
| leds.back-rear-white | = | back-rear-white.llll
The decision tree:
Pseudo code of the decision tree:
if ( | game.own-team-scored | ) | // own team scored
{
transition-to-state(ready);
}
else if ( | game.opponent-team-scored | ) | // opponent team scored
{
transition-to-state(ready);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.initial | )
| ) | // initial message received
{
transition-to-state(initial);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.ready | )
| ) | // ready message received
{
transition-to-state(ready);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.set | )
| ) | // set message received
{
transition-to-state(set);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.penalized | )
| ) | // penalized message received
{
transition-to-state(penalized);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.finished | )
| ) | // finished message received
{
transition-to-state(finished);
}
else
{
if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.playing | )
| ) | // playing message received
{
transition-to-state(playing);
}
else if ( | time-of-state-execution < 1000 | ) | // state running less than 1 second
{
transition-to-state(set);
}
else if ( | robot-state.head-button-pressed-short | ) | // head pressed short
{
transition-to-state(playing);
}
else
{
transition-to-state(set);
}
}
## State playing
If that state is active,
> | The option joystick-head-control is executed.
> | These output symbols are set:
| sent-game-state | = | sent-game-state.playing
The decision tree:
Pseudo code of the decision tree:
if ( | game.own-team-scored | ) | // own team scored
{
transition-to-state(ready);
}
else if ( | game.opponent-team-scored | ) | // opponent team scored
{
transition-to-state(ready);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.initial | )
| ) | // initial message received
{
transition-to-state(initial);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.ready | )
| ) | // ready message received
{
transition-to-state(ready);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.set | )
| ) | // set message received
{
transition-to-state(set);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.penalized | )
| ) | // penalized message received
{
transition-to-state(penalized);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.finished | )
| ) | // finished message received
{
transition-to-state(finished);
}
else
{
if ( | time-of-state-execution < 1000 | ) | // state running less than 1 second
{
transition-to-state(playing);
}
else if ( | robot-state.any-back-button-pressed-for-one-second | ) | // back pressed long
{
transition-to-state(penalized);
}
else
{
transition-to-state(playing);
}
}
## State penalized
If that state is active,
> | The option penalized is executed.
> | These output symbols are set:
| sent-game-state | = | sent-game-state.penalized
The decision tree:
Pseudo code of the decision tree:
if ( | game.own-team-scored | ) | // own team scored
{
transition-to-state(ready);
}
else if ( | game.opponent-team-scored | ) | // opponent team scored
{
transition-to-state(ready);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.initial | )
| ) | // initial message received
{
transition-to-state(initial);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.ready | )
| ) | // ready message received
{
transition-to-state(ready);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.set | )
| ) | // set message received
{
transition-to-state(set);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.penalized | )
| ) | // penalized message received
{
transition-to-state(penalized);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.finished | )
| ) | // finished message received
{
transition-to-state(finished);
}
else
{
if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.playing | )
| ) | // playing message received
{
transition-to-state(playing);
}
else if ( | time-of-state-execution < 1000 | ) | // state running less than 1 second
{
transition-to-state(penalized);
}
else if ( | robot-state.head-button-pressed-for-three-seconds | ) | // head pressed long
{
transition-to-state(initial);
}
else if ( | robot-state.any-back-button-pressed-short-and-released | ) | // head pressed short
{
transition-to-state(playing);
}
else
{
transition-to-state(penalized);
}
}
## State finished
If that state is active,
> | The basic behavior stand is executed.
> | These output symbols are set:
| sent-game-state | = | sent-game-state.finished
The decision tree:
Pseudo code of the decision tree:
if ( | game.own-team-scored | ) | // own team scored
{
transition-to-state(ready);
}
else if ( | game.opponent-team-scored | ) | // opponent team scored
{
transition-to-state(ready);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.initial | )
| ) | // initial message received
{
transition-to-state(initial);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.ready | )
| ) | // ready message received
{
transition-to-state(ready);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.set | )
| ) | // set message received
{
transition-to-state(set);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.penalized | )
| ) | // penalized message received
{
transition-to-state(penalized);
}
else if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.finished | )
| ) | // finished message received
{
transition-to-state(finished);
}
else
{
if ( |
( | game.time-since-last-message < 1000 | )
&& |
( | game.state == game.state.playing | )
| ) | // playing message received
{
transition-to-state(playing);
}
else
{
transition-to-state(finished);
}
}