Skip to content

Latest commit

 

History

History
84 lines (50 loc) · 2.8 KB

action.md

File metadata and controls

84 lines (50 loc) · 2.8 KB

Action

from magnebot.actions.action import Action

An action that the Magnebot can do. An action is initialized, has an ongoing state, and an end state. An action also has a status indicating whether it's ongoing, succeeded, or failed; and if it failed, why.


Class Variables

Variable Type Description Value
JOINT_ORDER Dict[Arm, List[ArmJoint]] The order in which joint angles will be set. {Arm.left: [ArmJoint.column,

Fields

  • status The current status of the action. By default, this is ongoing (the action isn't done).

  • initialized If True, the action has initialized. If False, the action will try to send get_initialization_commands(resp) on this frame.

  • done If True, this action is done and won't send any more commands.


Functions

__init__

Action()

(no parameters)

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 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.

set_status_after_initialization

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.

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 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.

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 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.