예제 #1
0
GPIO.output(LSHDN, GPIO.HIGH)
time.sleep(0.01)
lSensor.start_ranging(VL53L0X.VL53L0X_GOOD_ACCURACY_MODE)

# Connect the right sensor and start measurement
GPIO.output(RSHDN, GPIO.HIGH)
time.sleep(0.01)
rSensor.start_ranging(VL53L0X.VL53L0X_GOOD_ACCURACY_MODE)

# Connect the front sensor and start measurement
GPIO.output(FSHDN, GPIO.HIGH)
time.sleep(0.01)
fSensor.start_ranging(VL53L0X.VL53L0X_GOOD_ACCURACY_MODE)

# Initialize encoders
my.initEncoders()

# Set servos to netural
my.setSpeedsPWM(1.5, 1.5)
pwmData, leftTotal, rightTotal = my.readCalibrateFile()

# Tuple of colors with hsv min and max
HSV_MIN = 0
HSV_MAX = 1

# Goal colors HSV
color1 = [(0,91,61),(9,132,176)]      # orange
color2 = [(42,106,55),(68,164,157)]   # Green
color3 = [(152,114,77),(173,185,194)] # pink

# PID constants
예제 #2
0
#calibration.py
#This progeam is stepping through each PWM from 1.3 - 1.7 at intervals of 0.005
#Saves results in a file
import time
import encoder_lib as enc

# Calibrate encoders
enc.initEncoders()
timeX = time.monotonic()
enc.setSpeedsPWM(1.5, 1.5)
enc.calibrateSpeeds(1, 'CalibrateResults.txt')
print(time.monotonic() - timeX)

enc.end()