>xabsl 2
Behavior Documentation
>
Index
>Agents
>Symbols
>Basic Behaviors
>Options
>> joystick-playing2
>>>
stand
>>>
walk
>>>
boost
>>>
walk-with-ball
>>>
kick
>>>
kick-in-progress
Option joystick-playing2
Controls walk and special-action with a joystick
State Machine
This browser can't display the SVG file
svg/option_joystick-playing2.svg
.
The
Adobe SVG Viewer 3.0
can be downloaded from
http://www.adobe.com/svg/viewer/install/main.html
State stand
If that state is active,
>
The basic behavior
stand
is executed.
The decision tree:
This browser can't display the SVG file
svg/option_joystick-playing2_state_stand.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
(
joystick-data.direct-special-action
)
// direct special-action - button directly mapped by server
{
transition-to-state(
kick
);
}
else
{
if
(
(
abs
(
joystick-data.x
)
> 0.2
)
||
(
abs
(
joystick-data.y
)
> 0.2
)
||
(
abs
(
joystick-data.z
)
> 0.2
)
)
// any significant value on one of the three axis
{
transition-to-state(
walk
);
}
else
{
transition-to-state(
stand
);
}
}
State walk
If that state is active,
>
The basic behavior
walk
is executed. Parameters:
walk.type
=
walk-type.normal
;
walk.speed-x
=
((
joystick-data.x
*
joystick-data.x
)
* (
sgn
(
joystick-data.x
)
* 450)
)
;
walk.speed-y
=
(((
joystick-data.y
*
joystick-data.y
)
*
sgn
(
joystick-data.y
))
* 450)
;
walk.rotation-speed
=
(((
joystick-data.z
*
joystick-data.z
)
*
sgn
(
joystick-data.z
))
* 200)
;
The decision tree:
This browser can't display the SVG file
svg/option_joystick-playing2_state_walk.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
(
joystick-data.direct-special-action
)
// direct special-action - button directly mapped by server
{
transition-to-state(
kick
);
}
else
{
if
(
(
abs
(
joystick-data.x
)
< 0.2
)
&&
(
abs
(
joystick-data.y
)
< 0.2
)
&&
(
abs
(
joystick-data.z
)
< 0.2
)
)
// no significant value on any of the three axis
{
transition-to-state(
stand
);
}
else if
(
joystick-data.button
==
button3
)
//
{
transition-to-state(
boost
);
}
else if
(
joystick-data.button
==
button4
)
//
{
transition-to-state(
walk-with-ball
);
}
else
{
transition-to-state(
walk
);
}
}
State boost
If that state is active,
>
The basic behavior
walk
is executed. Parameters:
walk.type
=
walk-type.boost
;
walk.speed-x
=
((
joystick-data.x
*
joystick-data.x
)
* (
sgn
(
joystick-data.x
)
* 450)
)
;
walk.speed-y
=
(((
joystick-data.y
*
joystick-data.y
)
*
sgn
(
joystick-data.y
))
* 450)
;
walk.rotation-speed
=
(((
joystick-data.z
*
joystick-data.z
)
*
sgn
(
joystick-data.z
))
* 200)
;
The decision tree:
This browser can't display the SVG file
svg/option_joystick-playing2_state_boost.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
(
joystick-data.direct-special-action
)
// direct special-action - button directly mapped by server
{
transition-to-state(
kick
);
}
else
{
if
(
(
abs
(
joystick-data.x
)
< 0.2
)
&&
(
abs
(
joystick-data.y
)
< 0.2
)
&&
(
abs
(
joystick-data.z
)
< 0.2
)
)
// no significant value on any of the three axis
{
transition-to-state(
stand
);
}
else if
(
!(
joystick-data.button
==
button3
)
)
//
{
transition-to-state(
walk
);
}
else
{
transition-to-state(
boost
);
}
}
State walk-with-ball
If that state is active,
>
The basic behavior
walk
is executed. Parameters:
walk.type
=
walk-type.walk-with-ball
;
walk.speed-x
=
((
joystick-data.x
*
joystick-data.x
)
* (
sgn
(
joystick-data.x
)
* 200)
)
;
walk.speed-y
=
(((
joystick-data.y
*
joystick-data.y
)
*
sgn
(
joystick-data.y
))
* 450)
;
walk.rotation-speed
=
(((
joystick-data.z
*
joystick-data.z
)
*
sgn
(
joystick-data.z
))
* 200)
;
>
These output symbols are set:
head-control-mode
=
head-control-mode.hold-ball
The decision tree:
This browser can't display the SVG file
svg/option_joystick-playing2_state_walk-with-ball.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
(
joystick-data.direct-special-action
)
// direct special-action - button directly mapped by server
{
transition-to-state(
kick
);
}
else
{
if
(
(
abs
(
joystick-data.x
)
< 0.2
)
&&
(
abs
(
joystick-data.y
)
< 0.2
)
&&
(
abs
(
joystick-data.z
)
< 0.2
)
)
// no significant value on any of the three axis
{
transition-to-state(
stand
);
}
else if
(
!(
joystick-data.button
==
button4
)
)
//
{
transition-to-state(
walk
);
}
else
{
transition-to-state(
walk-with-ball
);
}
}
State kick
If that state is active,
>
The basic behavior
special-action
is executed. Parameters:
special-action-id
=
joystick-data.special-action-id
;
The decision tree:
This browser can't display the SVG file
svg/option_joystick-playing2_state_kick.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
(
joystick-data.direct-special-action
)
// direct special-action - button directly mapped by server
{
transition-to-state(
kick
);
}
else
{
if
(
executed-motion-request.motion-type
==
special-action
)
// kick in progress
{
transition-to-state(
kick-in-progress
);
}
else
{
transition-to-state(
kick
);
}
}
State kick-in-progress
If that state is active,
>
The basic behavior
stand
is executed.
The decision tree:
This browser can't display the SVG file
svg/option_joystick-playing2_state_kick-in-progress.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
(
joystick-data.direct-special-action
)
// direct special-action - button directly mapped by server
{
transition-to-state(
kick
);
}
else
{
if
(
!(
executed-motion-request.motion-type
==
special-action
)
)
// kick finished
{
transition-to-state(
stand
);
}
else
{
transition-to-state(
kick-in-progress
);
}
}