def __init__(self): # # Check for correct input # if isinstance(vehicle, Vehicle) is False: # raise TypeError('Expected object of type Vehicle, got '+type(vehicle).__name__) # Calling super class constructor StoppableThread.__init__(self) # These are the distances the drone passed in a certain direction. # They are used to know if I need to try to pass the obstacle from another direction. self.__right_distance = 0.0 self.__left_distance = 0.0 self.__up_distance = 0.0 # Always keep track of my last move in order to know better what to do in certain situations. self.__last_move = None # In case the drone need to pass an obstacle from above - keeping 2 flags. One for indicating its in the # process of climbing, and another one to indicate it finished climbing and should now keep its altitude # until passing the obstacle. self.__keep_altitude = False self.__climbing = False # I want to maintain the drone's altitude for a short period of time before descending back to the # original constant altitude, so for that I keep tracking of the time since it ascended. self.__start_time_measure = 0.0 # In case of emergency, keeping a flag to order the drone to land. self.__safety_protocol = False # Other classes within the software for giving flight orders, get sensors data and # calculate distances by geographic positioning system data. # the __flight_commands & __location objects should get as a parameter the vehicle object self.__flight_commands = FlightCommands() # FlightCommands(vehicle) self.__sensors = Sensors() self.__flight_data = FlightData() # FlightData(vehicle) # Get the drone's location and height for further calculations. self.__last_latitude = self.__flight_data.get_current_latitude() self.__last_longitude = self.__flight_data.get_current_longitude() self.__last_height = self.__flight_data.get_current_height() # Counter and flag for being aware of a sequence of illegal sensor inputs in order to be aware of a # malfunction in the system self.__illegal_input_counter = 0 self.__last_input_legitimacy = True self.__num_of_lines = int(self.__get_number_of_line_in_file()) # Delete when moving to a full functioning system. # Initializing the sensors if self.__sensors.connect() == -1: raise ConnectionError('Cannot connect to sensors') print("Connected Successfuly to Sensors!") # Flag that indicates if the system is activated in order to give the user the knowledge if it should override # other flight commands given to the drone. The flag is 'True' only for left/right/up maneuvers and False # for all other cases including fixing the drone's altitude, since the altitude is fixed for 10 meters and # any other running software within the drone shouldn't change its height. self.__is_active = False
def __init__(self, queues, compute_environments, jobs): Thread.__init__(self) StoppableThread.__init__(self, setted=False) self.__queues = queues self.__compute_environments = compute_environments self.__jobs = jobs self.__pending_jobs = {}
def __init__(self,file_worker,sec=10): StoppableThread.__init__(self) Informant.__init__(self,"BEAT") if file_worker is not None: self.file_worker = file_worker else: raise Exception("File Worker is None") self.__sleep_seconds = sec
def __init__(self, **kwargs): Thread.__init__(self) StoppableThread.__init__(self, setted=False) SchemaConstructor.__init__(self, schema=CONFIG_CREATE_COMPUTE_ENVIRONMENT, default_values=self.DEFAULT_VALUES, defined_values=kwargs) ARNObject.__init__(self, name=self.computeEnvironmentName, resource="compute-environment/" + self.computeEnvironmentName) self.__associated_queue = queue.PriorityQueue( maxsize=4) # Compute maxsize as parameter of CE power self.__jobs_current = [] self.__logger = logging.getLogger( f"[CE] {self.computeEnvironmentName} {self.getName()}") self.__logger.info("Compute environment created")
def __init__(self): # # Check for correct input # if isinstance(vehicle, Vehicle) is False: # raise TypeError('Expected object of type Vehicle, got '+type(vehicle).__name__) # Calling super class constructor StoppableThread.__init__(self) # These are the distances the drone passed in a certain direction. # They are used to know if I need to try to pass the obstacle from another direction. self.__right_distance = 0.0 self.__left_distance = 0.0 self.__up_distance = 0.0 # Always keep track of my last move in order to know better what to do in certain situations. self.__last_move = None # In case the drone need to pass an obstacle from above - keeping 2 flags. One for indicating its in the # process of climbing, and another one to indicate it finished climbing and should now keep its altitude # until passing the obstacle. self.__keep_altitude = False self.__climbing = False # I want to maintain the drone's altitude for a short period of time before descending back to the # original constant altitude, so for that I keep tracking of the time since it ascended. self.__start_time_measure = 0.0 # In case of emergency, keeping a flag to order the drone to land. self.__safety_protocol = False # Other classes within the software for giving flight orders, get sensors data and # calculate distances by geographic positioning system data. # the __flight_commands & __location objects should get as a parameter the vehicle object self.__flight_commands = FlightCommands() # FlightCommands(vehicle) self.__sensors = Sensors() self.__flight_data = FlightData() # FlightData(vehicle) # Get the drone's location and height for further calculations. self.__last_latitude = self.__flight_data.get_current_latitude() self.__last_longitude = self.__flight_data.get_current_longitude() self.__last_height = self.__flight_data.get_current_height() # Counter and flag for being aware of a sequence of illegal sensor inputs in order to be aware of a # malfunction in the system self.__illegal_input_counter = 0 self.__last_input_legitimacy = True self.__num_of_lines = int(self.__get_number_of_line_in_file( )) # Delete when moving to a full functioning system. # Initializing the sensors if self.__sensors.connect() == -1: raise ConnectionError('Cannot connect to sensors') print("Connected Successfuly to Sensors!") # Flag that indicates if the system is activated in order to give the user the knowledge if it should override # other flight commands given to the drone. The flag is 'True' only for left/right/up maneuvers and False # for all other cases including fixing the drone's altitude, since the altitude is fixed for 10 meters and # any other running software within the drone shouldn't change its height. self.__is_active = False