# Option playing-goalie The goalie playing ## State Machine ## State return
If that state is active,
> | The basic behavior goalie-return-to-goal is executed. Parameters:
| goalie-return-to-goal.x | = | (field.own-groundline.x + 100) ;
| goalie-return-to-goal.y | = | 0 ;
| goalie-return-to-goal.max-speed | = | 300 ;
> | These output symbols are set:
| leds.back-middle-white | = | back-middle-white.llll
| leds.back-rear-white | = | back-rear-white.llll
| head-control-mode | = | head-control-mode.search-auto
The decision tree:
Pseudo code of the decision tree:
if ( |
( | ball.seen.distance-to-own-penalty-area < -100 | )
&& |
( | ball.just-seen | )
| ) | // ball seen near or inside the penalty area
{
transition-to-state(position);
}
else if ( | robot-pose.distance-to-own-penalty-area < -100 | ) | // goalie near to the own penalty area
{
transition-to-state(position);
}
else
{
transition-to-state(return);
}
## State clear-ball
If that state is active,
> | The option goalie-clear-ball is executed.
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-ball
| leds.back-front-white | = | back-front-white.llll
The decision tree:
Pseudo code of the decision tree:
if ( | strategy.ball-is-handled-at-the-moment | ) | // ball is handled
{
transition-to-state(clear-ball);
}
else if ( |
( | ball.time-since-last-seen > 2000 | )
&& |
( | abs( robot-pose.y ) > 300 | )
| ) | // ball was not seen for 2 seconds and robot is not in front of goal
{
transition-to-state(head-back-from-border);
}
else if ( | ball.time-since-last-seen > 2000 | ) | // ball was not seen for 2 seconds
{
transition-to-state(head-back);
}
else if ( | ball.seen.distance-to-own-penalty-area > -100 | ) | // ball not near or inside the penalty area
{
transition-to-state(position);
}
else
{
transition-to-state(clear-ball);
}
## State clear-ball-courageous
If that state is active,
> | The option goalie-clear-ball is executed.
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-ball
| leds.back-front-white | = | back-front-white.llll
| leds.back-middle-white | = | back-middle-white.llll
The decision tree:
Pseudo code of the decision tree:
if ( | strategy.ball-is-handled-at-the-moment | ) | // ball is handled
{
transition-to-state(clear-ball-courageous);
}
else if ( |
( | ball.time-since-last-seen > 2000 | )
&& |
( | abs( robot-pose.y ) > 300 | )
| ) | // ball was not seen for 2 seconds and robot is not in front of goal
{
transition-to-state(head-back-from-border);
}
else if ( | ball.time-since-last-seen > 2000 | ) | // ball was not seen for 2 seconds
{
transition-to-state(head-back);
}
else if ( | ball.seen.distance-to-own-penalty-area > 70 | ) | // ball not near or inside the penalty area
{
transition-to-state(return);
}
else
{
transition-to-state(clear-ball-courageous);
}
## State position
If that state is active,
> | The option goalie-position is executed.
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-auto
| sound-request | = | sound-request.none
The decision tree:
Pseudo code of the decision tree:
if ( |
( | ball.time-since-last-seen > 3000 | )
&& |
( | ball.time-since-last-seen < 3500 | )
&& |
( | abs( robot-pose.y ) > 300 | )
| ) | // ball was not seen for 3 seconds but in last 3.5 seconds and goalie is not in front of goal
{
transition-to-state(head-back-from-border);
}
else if ( |
( | ball.time-since-last-seen > 3000 | )
&& |
( | ball.time-since-last-seen < 3500 | )
| ) | // ball was not seen for 3 seconds but in last 3.5 seconds
{
transition-to-state(head-back);
}
else if ( |
( | ball.just-seen | )
&& |
( | ball.time-until-ball-crosses-y-axis < 350 | )
| ) | // block
{
if ( | ball.rolls-by-left | ) | // ball rolls left
{
transition-to-state(block-left);
}
else if ( | ball.rolls-by-right | ) | // ball rolls right
{
transition-to-state(block-right);
}
else if ( | ball.rolls-towards-robot | ) | // ball rolls middle
{
transition-to-state(block-middle);
}
else if ( | ball.rolls-far-by-left | ) | // ball rolls far by left
{
transition-to-state(block-far-left);
}
else if ( | ball.rolls-far-by-right | ) | // ball rolls far by right
{
transition-to-state(block-far-right);
}
else
{
transition-to-state(position);
}
}
else if ( |
( | ball.just-seen | )
&& |
( | ball.time-until-ball-crosses-y-axis < 1000 | )
&& |
( | ball.rolls-far-by-left | )
| ) | // block far left
{
transition-to-state(block-far-left);
}
else if ( |
( | ball.just-seen | )
&& |
( | ball.time-until-ball-crosses-y-axis < 1000 | )
&& |
( | ball.rolls-far-by-right | )
| ) | // block far right
{
transition-to-state(block-far-right);
}
else if ( |
( | ball.just-seen | )
&& |
( | abs( ball.seen.y ) > 300 | )
&& |
( | ball.seen.distance-to-own-penalty-area < -100 | )
| ) | // ball near border and inside the penalty area
{
transition-to-state(clear-ball);
}
else if ( |
( | ball.just-seen | )
&& |
( | ball.seen.distance-to-own-penalty-area < -200 | )
| ) | // ball inside the penalty area
{
transition-to-state(clear-ball);
}
else if ( |
( | ball.just-seen | )
&& |
( | ball.seen.distance-to-own-penalty-area < 0 | )
&& |
( |
!( | obstacles.close | )
| )
&& |
( | abs( ball.seen.y ) < 400 | )
&& |
( | ball.consecutively-seen-time > 2000 | )
| ) | // ball near or inside the penalty area
{
transition-to-state(clear-ball-courageous);
}
else if ( |
( | ball.just-seen | )
&& |
( | abs( ball.seen.y ) > 300 | )
&& |
( | ball.seen.distance-to-own-penalty-area < 50 | )
&& |
( | ball.consecutively-seen-time > 2000 | )
| ) | // ball near border and inside or near the penalty area
{
transition-to-state(clear-ball-courageous);
}
else if ( | robot-pose.distance-to-own-penalty-area > 70 | ) | // goalie far outside the own penalty area
{
transition-to-state(return);
}
else
{
transition-to-state(position);
}
## State block-far-left
If that state is active,
> | The basic behavior go-to-point-fast is executed. Parameters:
| go-to-point-fast.x | = | robot-pose.x ;
| go-to-point-fast.y | = | 350 ;
| go-to-point-fast.destination-angle | = | robot-pose.angle ;
| go-to-point-fast.distance-remain | = | 15 ;
| go-to-point-fast.angle-remain | = | 10 ;
| go-to-point-fast.max-speed | = | 600 ;
| go-to-point-fast.max-speed.y | = | 600 ;
| go-to-point-fast.walk-type | = | walk-type.normal ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-ball
| sound-request | = | sound-request.bark2
The decision tree:
Pseudo code of the decision tree:
if ( |
( | ball.just-seen | )
&& |
( | ball.time-until-ball-crosses-y-axis < 350 | )
| ) | // block
{
if ( | ball.rolls-by-left | ) | // ball rolls left
{
transition-to-state(block-left);
}
else if ( | ball.rolls-by-right | ) | // ball rolls right
{
transition-to-state(block-right);
}
else if ( | ball.rolls-towards-robot | ) | // ball rolls middle
{
transition-to-state(block-middle);
}
else
{
transition-to-state(position);
}
}
else if ( |
( | ball.just-seen | )
&& |
( | ball.time-until-ball-crosses-y-axis < 1000 | )
&& |
( | ball.rolls-far-by-left | )
| ) | // go left
{
transition-to-state(block-far-left);
}
else if ( |
( | ball.just-seen | )
&& |
( | ball.time-until-ball-crosses-y-axis < 1000 | )
&& |
( | ball.rolls-far-by-right | )
| ) | // go right
{
transition-to-state(block-far-right);
}
else
{
transition-to-state(position);
}
## State block-far-right
If that state is active,
> | The basic behavior go-to-point-fast is executed. Parameters:
| go-to-point-fast.x | = | robot-pose.x ;
| go-to-point-fast.y | = | -350 ;
| go-to-point-fast.destination-angle | = | robot-pose.angle ;
| go-to-point-fast.distance-remain | = | 15 ;
| go-to-point-fast.angle-remain | = | 10 ;
| go-to-point-fast.max-speed | = | 600 ;
| go-to-point-fast.max-speed.y | = | 600 ;
| go-to-point-fast.walk-type | = | walk-type.normal ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-ball
| sound-request | = | sound-request.bark3
The decision tree:
Pseudo code of the decision tree:
if ( |
( | ball.just-seen | )
&& |
( | ball.time-until-ball-crosses-y-axis < 350 | )
| ) | // block
{
if ( | ball.rolls-by-left | ) | // ball rolls left
{
transition-to-state(block-left);
}
else if ( | ball.rolls-by-right | ) | // ball rolls right
{
transition-to-state(block-right);
}
else if ( | ball.rolls-towards-robot | ) | // ball rolls middle
{
transition-to-state(block-middle);
}
else
{
transition-to-state(position);
}
}
else if ( |
( | ball.just-seen | )
&& |
( | ball.time-until-ball-crosses-y-axis < 1000 | )
&& |
( | ball.rolls-far-by-left | )
| ) | // go left
{
transition-to-state(block-far-left);
}
else if ( |
( | ball.just-seen | )
&& |
( | ball.time-until-ball-crosses-y-axis < 1000 | )
&& |
( | ball.rolls-far-by-right | )
| ) | // go right
{
transition-to-state(block-far-right);
}
else
{
transition-to-state(position);
}
## State block-left
If that state is active,
> | The option do-special-action is executed. Parameters:
| do-special-action.special-action-id | = | special-action.block-left ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-ball
The decision tree:
Pseudo code of the decision tree:
if ( |
!( | subsequent-option-reached-target-state | )
| ) | // executing block
{
transition-to-state(block-left);
}
else
{
transition-to-state(position);
}
## State block-right
If that state is active,
> | The option do-special-action is executed. Parameters:
| do-special-action.special-action-id | = | special-action.block-right ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-ball
The decision tree:
Pseudo code of the decision tree:
if ( |
!( | subsequent-option-reached-target-state | )
| ) | // executing block
{
transition-to-state(block-right);
}
else
{
transition-to-state(position);
}
## State block-middle
If that state is active,
> | The option do-special-action is executed. Parameters:
| do-special-action.special-action-id | = | special-action.block ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-ball
The decision tree:
Pseudo code of the decision tree:
if ( |
!( | subsequent-option-reached-target-state | )
| ) | // executing block
{
transition-to-state(block-middle);
}
else
{
transition-to-state(position);
}
## State head-back
If that state is active,
> | The basic behavior go-to-point is executed. Parameters:
| go-to-point.max-speed | = | 200 ;
| go-to-point.x | = | field.own-groundline.x ;
| go-to-point.y | = | 0 ;
| go-to-point.destination-angle | = | 0 ;
| go-to-point.distance-remain | = | 80 ;
| go-to-point.angle-remain | = | 10 ;
> | These output symbols are set:
| leds.back-middle-white | = | back-middle-white.llll
| head-control-mode | = | head-control-mode.search-auto
The decision tree:
Pseudo code of the decision tree:
if ( | ball.just-seen | ) | // ball just seen
{
transition-to-state(position);
}
else if ( | time-of-state-execution > 4000 | ) | // 4 seconds in that state
{
transition-to-state(position);
}
else
{
transition-to-state(head-back);
}
## State head-back-from-border
If that state is active,
> | The basic behavior go-to-point is executed. Parameters:
| go-to-point.max-speed | = | 200 ;
| go-to-point.x | = | (field.own-groundline.x + 200) ;
| go-to-point.y | = | 0 ;
| go-to-point.destination-angle | = | 0 ;
| go-to-point.distance-remain | = | 80 ;
| go-to-point.angle-remain | = | 10 ;
> | These output symbols are set:
| leds.back-front-white | = | back-front-white.llll
| leds.back-rear-white | = | back-rear-white.llll
| head-control-mode | = | head-control-mode.search-auto
The decision tree:
Pseudo code of the decision tree:
if ( | ball.just-seen | ) | // ball just seen
{
transition-to-state(position);
}
else if ( | ball.time-since-last-seen > 1000 | ) | // ball was not seen for 1 seconds
{
transition-to-state(head-back);
}
else
{
transition-to-state(head-back-from-border);
}