Пример #1
0
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)
Пример #2
0
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)
Пример #3
0
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)
Пример #4
0
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)
Пример #5
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")
Пример #6
0
 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
Пример #7
0
 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
Пример #8
0
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)