Created
November 7, 2020 07:44
-
-
Save refeed/3d67e91204b9c5f97db60e36dab88d2c to your computer and use it in GitHub Desktop.
PlaneState Gamaforce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PlaneState: | |
def __init__(self, pitch=0.0, roll=0.0, yaw=0.0): | |
self.pitch = pitch | |
self.roll = roll | |
self.yaw = yaw | |
@property | |
def pitch(self): | |
return self.__pitch | |
@pitch.setter | |
def pitch(self, value): | |
if type(value) not in {float, int}: | |
raise TypeError('pitch harus bertipe float atau integer') | |
self.__pitch = float(value % 360) | |
@property | |
def roll(self): | |
return self.__roll | |
@roll.setter | |
def roll(self, value): | |
if type(value) not in {float, int}: | |
raise TypeError('roll harus bertipe float atau integer') | |
self.__roll = float(value % 360) | |
@property | |
def yaw(self): | |
return self.__yaw | |
@yaw.setter | |
def yaw(self, value): | |
if type(value) not in {float, int}: | |
raise TypeError('yaw harus bertipe float atau integer') | |
self.__yaw = float(value % 360) | |
def stabilize(self): | |
self.pitch = self.roll = self.yaw = 0.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment