# Option kicklogger-retreat ## State Machine ## State localize
If that state is active,
> | The basic behavior stand is executed.
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-landmarks
The decision tree:
Pseudo code of the decision tree:
if ( | robot-pose.validity > 0.5 | ) | // Localized well
{
transition-to-state(retreat);
}
else
{
transition-to-state(localize);
}
## State turn-for-ball
If that state is active,
> | The option turn-for-ball is executed.
The decision tree:
Pseudo code of the decision tree:
if ( | ball.time-since-last-seen < 250 | ) | // Ball was seen
{
transition-to-state(retreat);
}
else
{
transition-to-state(turn-for-ball);
}
## State turn-right-to-ball
If that state is active,
> | The basic behavior walk is executed. Parameters:
| walk.speed-x | = | 0 ;
| walk.speed-y | = | 0 ;
| walk.rotation-speed | = | -100 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-auto
The decision tree:
Pseudo code of the decision tree:
if ( | ball.seen.angle > 7 | ) | // Ball is left
{
transition-to-state(turn-left-to-ball);
}
else if ( | ball.seen.angle < -7 | ) | // Ball is left
{
transition-to-state(turn-right-to-ball);
}
else
{
transition-to-state(retreat);
}
## State turn-left-to-ball
If that state is active,
> | The basic behavior walk is executed. Parameters:
| walk.speed-x | = | 0 ;
| walk.speed-y | = | 0 ;
| walk.rotation-speed | = | 40 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-auto
The decision tree:
Pseudo code of the decision tree:
if ( | ball.seen.angle > 7 | ) | // Ball is left
{
transition-to-state(turn-left-to-ball);
}
else if ( | ball.seen.angle < -7 | ) | // Ball is left
{
transition-to-state(turn-right-to-ball);
}
else
{
transition-to-state(retreat);
}
## State retreat
If that state is active,
> | The basic behavior walk is executed. Parameters:
| walk.speed-x | = | -80 ;
| walk.speed-y | = | 0 ;
| walk.rotation-speed | = | 0 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-auto
| leds.top-red | = | top.left
| sound-request | = | sound-request.ring
The decision tree:
Pseudo code of the decision tree:
if ( | ball.seen.angle > 7 | ) | // Ball is left
{
transition-to-state(turn-left-to-ball);
}
else if ( | ball.seen.angle < -7 | ) | // Ball is left
{
transition-to-state(turn-right-to-ball);
}
else if ( | ball.seen.distance > 600 | ) | // far away
{
transition-to-state(retreated);
}
else
{
transition-to-state(retreat);
}
## State retreated
This state is a target state.
If that state is active,
> | The basic behavior stand is executed.
The decision tree:
Pseudo code of the decision tree:
transition-to-state(retreated);