def scanSuspect():
    r = requests.get('http://jetson/scan')
    if r.text == "attack":
        motor.setSpeed(200)
        motor.forward()
        time.sleep(1)
        motor.ctrl(0)
    return r.text
def scenario1():
    motor.forward()
    time.sleep(5)
    motor.ctrl(0)
    scanSuspect()
    if r.text != "attack":
        motor.backward()
        time.sleep(5)
        motor.ctrl(0)
def sectionB():
    motor.forward()
    time.sleep(2)
    car_dir.turn_left()
    time.sleep(3)
    motor.ctrl(0)
    scanSuspect()
    if r.text != "attack":
        motor.backward()
        time.sleep(3)
        car_dir.turn_right()
        time.sleep(2)
        motor.ctrl(0)
Esempio n. 4
0
def motor_forward(request):
    motor.forward()
    return HttpResponse("Forward")