# Option handle-ball-vlc2-shooter The VLC-shooter (2.version) ## State Machine ## State ball-in-center-of-field
If that state is active,
> | The option vlc2-localized-dribbling is executed. Parameters:
| vlc2-localized-dribbling.destination-angle | = | angle-to( (field.opponent-penalty-area.x - 100) , 0 ) ;
The decision tree:
Pseudo code of the decision tree:
if ( |
( | ball.seen.x > (field.opponent-penalty-area.x - 600) | )
&& |
( | ball.seen.x < (field.opponent-penalty-area.x + 100) | )
&& |
( | ball.seen.y > (field.right-penalty-area.y - 200) | )
&& |
( | ball.seen.y < (field.left-penalty-area.y + 200) | )
| ) | // ball at kick area ?
{
transition-to-state(kick-ball);
}
else
{
if ( | ball.time-since-last-seen < 300 | ) | //
{
if ( | ball.known-or-near.y > 1400 | ) | //
{
transition-to-state(vlc2-border-left);
}
else if ( | ball.known-or-near.y < -1400 | ) | //
{
transition-to-state(vlc2-border-right);
}
else if ( | ball.seen.x > field.opponent-penalty-area.x | ) | // ball at left side of opponent quarter
{
if ( | ball.seen.y > 0 | ) | //
{
transition-to-state(ball-at-left-opponent-border);
}
else
{
transition-to-state(ball-at-right-opponent-border);
}
}
else
{
transition-to-state(ball-in-center-of-field);
}
}
else
{
transition-to-state(ball-in-center-of-field);
}
}
## State vlc2-border-left
If that state is active,
> | The option vlc2-border is executed. Parameters:
| vlc2-border.left-right-border | = | 1 ;
The decision tree:
Pseudo code of the decision tree:
if ( |
( | ball.seen.x > (field.opponent-penalty-area.x - 600) | )
&& |
( | ball.seen.x < (field.opponent-penalty-area.x + 100) | )
&& |
( | ball.seen.y > (field.right-penalty-area.y - 200) | )
&& |
( | ball.seen.y < (field.left-penalty-area.y + 200) | )
| ) | // ball at kick area ?
{
transition-to-state(kick-ball);
}
else
{
if ( | ball.known-or-near.y < 1300 | ) | //
{
transition-to-state(ball-in-center-of-field);
}
else
{
transition-to-state(vlc2-border-left);
}
}
## State vlc2-border-right
If that state is active,
> | The option vlc2-border is executed. Parameters:
| vlc2-border.left-right-border | = | -1 ;
The decision tree:
Pseudo code of the decision tree:
if ( |
( | ball.seen.x > (field.opponent-penalty-area.x - 600) | )
&& |
( | ball.seen.x < (field.opponent-penalty-area.x + 100) | )
&& |
( | ball.seen.y > (field.right-penalty-area.y - 200) | )
&& |
( | ball.seen.y < (field.left-penalty-area.y + 200) | )
| ) | // ball at kick area ?
{
transition-to-state(kick-ball);
}
else
{
if ( | ball.known-or-near.y > -1300 | ) | //
{
transition-to-state(ball-in-center-of-field);
}
else
{
transition-to-state(vlc2-border-right);
}
}
## State ball-at-left-opponent-border
If that state is active,
> | The option vlc2-localized-dribbling is executed. Parameters:
| vlc2-localized-dribbling.destination-angle | = | angle-to( (field.opponent-penalty-area.x - 400) , (field.left-penalty-area.y + 200) ) ;
The decision tree:
Pseudo code of the decision tree:
if ( |
( | ball.seen.x > (field.opponent-penalty-area.x - 600) | )
&& |
( | ball.seen.x < (field.opponent-penalty-area.x + 100) | )
&& |
( | ball.seen.y > (field.right-penalty-area.y - 200) | )
&& |
( | ball.seen.y < (field.left-penalty-area.y + 200) | )
| ) | // ball at kick area ?
{
transition-to-state(kick-ball);
}
else
{
if ( | ball.time-since-last-seen < 300 | ) | // ball seen
{
if ( | ball.seen.x < (field.opponent-penalty-area.x - 200) | ) | //
{
transition-to-state(ball-in-center-of-field);
}
else if ( |
( | ball.time-since-last-seen < 200 | )
&& |
( | ball.seen.y < 0 | )
| ) | //
{
transition-to-state(ball-at-right-opponent-border);
}
else
{
transition-to-state(ball-at-left-opponent-border);
}
}
else
{
transition-to-state(ball-at-left-opponent-border);
}
}
## State ball-at-right-opponent-border
If that state is active,
> | The option vlc2-localized-dribbling is executed. Parameters:
| vlc2-localized-dribbling.destination-angle | = | angle-to( (field.opponent-penalty-area.x - 400) , (field.right-penalty-area.y - 200) ) ;
> | These output symbols are set:
| leds.face1 | = | face1.llll
The decision tree:
Pseudo code of the decision tree:
if ( |
( | ball.seen.x > (field.opponent-penalty-area.x - 600) | )
&& |
( | ball.seen.x < (field.opponent-penalty-area.x + 100) | )
&& |
( | ball.seen.y > (field.right-penalty-area.y - 200) | )
&& |
( | ball.seen.y < (field.left-penalty-area.y + 200) | )
| ) | // ball at kick area ?
{
transition-to-state(kick-ball);
}
else
{
if ( | ball.time-since-last-seen < 300 | ) | // ball seen
{
if ( | ball.seen.x < (field.opponent-penalty-area.x - 200) | ) | //
{
transition-to-state(ball-in-center-of-field);
}
else if ( |
( | ball.time-since-last-seen < 200 | )
&& |
( | ball.seen.y > 0 | )
| ) | //
{
transition-to-state(ball-at-left-opponent-border);
}
else
{
transition-to-state(ball-at-right-opponent-border);
}
}
else
{
transition-to-state(ball-at-right-opponent-border);
}
}
## State kick-ball
If that state is active,
> | The option kick-vlc is executed.
The decision tree:
Pseudo code of the decision tree:
if ( |
( | ball.seen.x > (field.opponent-penalty-area.x - 600) | )
&& |
( | ball.seen.x < (field.opponent-penalty-area.x + 100) | )
&& |
( | ball.seen.y > (field.right-penalty-area.y - 200) | )
&& |
( | ball.seen.y < (field.left-penalty-area.y + 200) | )
| ) | // ball at kick area ?
{
transition-to-state(kick-ball);
}
else
{
if ( | time-of-state-execution < 200 | ) | // stay at least
{
transition-to-state(kick-ball);
}
else if ( |
( | ball.seen.x < (field.opponent-penalty-area.x - 700) | )
( | ball.seen.y < (field.right-penalty-area.y - 200) | )
( | ball.seen.y > (field.left-penalty-area.y + 200) | )
| ) | //
{
transition-to-state(ball-in-center-of-field);
}
else
{
transition-to-state(kick-ball);
}
}