-
Notifications
You must be signed in to change notification settings - Fork 0
Hardware
The hardware folder has several useful classes with the necessary functions.
hardware.getPCA(frequency=60) -> PCA9685
Returns a adafruit_pca9685.PCA9685 object with the given frequency
-
frequency: Frequency of the PCA9685
import hardware
pca = hardware.getPCA()hardware.ESC(channel: PWMChannel) -> ESC
Calibrates a connected ESC and provides a speed controller
-
channel: The channel of the ESC
Sample use:
esc = hardware.ESC(pca.channels[15]) # replace with used channel
esc.speed = 1 # Forward
esc.speed = -1 # Backward
esc.speed = 0 # Stophardware.Servo(channel: PWMChannel) -> Servo
Calculates duty cycle for servo
-
channel: The channel of the servo
Sample use:
servo = hardware.Servo(pca.channels[0]) # replace with used channel
servo.turn(90) # Turn 90 degrees
servo.turn(180) # Turn 180 degreeshardware.CameraHandler(camera, calibratePatternSize: Tuple[int] = (5,5), lowThreshold=65, highThreshold=255, capProp=None) -> CameraHandler
A simplifier for the camera post-processing and prediction. Uses checkerboard pattern recognition from opencv to get ROI (Region of interest) coordinates which will later be used to warp the image. The warped image is then thresholded to get a vivid black and white image of the road lines, then the prediction is performed.
-
camera: The camera index or path -
calibratePatternSize: Checkerboard -
lowThreshold: Lower threshold value -
highThreshold: Higher threshold value -
capProp: Additional camera setting. (e.g.cv2.CAP_DSHOW)
hardware.Car(pca: PCA9685, escChannel: int, steerChannel: int, camera) -> Car
A class to combine and simplify ESC, servo and camera together
-
pca: PCA9685 object in which the ESC and servo is connected to -
escChannel: Channel of the ESC -
steerChannel: Channel of the Servo -
camera: Camera index or path