import RobotCompletCode Controls = RobotCompletCode.MotorizedPlatform() class Robot: def init(self): Controls.init() def set_range(self, name:str, mini:int, maxi:int): Controls.set_range(name,mini,maxi) def translation(self, direction, vitesse): if direction == 'N': Controls.northTranslation(vitesse) elif direction == 'E': Controls.eastTranslation(vitesse) elif direction == 'W': Controls.westTranslation(vitesse) elif direction == 'S': Controls.southTranslation(vitesse) elif direction =='SE': Controls.southEastTranslation(vitesse) elif direction == 'SW': Controls.southWestTranslation(vitesse) elif direction == 'NE': Controls.northEastTranslation(vitesse) elif direction =='NW': Controls.northWestTranslation(vitesse) else: print('error') return 'error' def rotation(self, direction, vitesse): print(direction, vitesse) if direction == 'CW': print('vitesse') Controls.clockwiseRotation(vitesse) elif direction == 'ACW': print(vitesse) Controls.antiClockwiseRotation(vitesse) else: print('error') return 'error' def turbine_aspirer(self): Controls.set_raw_esc('turbine', 230) def turbine_stop(self): Controls.set_raw_esc('turbine', 0) def turbine_souffler(self): Controls.set_raw_esc('turbine', 251) def tuyau(self, axe, vitesse): #axe : vertical / horizontal pass def stop(self): Controls.stop() def easy(self, mode, direction, vitesse): if mode=='R': self.rotation(direction, vitesse) elif mode=='T': self.translation(direction, vitesse) else: print('error') return 'error' def easyjson(self, jsondata): # Easy but from JSON datas self.easy(jsondata["mode"], jsondata["direction"], jsondata["vitesse"])