Trait oc2_hlapi::device::RobotInterface

source ·
pub trait RobotInterface: RpcDevice {
Show 13 methods // Required methods fn get_energy_stored(&self) -> Result<i32>; fn get_max_energy_stored(&self) -> Result<i32>; fn get_selected_slot(&self) -> Result<i32>; fn set_selected_slot(&self, slot: i32) -> Result<()>; fn get_stack_in_slot<T: DeserializeOwned>(&self, slot: i32) -> Result<T>; fn get_last_action_id(&self) -> Result<i32>; fn get_queued_action_count(&self) -> Result<i32>; fn get_action_result(&self, id: i32) -> Result<RobotActionResult>; fn move_async(&self, direction: Direction) -> Result<()>; fn turn_async(&self, direction: RotationDirection) -> Result<()>; fn move_wait(&self, direction: Direction) -> Result<bool>; fn turn_wait(&self, direction: RotationDirection) -> Result<bool>; fn wait_for_action(&self, action: i32) -> Result<bool>;
}
Expand description

An interface between robots and the HLAPI.

Required Methods§

source

fn get_energy_stored(&self) -> Result<i32>

Returns the amount of FE stored in a robot.

source

fn get_max_energy_stored(&self) -> Result<i32>

Returns the maximum possible energy that a robot can store.

source

fn get_selected_slot(&self) -> Result<i32>

Returns the index of the currently active slot.

source

fn set_selected_slot(&self, slot: i32) -> Result<()>

Sets the currently active slot to the given index.

source

fn get_stack_in_slot<T: DeserializeOwned>(&self, slot: i32) -> Result<T>

Returns information about the item in the given slot.

source

fn get_last_action_id(&self) -> Result<i32>

Returns the ID of the previously performed action.

source

fn get_queued_action_count(&self) -> Result<i32>

Returns the currently queued number of actions.

source

fn get_action_result(&self, id: i32) -> Result<RobotActionResult>

Returns the state of a robot’s action with a given ID.

source

fn move_async(&self, direction: Direction) -> Result<()>

Attempts to move in the given direction without blocking.

source

fn turn_async(&self, direction: RotationDirection) -> Result<()>

Attempts to turn in the given direction without blocking.

source

fn move_wait(&self, direction: Direction) -> Result<bool>

Attempts to move a robot in the given direction, blocking until the action has completed. Returns whether the operation completed successfully.

source

fn turn_wait(&self, direction: RotationDirection) -> Result<bool>

Attempts to turn a robot in the given direction, blocking until the action has completed. Returns whether the operation completed successfully.

source

fn wait_for_action(&self, action: i32) -> Result<bool>

Waits for the action with the given ID to complete. Returns whether the operation completed successfully.

Object Safety§

This trait is not object safe.

Implementors§