_physical_interface

Module Contents

Classes

PhysicalInterface

Abstract implementation for interfacing with hardware.

class PhysicalInterface

Bases: abc.ABC

Inheritance diagram of modular_robot_physical.physical_interfaces._physical_interface.PhysicalInterface

Abstract implementation for interfacing with hardware.

abstract set_servo_targets(pins: list[int], targets: list[float]) None

Set the target for multiple servos.

This can be a fairly slow operation.

Parameters:
  • pins – The GPIO pins.

  • targets – The target angles.

abstract enable() None

Start the robot.

abstract disable() None

Set the robot to low power mode.

This disables all active modules and sensors.

abstract get_battery_level() float

Get the battery level.

Returns:

The battery level as a number between 0.0 and 1.0.

Raises:

NotImplementedError – If getting the battery level is not supported on this hardware.

abstract get_multiple_servo_positions(pins: Sequence[int]) list[float]

Get the current position of multiple servos.

Parameters:

pins – The GPIO pins.

Returns:

The current positions.

Raises:

NotImplementedError – If getting the servo position is not supported on this hardware.

abstract get_imu_angular_rate() pyrr.Vector3

Get the angular rate from the IMU.

Returns:

The angular rate.

Raises:

NotImplementedError – If the IMU is not supported on this hardware.

abstract get_imu_orientation() pyrr.Vector3

Get the orientation from the IMU.

Returns:

The orientation.

Raises:

NotImplementedError – If the IMU is not supported on this hardware.

abstract get_imu_specific_force() pyrr.Vector3

Get the specific force from the IMU.

Returns:

The specific force.

Raises:

NotImplementedError – If the IMU is not supported on this hardware.

abstract get_camera_view() numpy.typing.NDArray[numpy.uint8] | None

Get the current view from the camera.

Returns:

The camera view.

Raises:

NotImplementedError – If the Camera is not supported on this hardware.