src package

Subpackages

Submodules

src.camera module

class src.camera.Camera(config: Config)[source]

Bases: object

cam: picamera2.Picamera2
capture()[source]
image_array: ndarray
class src.camera.Config[source]

Bases: TypedDict

show_preview: bool

src.distance_sensor module

class src.distance_sensor.Config[source]

Bases: TypedDict

pins: PinsConfig
class src.distance_sensor.DistanceSensor(*args, **kwargs)[source]

Bases: DistanceSensor

child class of gpiozero.InputDevice, main functionality is instance property ‘distance’

class src.distance_sensor.PinsConfig[source]

Bases: TypedDict

echo: int
trigger: int

src.led module

class src.led.Config[source]

Bases: TypedDict

pin: int
class src.led.LED(config: Config)[source]

Bases: object

off()[source]
on()[source]
pin: int

src.motor module

class src.motor.Config[source]

Bases: TypedDict

pins: PinsConfig
class src.motor.Motor(config: Config)[source]

Bases: object

MAX_SPEED: float = 1.0
backward(speed: float) None[source]

Spin the motor backward at a given speed

control1: LED
control2: LED
drive(speed: float, direction: bool) None[source]

Spin the motor at a given speed and direction

speed: float in [0, 1] direction: True for forward, False for backwards

forward(speed: float) None[source]

Spin the motor forward at a given speed

pwm: PWMLED
stop() None[source]

Stop the motor

class src.motor.PinsConfig[source]

Bases: TypedDict

control1: int
control2: int
encoder: int
speed: int

src.params module

src.switch module

class src.switch.Config[source]

Bases: TypedDict

pin: int
class src.switch.Switch(*args, **kwargs)[source]

Bases: Button

state: bool

child class of gpiozero.Button

switch_state()[source]

src.vehicle module

class src.vehicle.Config[source]

Bases: TypedDict

motors: MotorsConfig
slant: float
class src.vehicle.MotorsConfig[source]

Bases: TypedDict

left: Config
right: Config
class src.vehicle.Vehicle(config: Config)[source]

Bases: object

static calculate_slant_from_ticks(left_motor_ticks: int, right_motor_ticks: int) float[source]

Calculate the slant of the vehicle based on the difference in ticks between the left and right motors

current_speed: float
drive(left_speed: float, left_direction: bool, right_speed: float, right_direction: bool)[source]
drive_backward(speed: float = 1.0) None[source]

turn both motors backward at a given speed

drive_forward(speed: float = 1.0) None[source]

turn both motors forward at a given speed

left_motor: Motor
mode: str | None
pivot_left(speed: float = 1.0) None[source]

at the same speed, drive the left motor backward, and the right motor forward

pivot_right(speed: float = 1.0) None[source]

at the same speed, drive the left motor forward, and the right motor backward

right_motor: Motor
slant: float
stop() None[source]

stop both motors

test_run_calculate_slant()[source]

src.wheel_encoder module

class src.wheel_encoder.Config[source]

Bases: TypedDict

pin: int
class src.wheel_encoder.WheelEncoder(*args, **kwargs)[source]

Bases: Button

TICKS_PER_REVOLUTION: int = 192
WHEEL_RADIUS: float = 25.0
static distance_from_ticks(ticks)[source]
increment_ticks()[source]
static revolutions_from_ticks(ticks)[source]
ticks: int

Module contents