from tdw.replicant.ik_plans.ik_plan import IkPlan
An IkPlan
takes the reach-for parameters and converts them into a list of actions.
The parameters of IkPlan
are similar to that of a ReachFor
action, but an IkPlan
is not an action.
This is an abstract class. Subclasses of IkPlan
define how the list of ReachFor
actions is set.
An IkPlan
is used by the ReachForWithPlan
action. (From the Replicant API, this is combined with the reach_for(target, arm)
function).
-
duration
The total duration of the motion in seconds. EachReachFor
action is a fraction of this. For example, if there are 2ReachFor
actions, then the duration of each of them isduration / 2
. -
scale_duration
If True,duration
will be multiplied byframerate / 60
, ensuring smoother motions at faster-than-life simulation speeds. -
arms
TheArm
(s) that will reach for each target. -
collision_detection
TheCollisionDetection
rules. -
previous
The previous action. Can be None. -
targets
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
If True, the target position is in world space coordinates. If False, the target position is relative to the Replicant. Ignored iftarget
is an int. -
arrived_at
If the finalReachFor
action ends and the hand is this distance or less from the target, the motion succeeds. -
max_distance
If at the start of the firstReachFor
action the target is further away than this distance from the hand, the action fails. -
from_held
If 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_point
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 thetarget
. This is ignored iffrom_held == False
or ths hand isn't holding an object.
IkPlan(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. |
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
.