def exec(self, system): super().exec(system) trgt = system.get_object_by_id(self.target_id) if trgt is None: raise InputValidationError("Target doesn't exist") if get_distance(trgt.position, self.object.position): raise InputValidationError("Target out of range") self.object.set_target() return Response(self, self.object.status_report)
def _parse_args(self): try: self.pitch, self.yaw = [ float(x) for x in self._raw_args.split(',') ] except ValueError: raise InputValidationError("Bad values given for pitch or yaw")
def _validate(self): super()._validate() if self.throttle < 0 or self.throttle > 1.2: raise InputValidationError("Bad Range")
def _parse_args(self): try: self.throttle = float(self._raw_args) except ValueError: raise InputValidationError("Bad value for throttle")
def _validate(self): super()._validate() if self.focus <= 0 or self.focus >= 90: raise InputValidationError("Bad Range for Focus")
def _parse_args(self): try: self.focus = float(self._raw_args) except ValueError: raise InputValidationError("Bad value for focus")
def _validate(self): super()._validate() if self.pitch < -90 or self.pitch > 90: raise InputValidationError("Bad Range for Pitch") if self.yaw < -90 or self.yaw > 90: raise InputValidationError("Bad Range for Yaw")
def _parse_args(self): try: self.toggle = bool(int(self._raw_args)) except ValueError: raise InputValidationError("Bad value for power toggle")