Beispiel #1
0
 def detect_connected_motors(self):
     for motor in ev3.list_motors():
         letter = motor.address[-1:].lower()
         if letter in self.motors:
             self.motors[letter].set_motor(motor)
         else:
             self.motors[letter] = ConfiguredMotor(motor=motor)
Beispiel #2
0
 def main(self, done):
     if self.remote:
         try:
             while not done.is_set():
                 self.remote.process()
                 time.sleep(0.01)
         # Exit cleanly so that all motors are stopped
         except (KeyboardInterrupt, Exception) as e:
             log.exception(e)
             for motor in ev3.list_motors():
                 motor.stop()
 def __del__(self):
     for motor in ev3.list_motors():
         motor.stop(stop_action='coast')
Beispiel #4
0
log.info("Started TRACK3RWithPen")
if not silent: ev3.Sound.speak("I'm ready!")

#trackerBasic.main(done)
# our custom loop processing all speeds:
try:
    while not done.is_set():
        trackerBasic.process()
        trackerFast.process()
        trackerSlow.process()
        time.sleep(0.01)
# Exit cleanly so that all motors are stopped
except (KeyboardInterrupt, Exception) as e:
    log.exception(e)
    done.set()
    for motor in ev3.list_motors():
        motor.stop(stop_action='coast')

# hopefully it will be sufficient to start one
if not silent: ev3.Sound.speak("Exiting!")
log.info("Exiting TRACK3RWithPen")

for motor in ev3.list_motors():
    motor.stop(stop_action='coast')

# release all threads to let them stop
color_speaker_on.set()

done.set()
#touchthread.join()
colorthread.join()
Beispiel #5
0
from ev3dev import ev3

for i in ev3.list_motors():
    i.stop()