Option turn-for-ball

Turns for the ball if the ball was not known until the ball is known ahead.

State Machine

This browser can't display the SVG file svg/option_turn-for-ball.svg.



The Adobe SVG Viewer 3.0 can be downloaded from http://www.adobe.com/svg/viewer/install/main.html

State ball-not-seen

If that state is active,
 >  The basic behavior stand is executed.
 
 >  These output symbols are set:
 
    head-control-mode  =  head-control-mode.search-for-ball
 
The decision tree:
  This browser can't display the SVG file svg/option_turn-for-ball_state_ball-not-seen.svg.



The Adobe SVG Viewer 3.0 can be downloaded from http://www.adobe.com/svg/viewer/install/main.html
 
Pseudo code of the decision tree:
 
if (ball.just-seen)   // ball seen again
{
  
transition-to-state(ball-seen);
}
else if (time-of-state-execution < 800)   // state running less than 800 ms
{
  
transition-to-state(ball-not-seen);
}
else if (ball.time-since-last-seen < 1700)   // ball seen in the last 1,7 seconds
{
  
transition-to-state(ball-not-seen);
}
else if (
(ball.seen.distance < 1000)
&& 
(ball.time-since-last-seen < 5000)
)   // ball was last seen close and in the last 5 seconds
{
  
transition-to-state(back-up);
}
else if (ball.seen.angle > 0)   // ball to the left
{
  
transition-to-state(ball-not-seen-left);
}
else
{
  
transition-to-state(ball-not-seen-right);
}

State back-up

If that state is active,
 >  The basic behavior walk is executed. Parameters:
 
    walk.speed-x  =  -200 ;
 
 >  These output symbols are set:
 
    head-control-mode  =  head-control-mode.search-for-ball
 
The decision tree:
  This browser can't display the SVG file svg/option_turn-for-ball_state_back-up.svg.



The Adobe SVG Viewer 3.0 can be downloaded from http://www.adobe.com/svg/viewer/install/main.html
 
Pseudo code of the decision tree:
 
if (ball.just-seen)   // ball seen again
{
  
transition-to-state(ball-seen);
}
else if (time-of-state-execution < 1500)   // state running less than 1500 ms
{
  
transition-to-state(back-up);
}
else if (ball.seen.angle > 0)   // ball to the left
{
  
transition-to-state(ball-not-seen-left);
}
else
{
  
transition-to-state(ball-not-seen-right);
}

State ball-not-seen-left

If that state is active,
 >  The basic behavior walk is executed. Parameters:
 
    walk.speed-x  =  0 ;
    walk.speed-y  =  0 ;
    walk.rotation-speed  =  120 ;
 
 >  These output symbols are set:
 
    head-control-mode  =  head-control-mode.look-left
 
The decision tree:
  This browser can't display the SVG file svg/option_turn-for-ball_state_ball-not-seen-left.svg.



The Adobe SVG Viewer 3.0 can be downloaded from http://www.adobe.com/svg/viewer/install/main.html
 
Pseudo code of the decision tree:
 
if (ball.just-seen)   // ball seen again
{
  
transition-to-state(ball-seen);
}
else
{
  
transition-to-state(ball-not-seen-left);
}

State ball-not-seen-right

If that state is active,
 >  The basic behavior walk is executed. Parameters:
 
    walk.speed-x  =  0 ;
    walk.speed-y  =  0 ;
    walk.rotation-speed  =  -120 ;
 
 >  These output symbols are set:
 
    head-control-mode  =  head-control-mode.look-right
 
The decision tree:
  This browser can't display the SVG file svg/option_turn-for-ball_state_ball-not-seen-right.svg.



The Adobe SVG Viewer 3.0 can be downloaded from http://www.adobe.com/svg/viewer/install/main.html
 
Pseudo code of the decision tree:
 
if (ball.just-seen)   // ball seen again
{
  
transition-to-state(ball-seen);
}
else
{
  
transition-to-state(ball-not-seen-right);
}

State ball-seen

If that state is active,
 >  The basic behavior walk is executed. Parameters:
 
    walk.speed-x  =  0 ;
    walk.speed-y  =  0 ;
    walk.rotation-speed  =  (ball.seen.angle * 2) ;
 
 >  These output symbols are set:
 
    head-control-mode  =  head-control-mode.search-for-ball
 
The decision tree:
  This browser can't display the SVG file svg/option_turn-for-ball_state_ball-seen.svg.



The Adobe SVG Viewer 3.0 can be downloaded from http://www.adobe.com/svg/viewer/install/main.html
 
Pseudo code of the decision tree:
 
if (ball.time-since-last-seen > 500)   // ball not seen
{
  
transition-to-state(ball-not-seen);
}
else
{
  
transition-to-state(ball-seen);
}