2023-03-25 09:33:33 +00:00
|
|
|
import RobotCompletCode
|
|
|
|
Controls = RobotCompletCode.MotorizedPlatform()
|
|
|
|
class Robot:
|
|
|
|
def init(self):
|
|
|
|
Controls.init()
|
2023-03-25 10:55:37 +00:00
|
|
|
def set_range(self, name:str, mini:int, maxi:int):
|
|
|
|
Controls.set_range(name,mini,maxi)
|
2023-03-25 09:33:33 +00:00
|
|
|
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):
|
|
|
|
if direction == 'CW':
|
|
|
|
Controls.clockwiseRotation(vitesse)
|
|
|
|
elif direction == 'ACW':
|
|
|
|
Controls.antiClockwiseRotation(vitesse)
|
|
|
|
else:
|
|
|
|
print('error')
|
|
|
|
return 'error'
|
2023-03-25 10:55:37 +00:00
|
|
|
def turbine(self, vitesse):
|
|
|
|
pass
|
|
|
|
def tuyau(self, axe, vitesse):
|
|
|
|
#axe : vertical / horizontal
|
|
|
|
pass
|
2023-03-25 09:33:33 +00:00
|
|
|
def stop(self):
|
|
|
|
Controls.stop()
|
|
|
|
def easy(self, mode, direction, vitesse):
|
|
|
|
if mode=='R':
|
|
|
|
self.rotation(direction, vitesse)
|
|
|
|
elif mode=='T':
|
2023-03-25 10:55:37 +00:00
|
|
|
self.translation(direction, vitesse)
|
2023-03-25 09:33:33 +00:00
|
|
|
else:
|
|
|
|
print('error')
|
|
|
|
return 'error'
|
|
|
|
def easyjson(self, jsondata):
|
|
|
|
# Easy but from JSON datas
|
|
|
|
self.easy(jsondata["mode"], jsondata["direction"], jsondata["vitesse"])
|
|
|
|
|
|
|
|
|