# Option vlc-search-for-ball Searches for the ball on the field ## State Machine ## State choose-side
If that state is active,
> | The basic behavior do-nothing is executed.
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-auto
The decision tree:
Pseudo code of the decision tree:
if ( | robot-pose.y > 0 | ) | // robot is at the left side
{
transition-to-state(go-to-right-side);
}
else
{
transition-to-state(go-to-left-side);
}
## State go-to-right-side
If that state is active,
> | The option get-to-position-and-avoid-obstacles is executed. Parameters:
| get-to-position-and-avoid-obstacles.x | = | search-ball.x ;
| get-to-position-and-avoid-obstacles.y | = | -1000 ;
| get-to-position-and-avoid-obstacles.destination-angle | = | -90 ;
| get-to-position-and-avoid-obstacles.max-speed | = | 350 ;
| get-to-position-and-avoid-obstacles.no-obstacle-avoidance-distance | = | 400 ;
| get-to-position-and-avoid-obstacles.avoid-penalty-areas | = | 1 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-auto
The decision tree:
Pseudo code of the decision tree:
if ( | time-of-state-execution > 2000 | ) | // state running more than 2 seconds
{
transition-to-state(turn-at-right-side);
}
else if ( | subsequent-option-reached-target-state | ) | // arrived at right side
{
transition-to-state(turn-at-right-side);
}
else
{
transition-to-state(go-to-right-side);
}
## State turn-at-right-side
If that state is active,
> | The basic behavior walk is executed. Parameters:
| walk.rotation-speed | = | -45 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.look-left
The decision tree:
Pseudo code of the decision tree:
if ( | time-of-state-execution > 2000 | ) | // state running more than 2 seconds
{
transition-to-state(go-to-left-side);
}
else
{
transition-to-state(turn-at-right-side);
}
## State go-to-left-side
If that state is active,
> | The option get-to-position-and-avoid-obstacles is executed. Parameters:
| get-to-position-and-avoid-obstacles.x | = | search-ball.x ;
| get-to-position-and-avoid-obstacles.y | = | 1000 ;
| get-to-position-and-avoid-obstacles.destination-angle | = | 90 ;
| get-to-position-and-avoid-obstacles.max-speed | = | 350 ;
| get-to-position-and-avoid-obstacles.no-obstacle-avoidance-distance | = | 400 ;
| get-to-position-and-avoid-obstacles.avoid-penalty-areas | = | 1 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-auto
The decision tree:
Pseudo code of the decision tree:
if ( | time-of-state-execution > 2000 | ) | // state running more than 2 seconds
{
transition-to-state(turn-at-left-side);
}
else if ( | subsequent-option-reached-target-state | ) | // arrived at left side
{
transition-to-state(turn-at-left-side);
}
else
{
transition-to-state(go-to-left-side);
}
## State turn-at-left-side
If that state is active,
> | The basic behavior walk is executed. Parameters:
| walk.rotation-speed | = | 45 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.look-left
The decision tree:
Pseudo code of the decision tree:
if ( | time-of-state-execution > 2000 | ) | // state running more than 2 seconds
{
transition-to-state(go-to-right-side);
}
else
{
transition-to-state(turn-at-left-side);
}