litchi_wp.action
Module for litchi waypoint actions
1""" 2Module for litchi waypoint actions 3""" 4# pylint: disable=import-error 5from litchi_wp.enums import ActionType 6 7 8class Action: 9 """ 10 Class respresenting a litchi waypoint action 11 12 Attributes: 13 type (ActionType): The type of the action 14 param (int | float): The parameter of the action. Depends on the actiontype 15 16 """ 17 18 def __init__( 19 self, 20 actiontype: ActionType = ActionType.NO_ACTION, 21 param: int | float = 0 22 ): 23 """ 24 Constructor 25 26 Args: 27 actiontype (ActionType): The type of the action 28 param (float): The parameter of the action. Depends on the actiontype 29 30 - Stay For (time in milliseconds), 31 - Rotate Aircraft (angle in degrees), 32 - Tilt Camera (angle in degrees) 33 - Take Photo (set to 0) 34 - Start Recording (set to 0) 35 - Stop Recording (set to 0) 36 37 Raises: 38 ValueError: If actiontype is no valid ActionType or param cannot be float 39 40 """ 41 self.type: ActionType = ActionType(actiontype) 42 self.param = float(param) 43 44 def set_type(self, actiontype: ActionType): 45 """ 46 Setter for the type of the action 47 48 Args: 49 actiontype (Actiontype): The type of the action 50 51 Raises: 52 ValueError: If actiontype is no valid ActionType 53 54 """ 55 self.type = ActionType(actiontype) 56 57 def set_param(self, param: int | float): 58 """ 59 Setter for the action parameter 60 61 Args: 62 param (int | float): The parameter of the action. Depends on the actiontype 63 64 - Stay For (time in milliseconds), 65 - Rotate Aircraft (angle in degrees), 66 - Tilt Camera (angle in degrees) 67 68 Raises: 69 ValueError: If param cannot be float 70 71 """ 72 self.param = float(param) 73 74 def delete(self): 75 """ 76 Clear action 77 """ 78 self.type = ActionType.NO_ACTION 79 self.param = 0 80 81 def set_stay_for(self, msec: int): 82 """ 83 Setter for 'Stay For' action 84 85 Args: 86 msec (int): Time to stay in milliseconds 87 88 Raises: 89 ValueError: If msec cannot be int or msec < 0 or msec > 32000 90 91 """ 92 if int(msec) < 0 or int(msec) > 32000: 93 raise ValueError('allowed range is 0 to 32000') 94 self.type = ActionType.STAY_FOR 95 self.param = int(msec) 96 97 def set_take_photo(self): 98 """ 99 Setter for 'Take Photo' action 100 """ 101 self.type = ActionType.TAKE_PHOTO 102 self.param = 0 103 104 def set_start_rec(self): 105 """ 106 Setter for 'Start Recording' action 107 """ 108 self.type = ActionType.START_RECORDING 109 self.param = 0 110 111 def set_stop_rec(self): 112 """ 113 Setter for 'Stop Recording' action 114 """ 115 self.type = ActionType.STOP_RECORDING 116 self.param = 0 117 118 def set_rotate(self, deg: int | float): 119 """ 120 Setter for 'Rotate Aircraft' action 121 122 Args: 123 deg (int | float): Rotation in degrees 124 125 Raises: 126 ValueError: If deg cannot be float or deg < 0 or deg > 359 127 128 """ 129 if float(deg) < 0 or float(deg) > 359: 130 raise ValueError('allowed range is 0 to 359') 131 self.type = ActionType.ROTATE_AIRCRAFT 132 self.param = float(deg) 133 134 def set_tilt_cam(self, deg: int | float): 135 """ 136 Setter for 'Tilt Camera' action 137 138 Args: 139 deg (int | float): Tiltangle in degrees 140 141 Raises: 142 ValueError: If deg cannot be float or deg < -90 or deg > 30 143 144 """ 145 if float(deg) < -90 or float(deg) > 30: 146 raise ValueError('allowed range is -90 to 30') 147 self.type = ActionType.TILT_CAMERA 148 self.param = float(deg)
class
Action:
9class Action: 10 """ 11 Class respresenting a litchi waypoint action 12 13 Attributes: 14 type (ActionType): The type of the action 15 param (int | float): The parameter of the action. Depends on the actiontype 16 17 """ 18 19 def __init__( 20 self, 21 actiontype: ActionType = ActionType.NO_ACTION, 22 param: int | float = 0 23 ): 24 """ 25 Constructor 26 27 Args: 28 actiontype (ActionType): The type of the action 29 param (float): The parameter of the action. Depends on the actiontype 30 31 - Stay For (time in milliseconds), 32 - Rotate Aircraft (angle in degrees), 33 - Tilt Camera (angle in degrees) 34 - Take Photo (set to 0) 35 - Start Recording (set to 0) 36 - Stop Recording (set to 0) 37 38 Raises: 39 ValueError: If actiontype is no valid ActionType or param cannot be float 40 41 """ 42 self.type: ActionType = ActionType(actiontype) 43 self.param = float(param) 44 45 def set_type(self, actiontype: ActionType): 46 """ 47 Setter for the type of the action 48 49 Args: 50 actiontype (Actiontype): The type of the action 51 52 Raises: 53 ValueError: If actiontype is no valid ActionType 54 55 """ 56 self.type = ActionType(actiontype) 57 58 def set_param(self, param: int | float): 59 """ 60 Setter for the action parameter 61 62 Args: 63 param (int | float): The parameter of the action. Depends on the actiontype 64 65 - Stay For (time in milliseconds), 66 - Rotate Aircraft (angle in degrees), 67 - Tilt Camera (angle in degrees) 68 69 Raises: 70 ValueError: If param cannot be float 71 72 """ 73 self.param = float(param) 74 75 def delete(self): 76 """ 77 Clear action 78 """ 79 self.type = ActionType.NO_ACTION 80 self.param = 0 81 82 def set_stay_for(self, msec: int): 83 """ 84 Setter for 'Stay For' action 85 86 Args: 87 msec (int): Time to stay in milliseconds 88 89 Raises: 90 ValueError: If msec cannot be int or msec < 0 or msec > 32000 91 92 """ 93 if int(msec) < 0 or int(msec) > 32000: 94 raise ValueError('allowed range is 0 to 32000') 95 self.type = ActionType.STAY_FOR 96 self.param = int(msec) 97 98 def set_take_photo(self): 99 """ 100 Setter for 'Take Photo' action 101 """ 102 self.type = ActionType.TAKE_PHOTO 103 self.param = 0 104 105 def set_start_rec(self): 106 """ 107 Setter for 'Start Recording' action 108 """ 109 self.type = ActionType.START_RECORDING 110 self.param = 0 111 112 def set_stop_rec(self): 113 """ 114 Setter for 'Stop Recording' action 115 """ 116 self.type = ActionType.STOP_RECORDING 117 self.param = 0 118 119 def set_rotate(self, deg: int | float): 120 """ 121 Setter for 'Rotate Aircraft' action 122 123 Args: 124 deg (int | float): Rotation in degrees 125 126 Raises: 127 ValueError: If deg cannot be float or deg < 0 or deg > 359 128 129 """ 130 if float(deg) < 0 or float(deg) > 359: 131 raise ValueError('allowed range is 0 to 359') 132 self.type = ActionType.ROTATE_AIRCRAFT 133 self.param = float(deg) 134 135 def set_tilt_cam(self, deg: int | float): 136 """ 137 Setter for 'Tilt Camera' action 138 139 Args: 140 deg (int | float): Tiltangle in degrees 141 142 Raises: 143 ValueError: If deg cannot be float or deg < -90 or deg > 30 144 145 """ 146 if float(deg) < -90 or float(deg) > 30: 147 raise ValueError('allowed range is -90 to 30') 148 self.type = ActionType.TILT_CAMERA 149 self.param = float(deg)
Class respresenting a litchi waypoint action
Attributes:
- type (ActionType): The type of the action
- param (int | float): The parameter of the action. Depends on the actiontype
Action( actiontype: litchi_wp.enums.ActionType = <ActionType.NO_ACTION: -1>, param: Union[int, float] = 0)
19 def __init__( 20 self, 21 actiontype: ActionType = ActionType.NO_ACTION, 22 param: int | float = 0 23 ): 24 """ 25 Constructor 26 27 Args: 28 actiontype (ActionType): The type of the action 29 param (float): The parameter of the action. Depends on the actiontype 30 31 - Stay For (time in milliseconds), 32 - Rotate Aircraft (angle in degrees), 33 - Tilt Camera (angle in degrees) 34 - Take Photo (set to 0) 35 - Start Recording (set to 0) 36 - Stop Recording (set to 0) 37 38 Raises: 39 ValueError: If actiontype is no valid ActionType or param cannot be float 40 41 """ 42 self.type: ActionType = ActionType(actiontype) 43 self.param = float(param)
Constructor
Arguments:
- actiontype (ActionType): The type of the action
param (float): The parameter of the action. Depends on the actiontype
- Stay For (time in milliseconds),
- Rotate Aircraft (angle in degrees),
- Tilt Camera (angle in degrees)
- Take Photo (set to 0)
- Start Recording (set to 0)
- Stop Recording (set to 0)
Raises:
- ValueError: If actiontype is no valid ActionType or param cannot be float
def
set_type(self, actiontype: litchi_wp.enums.ActionType):
45 def set_type(self, actiontype: ActionType): 46 """ 47 Setter for the type of the action 48 49 Args: 50 actiontype (Actiontype): The type of the action 51 52 Raises: 53 ValueError: If actiontype is no valid ActionType 54 55 """ 56 self.type = ActionType(actiontype)
Setter for the type of the action
Arguments:
- actiontype (Actiontype): The type of the action
Raises:
- ValueError: If actiontype is no valid ActionType
def
set_param(self, param: Union[int, float]):
58 def set_param(self, param: int | float): 59 """ 60 Setter for the action parameter 61 62 Args: 63 param (int | float): The parameter of the action. Depends on the actiontype 64 65 - Stay For (time in milliseconds), 66 - Rotate Aircraft (angle in degrees), 67 - Tilt Camera (angle in degrees) 68 69 Raises: 70 ValueError: If param cannot be float 71 72 """ 73 self.param = float(param)
Setter for the action parameter
Arguments:
param (int | float): The parameter of the action. Depends on the actiontype
- Stay For (time in milliseconds),
- Rotate Aircraft (angle in degrees),
- Tilt Camera (angle in degrees)
Raises:
- ValueError: If param cannot be float
def
delete(self) -> None:
75 def delete(self): 76 """ 77 Clear action 78 """ 79 self.type = ActionType.NO_ACTION 80 self.param = 0
Clear action
def
set_stay_for(self, msec: int):
82 def set_stay_for(self, msec: int): 83 """ 84 Setter for 'Stay For' action 85 86 Args: 87 msec (int): Time to stay in milliseconds 88 89 Raises: 90 ValueError: If msec cannot be int or msec < 0 or msec > 32000 91 92 """ 93 if int(msec) < 0 or int(msec) > 32000: 94 raise ValueError('allowed range is 0 to 32000') 95 self.type = ActionType.STAY_FOR 96 self.param = int(msec)
Setter for 'Stay For' action
Arguments:
- msec (int): Time to stay in milliseconds
Raises:
- ValueError: If msec cannot be int or msec < 0 or msec > 32000
def
set_take_photo(self) -> None:
98 def set_take_photo(self): 99 """ 100 Setter for 'Take Photo' action 101 """ 102 self.type = ActionType.TAKE_PHOTO 103 self.param = 0
Setter for 'Take Photo' action
def
set_start_rec(self) -> None:
105 def set_start_rec(self): 106 """ 107 Setter for 'Start Recording' action 108 """ 109 self.type = ActionType.START_RECORDING 110 self.param = 0
Setter for 'Start Recording' action
def
set_stop_rec(self) -> None:
112 def set_stop_rec(self): 113 """ 114 Setter for 'Stop Recording' action 115 """ 116 self.type = ActionType.STOP_RECORDING 117 self.param = 0
Setter for 'Stop Recording' action
def
set_rotate(self, deg: Union[int, float]):
119 def set_rotate(self, deg: int | float): 120 """ 121 Setter for 'Rotate Aircraft' action 122 123 Args: 124 deg (int | float): Rotation in degrees 125 126 Raises: 127 ValueError: If deg cannot be float or deg < 0 or deg > 359 128 129 """ 130 if float(deg) < 0 or float(deg) > 359: 131 raise ValueError('allowed range is 0 to 359') 132 self.type = ActionType.ROTATE_AIRCRAFT 133 self.param = float(deg)
Setter for 'Rotate Aircraft' action
Arguments:
- deg (int | float): Rotation in degrees
Raises:
- ValueError: If deg cannot be float or deg < 0 or deg > 359
def
set_tilt_cam(self, deg: Union[int, float]):
135 def set_tilt_cam(self, deg: int | float): 136 """ 137 Setter for 'Tilt Camera' action 138 139 Args: 140 deg (int | float): Tiltangle in degrees 141 142 Raises: 143 ValueError: If deg cannot be float or deg < -90 or deg > 30 144 145 """ 146 if float(deg) < -90 or float(deg) > 30: 147 raise ValueError('allowed range is -90 to 30') 148 self.type = ActionType.TILT_CAMERA 149 self.param = float(deg)
Setter for 'Tilt Camera' action
Arguments:
- deg (int | float): Tiltangle in degrees
Raises:
- ValueError: If deg cannot be float or deg < -90 or deg > 30