예제 #1
0
 def __init__(self, socket_address):
     self.__is_shutting_down__ = False
     self.__manage_connection_task__ = None
     self.__socket_address__ = socket_address
     self.__manage_connection_task__ = recurring_task.RecurringTask(
         'ManageConnection',
         2,
         self.__manage_connection__,
         start_immediate=False)
     self.__pong_task__ = recurring_task.RecurringTask(
         'HeartbeatStratux', 2, self.pong_stratux)
예제 #2
0
    def __init__(self, logger=None, force_simulation=False):
        super(Aircraft, self).__init__(logger)

        self.ahrs_source = AhrsStratux(logger)

        recurring_task.RecurringTask('UpdateStratuxAhrs',
                                     1.0 / configuration.TARGET_AHRS_FRAMERATE,
                                     self.__update_orientation__)

        recurring_task.RecurringTask('UpdateAvionics',
                                     1.0 / configuration.TARGET_AHRS_FRAMERATE,
                                     self.__update_avionics_orientation__)
예제 #3
0
 def __init__(
     self,
     rest_address
 ):
     self.__traffic_session__ = requests.Session()
     self.rest_address = rest_address
     self.__update_traffic_task__ = recurring_task.RecurringTask(
         'UpdateTraffic',
         0.1,
         self.update_reliable_traffic)
     self.__update_service_health_task__ = recurring_task.RecurringTask(
         'UpdateTrafficManagerHealth',
         0.5,
         self.get_traffic_manager_service_status)
     AdsbTrafficClient.INSTANCE = self
예제 #4
0
    def run_in_background(self):
        """
        Runs the WS traffic connector.
        """

        self.__update_task__ = recurring_task.RecurringTask(
            'TrafficUpdate', 0.1, self.run_forever, start_immediate=False)
예제 #5
0
 def __init__(self, socket_address, logger=None):
     self.__is_shutting_down__ = False
     self.__manage_connection_task__ = None
     self.__socket_address__ = socket_address
     self.__manage_connection_task__ = recurring_task.RecurringTask(
         'ManageConnection',
         2,
         self.__manage_connection__,
         start_immediate=False)
     self.__pong_task__ = recurring_task.RecurringTask(
         'HeartbeatStratux', 2, self.pong_stratux)
     self.CONNECT_ATTEMPTS = 0
     self.SHUTDOWNS = 0
     self.SILENT_TIMEOUTS = 0
     self.__last_action_time__ = datetime.datetime.utcnow()
     self.__logger__ = logger
예제 #6
0
    def __init__(self, default_config_file, user_config_file):
        self.degrees_of_pitch = Configuration.DEFAULT_DEGREES_OF_PITCH
        self.pitch_degrees_display_scaler = Configuration.DEFAULT_PITCH_DEGREES_DISPLAY_SCALER
        self.__configuration__ = self.__load_configuration__(
            default_config_file, user_config_file)
        self.max_minutes_before_removal = self.__get_config_value__(
            Configuration.MAX_MINUTES_BEFORE_REMOVING_TRAFFIC_REPORT_KEY, MAX_MINUTES_BEFORE_REMOVING_TRAFFIC_REPORT)
        self.log_filename = "stratux_hud.log"
        self.flip_horizontal = False
        self.flip_vertical = False
        self.declination = 0.0
        self.aithre_enabled = False
        self.__stratux_session__ = requests.Session()

        self.stratux_status = StratuxStatus(
            self.stratux_address(), self.__stratux_session__, None)
        self.capabilities = StratuxCapabilities(
            self.stratux_address(), self.__stratux_session__, None)
        recurring_task.RecurringTask(
            'UpdateCapabilities', 15, self.__update_capabilities__)

        self.set_from_json(self.__configuration__)

        # Example config
        # "stratux_address": "192.168.10.1",
        #   "distance_units": "statute",
        #   "traffic_report_removal_minutes": 1,
        #   "flip_horizontal": false,
        #   "flip_vertical": false,
        #   "ownship": "N701GV",
        #   "data_source": "stratux",
        #   "declination": 0.0

        try:
            self.flip_horizontal = \
                self.__configuration__[Configuration.FLIP_HORIZONTAL_KEY]
        except:
            pass

        try:
            self.flip_vertical = \
                self.__configuration__[Configuration.FLIP_VERTICAL_KEY]
        except:
            pass

        try:
            self.declination = \
                float(self.__configuration__[Configuration.DECLINATION_KEY])
        except:
            pass

        try:
            self.aithre_enabled = \
                bool(self.__configuration__[Configuration.AITHRE_KEY])
        except:
            pass
예제 #7
0
 def __init__(
     self
 ):
     # Traffic held by tail number
     self.traffic = {}
     self.__last_report_time__ = None
     self.__lock__ = threading.Lock()
     self.__prune_task__ = recurring_task.RecurringTask(
         'PruneTraffic',
         10,
         self.prune_traffic_reports)
예제 #8
0
    def __init__(self, force_simulation=False):
        self.ahrs_source = None

        if force_simulation or configuration.CONFIGURATION.data_source(
        ) == configuration.DataSourceNames.SIMULATION:
            self.ahrs_source = AhrsSimulation()
        elif configuration.CONFIGURATION.data_source(
        ) == configuration.DataSourceNames.STRATUX:
            self.ahrs_source = AhrsStratux()

        recurring_task.RecurringTask('UpdateAhrs',
                                     1.0 / (configuration.MAX_FRAMERATE * 2.0),
                                     self.__update_orientation__)
예제 #9
0
    def __init__(self, logger=None, force_simulation=False):
        super(Aircraft, self).__init__(logger)

        self.ahrs_source = None

        if force_simulation or configuration.CONFIGURATION.data_source() == configuration.DataSourceNames.SIMULATION:
            self.ahrs_source = AhrsSimulation()
        elif configuration.CONFIGURATION.data_source() == configuration.DataSourceNames.STRATUX:
            self.ahrs_source = AhrsStratux(logger)

        recurring_task.RecurringTask('UpdateAhrs',
                                     1.0 / configuration.TARGET_AHRS_FRAMERATE,
                                     self.__update_orientation__)
예제 #10
0
    def __init__(self):
        self.__min_update_microseconds__ = int(
            1000000.0 / (configuration.MAX_FRAMERATE / 10.0))
        self.__timeout__ = 1.0 / (configuration.MAX_FRAMERATE / 8.0)
        self.__stratux_session__ = requests.Session()

        self.ahrs_data = AhrsData()
        self.data_source_available = False
        self.capabilities = StratuxCapabilities(
            configuration.CONFIGURATION.stratux_address(),
            self.__stratux_session__)
        recurring_task.RecurringTask('UpdateCapabilities', 15,
                                     self.__update_capabilities__)

        self.__lock__ = threading.Lock()
        self.__last_update__ = datetime.datetime.utcnow()
예제 #11
0
 def __init__(self, rest_address):
     self.__traffic_session__ = requests.Session()
     self.rest_address = rest_address
     self.__update_traffic_task__ = recurring_task.RecurringTask(
         'UpdateTraffic', 0.1, self.update_reliable_traffic)
     AdsbTrafficClient.INSTANCE = self