Beispiel #1
0
def lineCollision():
    reflect = ReflectanceSensors()
    ZumoButton().wait_for_press()
    motor = Motors()
    stuck = CheckStuck()
    ultra = Ultrasonic()
    proxim = IRProximitySensor()
    sensobCol = Sensob()
    sensobCol.set_sensors([ultra, proxim])
    motob = Motob(motor=motor)
    sensobLine = Sensob()
    sensobLine.set_sensors([reflect])

    arb = Arbitrator(motob=motob)
    bbcon = BBCON(arbitrator=arb, motob=motob)
    bbcon.set_checkStucker(stuck)
    line = LineFollow(1, [sensobLine])
    col = CollisionAvoidance(1, [sensobCol])
    bbcon.add_behavior(line)
    bbcon.add_behavior(col)
    bbcon.add_sensob(sensobCol)
    bbcon.add_sensob(sensobLine)

    count = 0
    while count < 20:
        bbcon.run_one_timestep()
        count += 1
Beispiel #2
0
def trackTest():
    ZumoButton().wait_for_press()
    motor = Motors()
    ultra = Ultrasonic()
    camera = Camera()


    stuck = CheckStuck()
    motob = Motob(motor)
    arbitrator = Arbitrator(motob=motob)

    sensob = Sensob()
    sensob.set_sensors([ultra, camera])

    bbcon = BBCON(arbitrator=arbitrator, motob=motob)
    b = TrackObject(priority=1, sensobs=[sensob])
    bbcon.set_checkStucker(stuck)
    bbcon.add_behavior(b)

    bbcon.activate_behavior(0)
    bbcon.add_sensob(sensob)

    timesteps = 0
    while timesteps < 25:

        bbcon.run_one_timestep()
        timesteps += 1
Beispiel #3
0
def lineTest():
    reflect = ReflectanceSensors()
    ZumoButton().wait_for_press()
    motor = Motors()

    stuck = CheckStuck()

    camera = Camera()

    motob = Motob(motor)
    arbitrator = Arbitrator(motob=motob)

    sensob = Sensob()
    sensob.set_sensors([reflect])
    bbcon = BBCON(arbitrator=arbitrator, motob=motob)
    bbcon.add_sensob(sensob)
    bbcon.set_checkStucker(stuck)

    b = LineFollow(1, [sensob])
    bbcon.add_behavior(b)


    timesteps = 0
    while timesteps < 30:
        bbcon.run_one_timestep()
        timesteps += 1
Beispiel #4
0
def systemTest():

    motor = Motors()
    ultra = Ultrasonic()
    proxim = IRProximitySensor()
    camera = Camera()
    reflectance = ReflectanceSensors()
    motob = Motob(motor)
    arbitrator = Arbitrator(motob)


    stuck = CheckStuck()
    collisionSensob = Sensob()
    collisionSensob.set_sensors([ultra, proxim])

    lineSensob = Sensob()
    lineSensob.set_sensors([reflectance])

    trackSensob = Sensob()
    trackSensob.set_sensors([ultra, camera])


    b = CollisionAvoidance(1, [collisionSensob])
    f = LineFollow(1, [lineSensob])
    t = TrackObject(1, [trackSensob])
    #print(collisionSensob.sensors)
    #print(lineSensob.sensors)
    bbcon = BBCON(arbitrator=arbitrator, motob=motob)
    bbcon.set_checkStucker(stuck)
    bbcon.add_behavior(b)
    bbcon.add_behavior(f)
    bbcon.add_behavior(t)
    #bbcon.activate_behavior(0)
    #bbcon.activate_behavior(1)
    #bbcon.activate_behavior(2)
    bbcon.add_sensob(collisionSensob)
    bbcon.add_sensob(lineSensob)
    bbcon.add_sensob(trackSensob)

    runTimesteps(bbcon, 100)