# Option goto-center-circle Selects gamestate according to buttons. ## State Machine ## State goto-center-circle
If that state is active,
> | The basic behavior do-nothing is executed.
The decision tree:
Pseudo code of the decision tree:
transition-to-state(init-green-locator);

## State init-green-locator

If that state is active,
> | The basic behavior locate-max-green is executed. Parameters:
| locate-max-green.param | = | 0 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.look-straight-ahead
The decision tree:
Pseudo code of the decision tree:
if ( | time-of-state-execution < 100 | ) | //
{
transition-to-state(init-green-locator);
}
else
{
transition-to-state(locate-max-green);
}

## State locate-max-green

If that state is active,
> | The basic behavior locate-max-green is executed. Parameters:
| locate-max-green.param | = | 1 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.look-straight-ahead
The decision tree:
Pseudo code of the decision tree:
if ( | challenge-slam.center-circle-visible | ) | //
{
transition-to-state(center-circle-found);
}
else
{
if ( | challenge-slam.green-location-finished | ) | //
{
transition-to-state(init-rotate-to-center-circle);
}
else
{
transition-to-state(locate-max-green);
}
}

## State init-rotate-to-center-circle

If that state is active,
> | The basic behavior turn is executed. Parameters:
| turn.angle | = | challenge-slam.angle-to-max-green ;
| turn.param | = | 0 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.look-straight-ahead
The decision tree:
Pseudo code of the decision tree:
if ( | time-of-state-execution < 100 | ) | //
{
transition-to-state(init-rotate-to-center-circle);
}
else
{
transition-to-state(rotate-to-center-circle);
}

## State rotate-to-center-circle

If that state is active,
> | The basic behavior turn is executed. Parameters:
| turn.angle | = | challenge-slam.angle-to-max-green ;
| turn.param | = | 1 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.look-straight-ahead
The decision tree:
Pseudo code of the decision tree:
if ( | challenge-slam.center-circle-visible | ) | //
{
transition-to-state(center-circle-found);
}
else
{
if ( | challenge-slam.turn-finished | ) | //
{
transition-to-state(approach-center-circle);
}
else
{
transition-to-state(rotate-to-center-circle);
}
}

## State approach-center-circle

If that state is active,
> | The basic behavior walk is executed. Parameters:
| walk.type | = | 0 ;
| walk.speed-x | = | 400 ;
| walk.speed-y | = | 0 ;
| walk.rotation-speed | = | 0 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-landmarks
The decision tree:
Pseudo code of the decision tree:
if ( | time-of-state-execution < 5000 | ) | //
{
if ( | challenge-slam.center-circle-visible | ) | //
{
transition-to-state(center-circle-found);
}
else
{
transition-to-state(approach-center-circle);
}
}
else
{
transition-to-state(init-green-locator);
}

## State center-circle-found

If that state is active,
> | The basic behavior turn is executed. Parameters:
| turn.param | = | 0 ;
| turn.angle | = | challenge-slam.direction-to-center-circle ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.stay-as-forced
The decision tree:
Pseudo code of the decision tree:
if ( | time-of-state-execution < 100 | ) | //
{
transition-to-state(center-circle-found);
}
else
{
transition-to-state(align-to-center-circle);
}

## State align-to-center-circle

If that state is active,
> | The basic behavior turn is executed. Parameters:
| turn.param | = | 1 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.look-straight-ahead
The decision tree:
Pseudo code of the decision tree:
if ( | challenge-slam.turn-finished | ) | //
{
transition-to-state(finished);
}
else
{
transition-to-state(align-to-center-circle);
}

## State finished

If that state is active,
> | The basic behavior stand is executed.
> | These output symbols are set:
| head-control-mode | = | head-control-mode.look-straight-ahead
The decision tree:
Pseudo code of the decision tree:
transition-to-state(finished);