Skip to content

hardware

Bms

Bms(**kwargs) -> None

Bases: Module, abc.ABC

The BMS module communicates with a simple battery management system over a serial connection.

The BMS module provides measured voltages as an event.

Events

Name Description
VOLTAGE_MEASURED new voltage measurements are available for processing (argument: list of voltages)

BmsHardware

BmsHardware(
    robot_brain: RobotBrain,
    *,
    expander: Optional[ExpanderHardware] = None,
    name: str = "bms",
    rx_pin: int = 26,
    tx_pin: int = 27,
    baud: int = 9600,
    num: int = 1
) -> None

Bases: Bms, ModuleHardware

This module implements the hardware interface for the BMS module.

Events

Name Description
VOLTAGE_MEASURED new voltage measurements are available for processing (argument: list of voltages)

BmsSimulation

BmsSimulation(
    is_charging: Optional[Callable[[], bool]] = None,
    fixed_voltage: Optional[float] = None,
) -> None

Bases: Bms, ModuleSimulation

This module simulates a BMS module.

Events

Name Description
VOLTAGE_MEASURED new voltage measurements are available for processing (argument: list of voltages)

Bumper

Bumper(estop: EStop, **kwargs) -> None

Bases: Module, abc.ABC

A module that detects when a bumper is triggered.

Events

Name Description
BUMPER_TRIGGERED a bumper was triggered (argument: the bumper name)

BumperHardware

BumperHardware(
    robot_brain: RobotBrain,
    *,
    name: str = "bumper",
    pins: dict[str, int],
    estop: Optional[EStop] = None
) -> None

Bases: Bumper, ModuleHardware

Hardware implementation of the bumper module.

The module expects a dictionary of pin names and pin numbers. If an e-stop is provided, the module will not trigger bumpers if the e-stop is active.

Events

Name Description
BUMPER_TRIGGERED a bumper was triggered (argument: the bumper name)

BumperSimulation

Bases: Bumper, ModuleSimulation

Simulation of the bumper module.

Events

Name Description
BUMPER_TRIGGERED a bumper was triggered (argument: the bumper name)

Communication

Communication() -> None

Bases: abc.ABC

This abstract module defines an interface for communicating with a microcontroller.

Besides sending and receiving messages a communication module provides a property whether communication is possible. It can also provide a piece of debug UI.

EStop

EStop(**kwargs) -> None

Bases: Module, abc.ABC

A module that detects when the e-stop is triggered.

Events

Name Description
ESTOP_TRIGGERED the e-stop was triggered

EStopHardware

EStopHardware(
    robot_brain: RobotBrain,
    *,
    name: str = "estop",
    pins: dict[str, int]
) -> None

Bases: EStop, ModuleHardware

Hardware implementation of the e-stop module.

The module expects a dictionary of pin names and pin numbers.

Events

Name Description
ESTOP_TRIGGERED the e-stop was triggered

EStopSimulation

Bases: EStop, ModuleSimulation

Simulation of the e-stop module.

Events

Name Description
ESTOP_TRIGGERED the e-stop was triggered

ExpanderHardware

ExpanderHardware(
    robot_brain: RobotBrain,
    *,
    name: str = "p0",
    serial: SerialHardware,
    boot: int = 25,
    enable: int = 14
) -> None

Bases: ModuleHardware

The expander module represents a second ESP microcontroller connected to the core ESP via serial.

RobotBrain

RobotBrain(communication: Communication) -> None

This module manages the communication with a Zauberzeug Robot Brain.

It expects a communication object, which is used for the actual read and write operations. Besides providing some basic methods like configuring or restarting the microcontroller, it augments and verifies checksums for each message.

Events

Name Description
LINE_RECEIVED a line has been received from the microcontroller (argument: line as string)

SerialCommunication

SerialCommunication(baud_rate: int = 115200) -> None

Bases: Communication

This module implements a communication via a serial device with a given baud rate.

It contains a list of search paths for finding the serial device.

SerialHardware

SerialHardware(
    robot_brain: RobotBrain,
    *,
    name: str = "serial",
    rx_pin: int = 26,
    tx_pin: int = 27,
    baud: int = 115200,
    num: int = 1
) -> None

Bases: ModuleHardware

The serial module represents a serial connection with another device.

WebCommunication

WebCommunication() -> None

Bases: Communication

Remote connection to the Robot Brain's ESP.

This makes it possible to keep developing on your fast computer while communicating with the hardware components connected to a physical Robot Brain.

Wheels

Wheels(**kwargs) -> None

Bases: Module, abc.ABC

This module represents wheels for a two-wheel differential drive.

Wheels can be moved using the drive methods and provide measured velocities as an event.

Events

Name Description
VELOCITY_MEASURED new velocity measurements are available for processing (argument: list of velocities)

WheelsHardware

WheelsHardware(
    robot_brain: RobotBrain,
    *,
    can: CanHardware,
    name: str = "wheels",
    left_can_address: int = 0,
    right_can_address: int = 256,
    m_per_tick: float = 0.01,
    width: float = 0.5,
    is_left_reversed: bool = False,
    is_right_reversed: bool = False
) -> None

Bases: Wheels, ModuleHardware

This module implements wheels hardware.

Drive and stop commands are forwarded to a given Robot Brain. Velocities are read and emitted regularly.

Events

Name Description
VELOCITY_MEASURED new velocity measurements are available for processing (argument: list of velocities)

WheelsSimulation

WheelsSimulation() -> None

Bases: Wheels, ModuleSimulation

This module simulates two wheels.

Drive and stop commands impact internal velocities (linear and angular). A simulated pose is regularly updated with these velocities, while the velocities are emitted as an event.

Events

Name Description
VELOCITY_MEASURED new velocity measurements are available for processing (argument: list of velocities)