# Option handle-with-new-flags Selects gamestate according to buttons. ## State Machine ## State localize
If that state is active,
> | The basic behavior stand is executed.
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-landmarks
The decision tree:
Pseudo code of the decision tree:
if ( | time-of-state-execution < 5000 | ) | //
{
transition-to-state(localize);
}
else
{
if ( | robot-state.head-button-pressed-short | ) | //
{
transition-to-state(approach-center-circle);
}
else
{
transition-to-state(check-localisation);
}
}
## State check-localisation
If that state is active,
> | The basic behavior do-nothing is executed.
The decision tree:
Pseudo code of the decision tree:
if ( | robot-pose.validity > 0.9 | ) | //
{
transition-to-state(approach-center-circle);
}
else
{
transition-to-state(turn);
}
## State turn
If that state is active,
> | The basic behavior walk is executed. Parameters:
| walk.type | = | walk-type.normal ;
| walk.speed-x | = | 0 ;
| walk.speed-y | = | 0 ;
| walk.rotation-speed | = | 120 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-landmarks
The decision tree:
Pseudo code of the decision tree:
if ( | time-of-state-execution > 1400 | ) | // the robot turned for 180 degrees
{
transition-to-state(localize);
}
else
{
transition-to-state(turn);
}
## State approach-center-circle
If that state is active,
> | The basic behavior go-to-point is executed. Parameters:
| go-to-point.x | = | 0 ;
| go-to-point.y | = | 0 ;
| go-to-point.distance-remain | = | 200 ;
| go-to-point.walk-type | = | 0 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-landmarks
The decision tree:
Pseudo code of the decision tree:
if ( |
( | abs( robot-pose.x ) < 200 | )
&& |
( | abs( robot-pose.y ) < 200 | )
| ) | //
{
transition-to-state(approach-point-0);
}
else
{
transition-to-state(approach-center-circle);
}
## State approach-point-0
If that state is active,
> | The basic behavior go-to-point is executed. Parameters:
| go-to-point.x | = | challenge-slam.target-position.x( challenge-slam.current-target-point ) ;
| go-to-point.y | = | challenge-slam.target-position.y( challenge-slam.current-target-point ) ;
| go-to-point.destination-angle | = | challenge-slam.target-position.rotation( challenge-slam.current-target-point ) ;
| go-to-point.distance-remain | = | 150 ;
| go-to-point.angle-remain | = | 15 ;
| go-to-point.max-speed | = | 150 ;
| go-to-point.max-speed.y | = | 150 ;
| go-to-point.walk-type | = | 0 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-landmarks
The decision tree:
Pseudo code of the decision tree:
if ( |
( | abs( (challenge-slam.target-position.x( 0 ) - robot-pose.x) ) < 150 | )
&& |
( | abs( (challenge-slam.target-position.y( challenge-slam.current-target-point ) - robot-pose.y) ) < 150 | )
| ) | //
{
transition-to-state(wait-for-point-1);
}
else
{
transition-to-state(approach-point-0);
}
## State wait-for-point-1
If that state is active,
> | The basic behavior stand is executed.
> | These output symbols are set:
| tail-mode | = | tail-mode.tail-left-bottom
| head-control-mode | = | head-control-mode.look-to-stars
The decision tree:
Pseudo code of the decision tree:
if ( | robot-state.head-button-pressed-short | ) | //
{
transition-to-state(approach-point-1);
}
else
{
transition-to-state(wait-for-point-1);
}
## State approach-point-1
If that state is active,
> | The basic behavior go-to-point is executed. Parameters:
| go-to-point.x | = | challenge-slam.target-position.x( challenge-slam.current-target-point ) ;
| go-to-point.y | = | challenge-slam.target-position.y( challenge-slam.current-target-point ) ;
| go-to-point.destination-angle | = | challenge-slam.target-position.rotation( challenge-slam.current-target-point ) ;
| go-to-point.distance-remain | = | 150 ;
| go-to-point.angle-remain | = | 15 ;
| go-to-point.max-speed | = | 150 ;
| go-to-point.max-speed.y | = | 150 ;
| go-to-point.walk-type | = | 0 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-landmarks
The decision tree:
Pseudo code of the decision tree:
if ( |
( | abs( (challenge-slam.target-position.x( 1 ) - robot-pose.x) ) < 150 | )
&& |
( | abs( (challenge-slam.target-position.y( challenge-slam.current-target-point ) - robot-pose.y) ) < 150 | )
| ) | //
{
transition-to-state(wait-for-point-2);
}
else
{
transition-to-state(approach-point-1);
}
## State wait-for-point-2
If that state is active,
> | The basic behavior stand is executed.
> | These output symbols are set:
| tail-mode | = | tail-mode.tail-left-bottom
| head-control-mode | = | head-control-mode.look-to-stars
The decision tree:
Pseudo code of the decision tree:
if ( | robot-state.head-button-pressed-short | ) | //
{
transition-to-state(approach-point-2);
}
else
{
transition-to-state(wait-for-point-2);
}
## State approach-point-2
If that state is active,
> | The basic behavior go-to-point is executed. Parameters:
| go-to-point.x | = | challenge-slam.target-position.x( challenge-slam.current-target-point ) ;
| go-to-point.y | = | challenge-slam.target-position.y( challenge-slam.current-target-point ) ;
| go-to-point.destination-angle | = | challenge-slam.target-position.rotation( challenge-slam.current-target-point ) ;
| go-to-point.distance-remain | = | 150 ;
| go-to-point.angle-remain | = | 15 ;
| go-to-point.max-speed | = | 150 ;
| go-to-point.max-speed.y | = | 150 ;
| go-to-point.walk-type | = | 0 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-landmarks
The decision tree:
Pseudo code of the decision tree:
if ( |
( | abs( (challenge-slam.target-position.x( 2 ) - robot-pose.x) ) < 150 | )
&& |
( | abs( (challenge-slam.target-position.y( challenge-slam.current-target-point ) - robot-pose.y) ) < 150 | )
| ) | //
{
transition-to-state(wait-for-point-3);
}
else
{
transition-to-state(approach-point-2);
}
## State wait-for-point-3
If that state is active,
> | The basic behavior stand is executed.
> | These output symbols are set:
| tail-mode | = | tail-mode.tail-left-bottom
| head-control-mode | = | head-control-mode.look-to-stars
The decision tree:
Pseudo code of the decision tree:
if ( | robot-state.head-button-pressed-short | ) | //
{
transition-to-state(approach-point-3);
}
else
{
transition-to-state(wait-for-point-3);
}
## State approach-point-3
If that state is active,
> | The basic behavior go-to-point is executed. Parameters:
| go-to-point.x | = | challenge-slam.target-position.x( challenge-slam.current-target-point ) ;
| go-to-point.y | = | challenge-slam.target-position.y( challenge-slam.current-target-point ) ;
| go-to-point.destination-angle | = | challenge-slam.target-position.rotation( challenge-slam.current-target-point ) ;
| go-to-point.distance-remain | = | 150 ;
| go-to-point.angle-remain | = | 15 ;
| go-to-point.max-speed | = | 150 ;
| go-to-point.max-speed.y | = | 150 ;
| go-to-point.walk-type | = | 0 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-landmarks
The decision tree:
Pseudo code of the decision tree:
if ( |
( | abs( (challenge-slam.target-position.x( 3 ) - robot-pose.x) ) < 150 | )
&& |
( | abs( (challenge-slam.target-position.y( challenge-slam.current-target-point ) - robot-pose.y) ) < 150 | )
| ) | //
{
transition-to-state(wait-for-point-4);
}
else
{
transition-to-state(approach-point-3);
}
## State wait-for-point-4
If that state is active,
> | The basic behavior stand is executed.
> | These output symbols are set:
| tail-mode | = | tail-mode.tail-left-bottom
| head-control-mode | = | head-control-mode.look-to-stars
The decision tree:
Pseudo code of the decision tree:
if ( | robot-state.head-button-pressed-short | ) | //
{
transition-to-state(approach-point-4);
}
else
{
transition-to-state(wait-for-point-4);
}
## State approach-point-4
If that state is active,
> | The basic behavior go-to-point is executed. Parameters:
| go-to-point.x | = | challenge-slam.target-position.x( challenge-slam.current-target-point ) ;
| go-to-point.y | = | challenge-slam.target-position.y( challenge-slam.current-target-point ) ;
| go-to-point.destination-angle | = | challenge-slam.target-position.rotation( challenge-slam.current-target-point ) ;
| go-to-point.distance-remain | = | 150 ;
| go-to-point.angle-remain | = | 15 ;
| go-to-point.max-speed | = | 150 ;
| go-to-point.max-speed.y | = | 150 ;
| go-to-point.walk-type | = | 0 ;
> | These output symbols are set:
| head-control-mode | = | head-control-mode.search-for-landmarks
The decision tree:
Pseudo code of the decision tree:
if ( |
( | abs( (challenge-slam.target-position.x( 4 ) - robot-pose.x) ) < 150 | )
&& |
( | abs( (challenge-slam.target-position.y( challenge-slam.current-target-point ) - robot-pose.y) ) < 150 | )
| ) | //
{
transition-to-state(finished);
}
else
{
transition-to-state(approach-point-4);
}
## State finished
This state is a target state.
If that state is active,
> | The basic behavior special-action is executed. Parameters:
| special-action-id | = | special-action.cheer-happy1 ;
The decision tree:
Pseudo code of the decision tree:
transition-to-state(finished);