from magnebot.actions.reach_for import ReachFor
Reach for a target position. The action ends when the magnet is at or near the target position, or if it fails to reach the target. The Magnebot may try to reach for the target multiple times, trying different IK orientations each time, or no times, if it knows the action will fail.
Variable | Type | Description | Value |
---|---|---|---|
JOINT_ORDER |
Dict[Arm, List[ArmJoint]] | The order in which joint angles will be set. | {Arm.left: [ArmJoint.column, |
-
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. -
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. -
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. -
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.
ReachFor(target, absolute, arm, set_torso, orientation_mode, target_orientation, dynamic)
ReachFor(target, absolute, arrived_at=0.125, arm, set_torso, orientation_mode, target_orientation, dynamic)
Parameter | Type | Default | Description |
---|---|---|---|
target | np.array | The target position. | |
absolute | bool | If True, target is in absolute world coordinates. If False , target is relative to the position and rotation of the Magnebot. |
|
arrived_at | float | 0.125 | If the magnet is this distance or less from target , then the action is successful. |
arm | Arm | The arm used for this action. | |
set_torso | bool | If True, stop sliding the torso when the arms stop moving at the end of the action. | |
orientation_mode | OrientationMode | The orientation mode. | |
target_orientation | TargetOrientation | The target orientation. | |
dynamic | MagnebotDynamic | The dynamic Magnebot data. |
self.get_initialization_commands(resp, static, dynamic, image_frequency)
Parameter | Type | Default | Description |
---|---|---|---|
resp | List[bytes] | The response from the build. | |
static | MagnebotStatic | The static Magnebot data. | |
dynamic | MagnebotDynamic | The dynamic Magnebot data. | |
image_frequency | ImageFrequency | How image data will be captured during the image. |
Returns: A list of commands to initialize this action.
self.set_status_after_initialization()
In some cases (such as camera actions) that finish on one frame, we want to set the status after sending initialization commands. To do so, override this method.
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 | MagnebotStatic | The static Magnebot data. | |
dynamic | MagnebotDynamic | The dynamic Magnebot data. |
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 | MagnebotStatic | The static Magnebot data. | |
dynamic | MagnebotDynamic | The dynamic Magnebot data. | |
image_frequency | ImageFrequency | How image data will be captured during the image. |
Returns: A list of commands that must be sent to end any action.