Skip to content

Latest commit

 

History

History
89 lines (55 loc) · 3.95 KB

animate.md

File metadata and controls

89 lines (55 loc) · 3.95 KB

Animate

from tdw.replicant.actions.animate import Animate

Play an animation.

The animation will end either when the animation clip is finished or if the Replicant collides with something (see self.collision_detection).

  • The collision detection will respond normally to walls, objects, obstacle avoidance, etc.
  • If self.collision_detection.previous_was_same == True, and it was the same animation, and it ended in a collision, this action ends immediately.

Fields

  • record The HumanoidAnimationRecord of the animation.

  • collision_detection The CollisionDetection rules.

  • forward If True, play the animation forwards. If False, play the animation backwards.

  • loop If True, the animation will continuously loop and the action will continue until interrupted.

  • status The current status of the action. By default, this is ongoing (the action isn't done).

  • initialized If True, the action has initialized. If False, the action will try to send get_initialization_commands(resp) on this frame.

  • done If True, this action is done and won't send any more commands.


Functions

__init__

Animate(animation, collision_detection, forward, library, previous, ik_body_parts, loop)

Parameter Type Default Description
animation str The name of the animation.
collision_detection CollisionDetection The CollisionDetection rules.
forward bool If True, play the animation forwards. If False, play the animation backwards.
library str The name of the animation's library.
previous Optional[Action] The previous action. Can be None.
ik_body_parts List[ReplicantBodyPart] Maintain the IK positions of these body parts.
loop bool If True, the animation will continuously loop and the action will continue until interrupted.

get_initialization_commands

self.get_initialization_commands(resp, static, dynamic, image_frequency)

Parameter Type Default Description
resp List[bytes] The response from the build.
static ReplicantStatic The ReplicantStatic data that doesn't change after the Replicant is initialized.
dynamic ReplicantDynamic The ReplicantDynamic data that changes per communicate() call.
image_frequency ImageFrequency An ImageFrequency value describing how often image data will be captured.

Returns: A list of commands to initialize this action.

get_ongoing_commands

self.get_ongoing_commands(resp, static, dynamic)

Evaluate an action per-frame to determine whether it's done.

Parameter Type Default Description
resp List[bytes] The response from the build.
static ReplicantStatic The ReplicantStatic data that doesn't change after the Replicant is initialized.
dynamic ReplicantDynamic The ReplicantDynamic data that changes per communicate() call.

Returns: A list of commands to send to the build to continue the action.

get_end_commands

self.get_end_commands(resp, static, dynamic, image_frequency)

Parameter Type Default Description
resp List[bytes] The response from the build.
static ReplicantStatic The ReplicantStatic data that doesn't change after the Replicant is initialized.
dynamic ReplicantDynamic The ReplicantDynamic data that changes per communicate() call.
image_frequency ImageFrequency An ImageFrequency value describing how often image data will be captured.

Returns: A list of commands that must be sent to end any action.