RotateHead
February 21, 2023 ยท View on GitHub
from tdw.replicant.actions.rotate_head import RotateHead
Rotate the head by an angle around an axis.
The head will continuously move over multiple communicate() calls until it is looking at the target.
Fields
-
axisThe axis of rotation. Options:"pitch","yaw","roll". -
angleThe target angle in degrees. -
durationThe duration of the motion in seconds. -
scale_durationIf True,durationwill be multiplied byframerate / 60), ensuring smoother motions at faster-than-life simulation speeds. -
statusThe current status of the action. By default, this isongoing(the action isn't done). -
initializedIf True, the action has initialized. If False, the action will try to sendget_initialization_commands(resp)on this frame. -
doneIf True, this action is done and won't send any more commands. -
durationThe duration of the motion in seconds. -
scale_durationIf True,durationwill be multiplied byframerate / 60), ensuring smoother motions at faster-than-life simulation speeds. -
statusThe current status of the action. By default, this isongoing(the action isn't done). -
initializedIf True, the action has initialized. If False, the action will try to sendget_initialization_commands(resp)on this frame. -
doneIf True, this action is done and won't send any more commands. -
statusThe current status of the action. By default, this isongoing(the action isn't done). -
initializedIf True, the action has initialized. If False, the action will try to sendget_initialization_commands(resp)on this frame. -
doneIf True, this action is done and won't send any more commands.
Functions
__init__
RotateHead(axis, angle, duration, scale_duration)
| Parameter | Type | Default | Description |
|---|---|---|---|
| axis | str | The axis of rotation. Options: "pitch", "yaw", "roll". | |
| angle | float | The target angle in degrees. | |
| 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. |
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.