# Option head-control Selects between ball tracking and other movements ## State Machine ## State other-head-movements
If that state is active,
> | The option other-head-movement is executed.
The decision tree:
Pseudo code of the decision tree:
if ( | head-is-blocked | ) | // A special action or walk type uses the head
{
transition-to-state(other-head-movements);
}
else if ( |
( | head-control-mode == search-auto | )
( | head-control-mode == search-for-ball | )
( | head-control-mode == search-for-ball-left | )
( | head-control-mode == search-for-ball-right | )
| ) | // The head control mode is searchForBall or searchAuto
{
transition-to-state(track-ball);
}
else if ( |
( | head-control-mode == catch-ball | )
( | head-control-mode == catch-ball-high | )
( | head-control-mode == release-caught-ball-when-turning-left | )
( | head-control-mode == release-caught-ball-when-turning-right | )
| ) | // head control mode is catch-ball or release-ball-when...
{
transition-to-state(catch-and-release-ball);
}
else if ( | head-control-mode == directed-scan-for-obstacles | ) | //
{
transition-to-state(directed-scan-for-obstacles);
}
else if ( |
( |
!( | head-control-mode == search-auto | )
| )
&& |
( |
!( | head-control-mode == search-for-ball | )
| )
| ) | // The head control mode is not searchForBall and not searchAuto
{
transition-to-state(other-head-movements);
}
else
{
transition-to-state(other-head-movements);
}

## State track-ball

If that state is active,
> | The option track-ball is executed.
The decision tree:
Pseudo code of the decision tree:
if ( | head-is-blocked | ) | // A special action or walk type uses the head
{
transition-to-state(other-head-movements);
}
else if ( |
( | head-control-mode == search-auto | )
( | head-control-mode == search-for-ball | )
( | head-control-mode == search-for-ball-left | )
( | head-control-mode == search-for-ball-right | )
| ) | // The head control mode is searchForBall or searchAuto
{
transition-to-state(track-ball);
}
else if ( |
( | head-control-mode == catch-ball | )
( | head-control-mode == catch-ball-high | )
( | head-control-mode == release-caught-ball-when-turning-left | )
( | head-control-mode == release-caught-ball-when-turning-right | )
| ) | // head control mode is catch-ball or release-ball-when...
{
transition-to-state(catch-and-release-ball);
}
else if ( | head-control-mode == directed-scan-for-obstacles | ) | //
{
transition-to-state(directed-scan-for-obstacles);
}
else if ( |
( |
!( | head-control-mode == search-auto | )
| )
&& |
( |
!( | head-control-mode == search-for-ball | )
| )
| ) | // The head control mode is not searchForBall and not searchAuto
{
transition-to-state(other-head-movements);
}
else
{
transition-to-state(track-ball);
}

## State directed-scan-for-obstacles

If that state is active,
> | The basic behavior directed-scan-for-obstacles is executed.
The decision tree:
Pseudo code of the decision tree:
if ( | head-is-blocked | ) | // A special action or walk type uses the head
{
transition-to-state(other-head-movements);
}
else if ( |
( | head-control-mode == search-auto | )
( | head-control-mode == search-for-ball | )
( | head-control-mode == search-for-ball-left | )
( | head-control-mode == search-for-ball-right | )
| ) | // The head control mode is searchForBall or searchAuto
{
transition-to-state(track-ball);
}
else if ( |
( | head-control-mode == catch-ball | )
( | head-control-mode == catch-ball-high | )
( | head-control-mode == release-caught-ball-when-turning-left | )
( | head-control-mode == release-caught-ball-when-turning-right | )
| ) | // head control mode is catch-ball or release-ball-when...
{
transition-to-state(catch-and-release-ball);
}
else if ( | head-control-mode == directed-scan-for-obstacles | ) | //
{
transition-to-state(directed-scan-for-obstacles);
}
else if ( |
( |
!( | head-control-mode == search-auto | )
| )
&& |
( |
!( | head-control-mode == search-for-ball | )
| )
| ) | // The head control mode is not searchForBall and not searchAuto
{
transition-to-state(other-head-movements);
}
else
{
transition-to-state(directed-scan-for-obstacles);
}

## State catch-and-release-ball

If that state is active,
> | The option catch-and-release-ball is executed.
The decision tree:
Pseudo code of the decision tree:
if ( | head-is-blocked | ) | // A special action or walk type uses the head
{
transition-to-state(other-head-movements);
}
else if ( |
( | head-control-mode == search-auto | )
( | head-control-mode == search-for-ball | )
( | head-control-mode == search-for-ball-left | )
( | head-control-mode == search-for-ball-right | )
| ) | // The head control mode is searchForBall or searchAuto
{
transition-to-state(track-ball);
}
else if ( |
( | head-control-mode == catch-ball | )
( | head-control-mode == catch-ball-high | )
( | head-control-mode == release-caught-ball-when-turning-left | )
( | head-control-mode == release-caught-ball-when-turning-right | )
| ) | // head control mode is catch-ball or release-ball-when...
{
transition-to-state(catch-and-release-ball);
}
else if ( | head-control-mode == directed-scan-for-obstacles | ) | //
{
transition-to-state(directed-scan-for-obstacles);
}
else if ( |
( |
!( | head-control-mode == search-auto | )
| )
&& |
( |
!( | head-control-mode == search-for-ball | )
| )
| ) | // The head control mode is not searchForBall and not searchAuto
{
transition-to-state(other-head-movements);
}
else
{
transition-to-state(catch-and-release-ball);
}