40 lines
893 B
Python
40 lines
893 B
Python
# config.py - Robot configuration shared across all modules
|
|
from pybricks.hubs import PrimeHub
|
|
from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor
|
|
from pybricks.parameters import Port
|
|
|
|
# Initialize hub
|
|
hub = PrimeHub()
|
|
|
|
# Robot hardware configuration
|
|
ROBOT_CONFIG = {
|
|
# Drive motors
|
|
'left_motor': Motor(Port.A),
|
|
'right_motor': Motor(Port.B),
|
|
|
|
# Attachment motors
|
|
'attachment_motor': Motor(Port.C),
|
|
'lift_motor': Motor(Port.D),
|
|
|
|
# Sensors
|
|
#'color_left': ColorSensor(Port.E),
|
|
'color_back': ColorSensor(Port.F),
|
|
'ultrasonic': UltrasonicSensor(Port.E),
|
|
|
|
# Hub reference
|
|
'hub': hub
|
|
}
|
|
|
|
# Speed and distance constants
|
|
SPEEDS = {
|
|
'FAST': 400,
|
|
'NORMAL': 250,
|
|
'SLOW': 100,
|
|
'PRECISE': 50
|
|
}
|
|
|
|
DISTANCES = {
|
|
'TILE_SIZE': 300, # mm per field tile
|
|
'ROBOT_LENGTH': 180, # mm
|
|
'ROBOT_WIDTH': 140 # mm
|
|
} |