# Option approach-ball-set-walk-speed Approaches the close ball Parameters of that option:
Parameter | Measure | Range | Description
approach-ball-set-walk-speed.slow-down-distance | int | 0.. | The distance when the robot slows down
approach-ball-set-walk-speed.slow-speed | int | 1.. | The speed for the state look-at-ball
approach-ball-set-walk-speed.y-offset | mm | -50...50 | The y offset the robot is approaching the ball.
## State Machine ## State slow
If that state is active,
> | The basic behavior go-to-ball is executed. Parameters:
| go-to-ball.distance | = | 0 ;
| go-to-ball.max-speed | = | ::approach-ball-set-walk-speed.slow-speed ;
| go-to-ball.max-speed.y | = | ::approach-ball-set-walk-speed.slow-speed ;
| go-to-ball.y-offset | = | ::approach-ball-set-walk-speed.y-offset ;
The decision tree:
Pseudo code of the decision tree:
if ( | ball.seen.distance > (::approach-ball-set-walk-speed.slow-down-distance + 25) | ) | // fast walk is better
{
transition-to-state(fast);
}
else
{
transition-to-state(slow);
}
## State fast
If that state is active,
> | The basic behavior go-to-ball is executed. Parameters:
| go-to-ball.distance | = | 0 ;
| go-to-ball.max-speed | = | 350 ;
| go-to-ball.max-speed.y | = | 350 ;
| go-to-ball.y-offset | = | ::approach-ball-set-walk-speed.y-offset ;
The decision tree:
Pseudo code of the decision tree:
if ( | ball.seen.distance < (::approach-ball-set-walk-speed.slow-down-distance - 25) | ) | // slow walk is better
{
transition-to-state(slow);
}
else if ( | time-of-state-execution < 1000 | ) | // at least 1s fast before dash
{
transition-to-state(fast);
}
else if ( |
( | ball.seen.distance > 1200 | )
&& |
( | abs( ball.seen.angle ) < 7 | )
| ) | // dash is possible
{
transition-to-state(dash);
}
else
{
transition-to-state(fast);
}
## State dash
If that state is active,
> | The basic behavior go-to-ball is executed. Parameters:
| go-to-ball.distance | = | 0 ;
| go-to-ball.max-speed | = | 500 ;
| go-to-ball.max-turn-speed | = | 30 ;
| go-to-ball.max-speed.y | = | 1 ;
| go-to-ball.walk-type | = | walk-type.normal ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-ball
The decision tree:
Pseudo code of the decision tree:
if ( |
( | ball.seen.distance < 400 | )
( | abs( ball.seen.angle ) > 20 | )
| ) | // abort dash
{
transition-to-state(fast);
}
else
{
transition-to-state(dash);
}