hardware
Bms ¶
Bms(**kwargs)
Bases: Module
, 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
)
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,
)
Events¶
Name | Description |
---|---|
VOLTAGE_MEASURED | new voltage measurements are available for processing (argument: list of voltages) |
Bumper ¶
Bumper(estop: Optional[EStop], **kwargs)
Bases: Module
, 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
)
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 ¶
BumperSimulation(estop: Optional[EStop], **kwargs)
Events¶
Name | Description |
---|---|
BUMPER_TRIGGERED | a bumper was triggered (argument: the bumper name) |
Communication ¶
Communication()
Bases: 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)
Bases: Module
, ABC
A module that detects when the e-stop is triggered.
The module has a boolean field active
that is true when the e-stop is triggered.
There is also a boolean field is_soft_estop_active
that is true when the soft e-stop is active.
It can be set to true or false by calling set_soft_estop(active: bool)
.
Events¶
Name | Description |
---|---|
ESTOP_TRIGGERED | the e-stop was triggered |
EStopHardware ¶
EStopHardware(
robot_brain: RobotBrain,
*,
name: str = "estop",
pins: dict[str, int]
)
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 ¶
EStopSimulation(**kwargs)
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
)
Bases: ModuleHardware
The expander module represents a second ESP microcontroller connected to the core ESP via serial.
RobotBrain ¶
RobotBrain(communication: Communication)
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)
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
)
Bases: ModuleHardware
The serial module represents a serial connection with another device.
WebCommunication ¶
WebCommunication()
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)
Bases: Module
, 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
)
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()
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) |