Reset
June 5, 2023 ยท View on GitHub
from tdw.replicant.ik_plans.reset import Reset
Reset the Replicant to its neutral position and then reach for the target.
Fields
-
durationThe total duration of the motion in seconds. EachReachForaction is a fraction of this. For example, if there are 2ReachForactions, then the duration of each of them isduration / 2. -
scale_durationIf True,durationwill be multiplied byframerate / 60, ensuring smoother motions at faster-than-life simulation speeds. -
armsTheArm(s) that will reach for each target. -
collision_detectionTheCollisionDetectionrules. -
previousThe previous action. Can be None. -
targetsThe targets per arm. If int: An object ID. If dict: A position as an x, y, z dictionary. If numpy array: A position as an [x, y, z] numpy array. -
absoluteIf True, the target position is in world space coordinates. If False, the target position is relative to the Replicant. Ignored iftargetis an int. -
arrived_atIf the finalReachForaction ends and the hand is this distance or less from the target, the motion succeeds. -
max_distanceIf at the start of the firstReachForaction the target is further away than this distance from the hand, the action fails. -
from_heldIf False, the Replicant will try to move its hand to thetarget. If True, the Replicant will try to move its held object to thetarget. -
held_pointThe bounds point of the held object from which the offset will be calculated. Can be"bottom","top", etc. For example, if this is"bottom", the Replicant will move the bottom point of its held object to thetarget. This is ignored iffrom_held == Falseor ths hand isn't holding an object.
Functions
__init__
__init__
Reset(targets, absolute, arrived_at, max_distance, arms, dynamic, collision_detection, previous, duration, scale_duration, from_held, held_point)
| Parameter | Type | Default | Description |
|---|---|---|---|
| targets | List[TARGET] | The targets per arm. If int: An object ID. If dict: A position as an x, y, z dictionary. If numpy array: A position as an [x, y, z] numpy array. | |
| absolute | bool | If True, the target position is in world space coordinates. If False, the target position is relative to the Replicant. Ignored if target is an int. | |
| arrived_at | float | If the final ReachFor action ends and the hand is this distance or less from the target, the motion succeeds. | |
| max_distance | float | If at the start of the first ReachFor action the target is further away than this distance from the hand, the action fails. | |
| arms | List[Arm] | The Arm(s) that will reach for each target. | |
| dynamic | ReplicantDynamic | The ReplicantDynamic data that changes per communicate() call. | |
| collision_detection | CollisionDetection | The CollisionDetection rules. | |
| previous | Optional[Action] | The previous action. Can be None. | |
| duration | float | The total duration of the motion in seconds. Each ReachFor action is a fraction of this. For example, if there are 2 ReachFor actions, then the duration of each of them is duration / 2. | |
| scale_duration | bool | If True, duration will be multiplied by framerate / 60, ensuring smoother motions at faster-than-life simulation speeds. | |
| from_held | bool | If False, the Replicant will try to move its hand to the target. If True, the Replicant will try to move its held object to the target. This is ignored if the hand isn't holding an object. | |
| held_point | str | The bounds point of the held object from which the offset will be calculated. Can be "bottom", "top", etc. For example, if this is "bottom", the Replicant will move the bottom point of its held object to the target. This is ignored if from_held == False or ths hand isn't holding an object. |
get_actions
self.get_actions(resp, static, dynamic)
| 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 Action.