11"""
22Position and orientation of drone.
33"""
4+
45import math
56
67
7- # Basically a struct
8- # pylint: disable=too-few-public-methods
98class DronePosition :
109 """
1110 WGS 84 following ISO 6709 (latitude before longitude).
1211 """
12+
1313 __create_key = object ()
1414
1515 @classmethod
16- def create (cls ,
17- latitude : "float | None" ,
18- longitude : "float | None" ,
19- altitude : "float | None" ) -> "tuple[bool, DronePosition | None]" :
16+ def create (
17+ cls , latitude : "float | None" , longitude : "float | None" , altitude : "float | None"
18+ ) -> "tuple[bool, DronePosition | None]" :
2019 """
2120 latitude, longitude in decimal degrees.
2221 altitude in metres.
@@ -35,11 +34,9 @@ def create(cls,
3534
3635 return True , DronePosition (cls .__create_key , latitude , longitude , altitude )
3736
38- def __init__ (self ,
39- class_private_create_key ,
40- latitude : float ,
41- longitude : float ,
42- altitude : float ):
37+ def __init__ (
38+ self , class_private_create_key : object , latitude : float , longitude : float , altitude : float
39+ ) -> None :
4340 """
4441 Private constructor, use create() method.
4542 """
@@ -49,25 +46,21 @@ def __init__(self,
4946 self .longitude = longitude
5047 self .altitude = altitude
5148
52- # pylint: enable=too-few-public-methods
53-
5449
55- # Basically a struct
56- # pylint: disable=too-few-public-methods
5750class DroneOrientation :
5851 """
5952 Yaw, pitch, roll following NED system (x forward, y right, z down).
6053 Specifically, intrinsic (Tait-Bryan) rotations in the zyx/3-2-1 order.
6154 """
55+
6256 __create_key = object ()
6357
6458 @classmethod
6559 # Required for checks
6660 # pylint: disable-next=too-many-return-statements
67- def create (cls ,
68- yaw : "float | None" ,
69- pitch : "float | None" ,
70- roll : "float | None" ) -> "tuple[bool, DroneOrientation | None]" :
61+ def create (
62+ cls , yaw : "float | None" , pitch : "float | None" , roll : "float | None"
63+ ) -> "tuple[bool, DroneOrientation | None]" :
7164 """
7265 yaw, pitch, roll in radians.
7366 """
@@ -91,7 +84,9 @@ def create(cls,
9184
9285 return True , DroneOrientation (cls .__create_key , yaw , pitch , roll )
9386
94- def __init__ (self , class_private_create_key , yaw : float , pitch : float , roll : float ):
87+ def __init__ (
88+ self , class_private_create_key : object , yaw : float , pitch : float , roll : float
89+ ) -> None :
9590 """
9691 Private constructor, use create() method.
9792 """
@@ -101,21 +96,18 @@ def __init__(self, class_private_create_key, yaw: float, pitch: float, roll: flo
10196 self .pitch = pitch
10297 self .roll = roll
10398
104- # pylint: enable=too-few-public-methods
105-
10699
107- # Basically a struct
108- # pylint: disable=too-few-public-methods
109100class DroneOdometry :
110101 """
111102 Wrapper for DronePosition and DroneOrientation.
112103 """
104+
113105 __create_key = object ()
114106
115107 @classmethod
116- def create (cls ,
117- position : DronePosition ,
118- orientation : DroneOrientation ) -> "tuple[bool, DroneOdometry | None]" :
108+ def create (
109+ cls , position : DronePosition , orientation : DroneOrientation
110+ ) -> "tuple[bool, DroneOdometry | None]" :
119111 """
120112 Position and orientation in one class.
121113 """
@@ -127,10 +119,12 @@ def create(cls,
127119
128120 return True , DroneOdometry (cls .__create_key , position , orientation )
129121
130- def __init__ (self ,
131- class_private_create_key ,
132- position : DronePosition ,
133- orientation : DroneOrientation ):
122+ def __init__ (
123+ self ,
124+ class_private_create_key : object ,
125+ position : DronePosition ,
126+ orientation : DroneOrientation ,
127+ ) -> None :
134128 """
135129 Private constructor, use create() method.
136130 """
0 commit comments