from tdw.replicant.actions.head_motion import HeadMotion
Abstract base class for actions that rotate the Replicant's head.
During a head motion, the Replicant's head will continuously move over multiple communicate()
calls until either the motion is complete.
-
duration
The duration of the motion in seconds. -
scale_duration
If True,duration
will be multiplied byframerate / 60)
, ensuring smoother motions at faster-than-life simulation speeds. -
status
The current status of the action. By default, this isongoing
(the action isn't done). -
initialized
If True, the action has initialized. If False, the action will try to sendget_initialization_commands(resp)
on this frame. -
done
If True, this action is done and won't send any more commands.
__init__
HeadMotion(duration, scale_duration)
Parameter | Type | Default | Description |
---|---|---|---|
duration | float | The duration of the motion in seconds. | |
scale_duration | bool | If True, duration will be multiplied by framerate / 60) , ensuring smoother motions at faster-than-life simulation speeds. |
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.
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.
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.