def collect_one_point(camera, steering_angle, Xs, ys): frame = camera.capture() frame = resize(frame) set_steering(steering_angle) time.sleep(0.1) set_throttle(CAR_THROTTLE_FORWARD_SAFE_SPEED) time.sleep(0.2) set_throttle(0.0) Xs.append(frame) ys.append(steering_angle)
def collect_one_point(camera, steering_angle, Xs, ys): frame = camera.capture() frame = resize(frame) set_steering(steering_angle) time.sleep(0.1) set_throttle(safe_forward_throttle()) time.sleep(0.2) set_throttle(0.0) Xs.append(frame) ys.append(steering_angle)
def _calibrate_servo_range(): _setup_motors() motor_params = _query_motor_params() steering_left = motor_params['steering_left'] steering_mid = motor_params['steering_mid'] steering_right = motor_params['steering_right'] _setup_motors(30000) m.set_steering(45.0) v = _easy_ask("Steering left PWM value", steering_left, int) while True: steering_left = v STORE.put('CAR_MOTOR_STEERING_LEFT', steering_left) _setup_motors(30000) # <-- nearabout the max possible timeout m.set_steering(45.0) v = _easy_ask("Steering left PWM value", steering_left, int) if v == steering_left: break # break when the user doesn't change the value _setup_motors(30000) m.set_steering(-45.0) v = _easy_ask("Steering right PWM value", steering_right, int) while True: steering_right = v STORE.put('CAR_MOTOR_STEERING_RIGHT', steering_right) _setup_motors(30000) # <-- nearabout the max possible timeout m.set_steering(-45.0) v = _easy_ask("Steering right PWM value", steering_right, int) if v == steering_right: break # break when the user doesn't change the value _setup_motors() m.set_steering(0) v = _easy_ask("Steering mid PWM value", steering_mid, int) while True: steering_mid = v STORE.put('CAR_MOTOR_STEERING_MID', steering_mid) _setup_motors() _demo_forward_reverse_no_pid() v = _easy_ask("Steering mid PWM value", steering_mid, int) if v == steering_mid: break # break when the user doesn't change the value _setup_motors(save=True)
def demo_steering(): time.sleep(1.5) set_steering(-45.0) time.sleep(1.0) set_steering(45.0) time.sleep(1.0) set_steering(0.0) time.sleep(2.0)
def demo_mid(new_val): STORE.put('CAR_MOTOR_STEERING_MID', new_val) _setup_motors(30000) # <-- nearabout the max possible timeout m.set_steering(0.0) # <-- mid-steering ("straight")
def demo_right(new_val): STORE.put('CAR_MOTOR_STEERING_RIGHT', new_val) _setup_motors(30000) # <-- nearabout the max possible timeout m.set_steering(-45.0) # <-- max right
def demo_left(new_val): STORE.put('CAR_MOTOR_STEERING_LEFT', new_val) _setup_motors(30000) # <-- nearabout the max possible timeout m.set_steering(45.0) # <-- max left
from car.motors import set_steering import time time.sleep(3.5) set_steering(-45.0) time.sleep(1.0) set_steering(45.0) time.sleep(1.0) set_steering(0.0) time.sleep(2.0)