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
def main(): wp.wiringPiSetupGpio() ZumoButton().wait_for_press() global bbcon bbcon = BBCON() signal.signal(signal.SIGINT, signal_handler) run_forward = RunForward(bbcon, 2, []) bbcon.add_behavior(run_forward) bbcon.activate_behavior(run_forward) #stand_still = StandStill(bbcon, 1, []) #bbcon.add_behavior(stand_still) #bbcon.activate_behavior(stand_still) line_follower = LineFollower(bbcon, 5, [bbcon.sensobs['line_pos']]) bbcon.add_behavior(line_follower) bbcon.activate_behavior(line_follower) find_red = FindRed( bbcon, 3, [bbcon.sensobs['red_search'], bbcon.sensobs['distance']]) bbcon.add_behavior(find_red) avoid_walls = AvoidWalls( bbcon, 10, [bbcon.sensobs['distance'], bbcon.sensobs['proximity']]) bbcon.add_behavior(avoid_walls) bbcon.activate_behavior(avoid_walls) while True: bbcon.run_one_timestep()