from tdw.replicant.actions.drop import Drop
Drop a held object.
The action ends when the object stops moving or the number of consecutive communicate()
calls since dropping the object exceeds self.max_num_frames
.
When an object is dropped, it is made non-kinematic. Any objects contained by the object are parented to it and also made non-kinematic. For more information regarding containment in TDW, read this.
-
arm
TheArm
holding the object. -
object_id
The ID of the held object. -
object_position
The current position of the object. -
max_num_frames
Wait this number ofcommunicate()
calls maximum for the object to stop moving before ending the action. -
frame_count
The current frame. -
offset
Prior to being dropped, set the object's positional offset. This can be a float (a distance along the object's forward directional vector). Or it can be a dictionary or numpy array (a world space position). -
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.
Drop(arm, dynamic, max_num_frames, offset)
Parameter | Type | Default | Description |
---|---|---|---|
arm | Arm | The Arm holding the object. |
|
dynamic | ReplicantDynamic | The ReplicantDynamic data that changes per communicate() call. |
|
max_num_frames | int | Wait this number of communicate() calls maximum for the object to stop moving before ending the action. |
|
offset | Union[float, np.ndarray, Dict[str, float] | Prior to being dropped, set the object's positional offset. This can be a float (a distance along the object's forward directional vector). Or it can be a dictionary or numpy array (a world space position). |
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.