def stop(self): if self.interface == "I2C": self.front_left.move(0, 0) self.rear_left.move(0, 0) self.front_right.move(0, 0) self.rear_right.move(0, 0) elif self.interface == "UDP": motor_udp.stop() self.state = MotorState.STOP
fd = sys.stdin.fileno() old_settings = termios.tcgetattr(fd) try: tty.setraw(sys.stdin.fileno()) ch = sys.stdin.read(1) finally: termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) return ch if __name__ == "__main__": while(True): key = getKey() d_logger.debug("Key %s pressed", key) if(key == 'c'): motor_udp.stop() sys.exit(0) elif(key == 'C'): motor_udp.stop() sys.exit(0) elif(key == 'w'): motor_udp.send_motor_speed_fl(50) motor_udp.send_motor_speed_fr(50) motor_udp.send_motor_speed_rr(50) motor_udp.send_motor_speed_rl(50) elif(key == 'W'): motor_udp.send_motor_speed_fl(100) motor_udp.send_motor_speed_fr(100) motor_udp.send_motor_speed_rr(100) motor_udp.send_motor_speed_rl(100) elif(key == 'a'):