physical_interfaces
Interfaces to the hardware.
Subpackages
Package Contents
Classes
Abstract implementation for interfacing with hardware. |
Functions
|
Get the interface for the given hardware type. |
- get_interface(hardware_type: modular_robot_physical._hardware_type.HardwareType, debug: bool, dry: bool) modular_robot_physical.physical_interfaces._physical_interface.PhysicalInterface
Get the interface for the given hardware type.
- Parameters:
hardware_type – The type of hardware.
debug – If debugging messages are activated.
dry – If servo outputs are not propagated to the physical servos.:
- Returns:
The interface.
- Raises:
NotImplementedError – If the hardware type is not supported or if careful is enabled and not supported for the hardware type.
ModuleNotFoundError – If some required package are not installed.
- class PhysicalInterface
Bases:
abc.ABC
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.