# Option handle-ball The striker playing ## State Machine ## State approach-and-turn
If that state is active,
> | The option approach-and-turn is executed. Parameters:
| approach-and-turn.angle | = | angle.perfect-angle-to-opponent-goal ;
| approach-and-turn.y-offset | = | (-50 * sin( angle.perfect-angle-to-opponent-goal )) ;
> | These output symbols are set:
| angle.angle-shown-by-leds | = | angle.perfect-angle-to-opponent-goal
The decision tree:
Pseudo code of the decision tree:
if ( | strategy.ball-is-handled-at-the-moment | ) | // ball is handled
{
transition-to-state(approach-and-turn);
}
else if ( | abs( angle.perfect-angle-to-opponent-goal ) > 100 | ) | // opponent goal is behind
{
transition-to-state(turn-and-release);
}
else if ( |
( | strategy.time-since-last-kick > 1000 | )
&& |
( | ball.just-seen | )
&& |
( | abs( ball.seen.relative-speed.y ) < 150 | )
&& |
( | ball.seen.relative-speed.x < 150 | )
| ) | // kick possible
{
transition-to-state(kick);
}
else
{
transition-to-state(approach-and-turn);
}
## State turn-and-release
If that state is active,
> | The option turn-and-release is executed. Parameters:
| turn-and-release.angle | = | (angle.perfect-angle-to-opponent-goal - (30 * sgn( angle.perfect-angle-to-opponent-goal ))) ;
> | These output symbols are set:
| angle.angle-shown-by-leds | = | angle.perfect-angle-to-opponent-goal
The decision tree:
Pseudo code of the decision tree:
if ( | strategy.ball-is-handled-at-the-moment | ) | // ball is handled
{
transition-to-state(turn-and-release);
}
else if ( |
( | strategy.time-since-last-kick > 1000 | )
&& |
( | ball.just-seen | )
&& |
( | abs( ball.seen.relative-speed.y ) < 150 | )
&& |
( | ball.seen.relative-speed.x < 150 | )
| ) | // kick possible
{
transition-to-state(kick);
}
else if ( | abs( angle.perfect-angle-to-opponent-goal ) < 80 | ) | // opponent goal is in front
{
transition-to-state(kick);
}
else
{
transition-to-state(turn-and-release);
}
## State kick
If that state is active,
> | The option execute-kick is executed. Parameters:
| execute-kick.action | = | retrieve-kick( angle.best-angle-to-opponent-goal-no-obstacles , angle.best-width-of-opponent-goal-no-obstacles , kick-selection-table.in-center-of-field ) ;
> | These output symbols are set:
| strategy.ball-handling | = | performing-a-kick
| angle.angle-shown-by-leds | = | angle.best-angle-to-opponent-goal-no-obstacles
The decision tree:
Pseudo code of the decision tree:
if ( | subsequent-option-reached-target-state | ) | // kick finished
{
transition-to-state(approach-and-turn);
}
else
{
transition-to-state(kick);
}