Example #1
0
    def update_on_heartbeat(self, sbp_msg, **metadata):
        self.heartbeat_count += 1

        # --- determining which mode, llh or baseline, to show in the status bar ---
        llh_display_mode = "None"
        llh_num_sats = 0
        llh_is_differential = False

        baseline_display_mode = "None"
        baseline_num_sats = 0
        baseline_is_differential = False

        # determine the latest llh solution mode
        if self.solution_view:
            llh_solution_mode = self.solution_view.last_pos_mode
            llh_display_mode = mode_dict.get(llh_solution_mode, EMPTY_STR)
            if llh_solution_mode > 0 and self.solution_view.last_soln:
                llh_num_sats = self.solution_view.last_soln.n_sats
            llh_is_differential = (llh_solution_mode in DIFFERENTIAL_MODES)
            if getattr(self.solution_view, 'ins_used',
                       False) and llh_solution_mode != DR_MODE:
                llh_display_mode += "+INS"

        # determine the latest baseline solution mode
        if self.baseline_view:
            baseline_solution_mode = self.baseline_view.last_mode
            baseline_display_mode = mode_dict.get(baseline_solution_mode,
                                                  EMPTY_STR)
            if baseline_solution_mode > 0 and self.baseline_view.last_soln:
                baseline_num_sats = self.baseline_view.last_soln.n_sats
            baseline_is_differential = (baseline_solution_mode
                                        in DIFFERENTIAL_MODES)

        # select the solution mode displayed in the status bar:
        # * baseline if it's a differential solution but llh isn't
        # * otherwise llh (also if there is no solution, in which both are "None")
        if baseline_is_differential and not (llh_is_differential):
            self.mode = baseline_display_mode
            self.num_sats = baseline_num_sats
        else:
            self.mode = llh_display_mode
            self.num_sats = llh_num_sats

        # --- end of status bar mode determination section ---

        if self.settings_view:  # for auto populating surveyed fields
            self.settings_view.lat = self.solution_view.latitude
            self.settings_view.lon = self.solution_view.longitude
            self.settings_view.alt = self.solution_view.altitude
        if self.baseline_view:
            if self.baseline_view.age_corrections is not None:
                self.age_of_corrections = "{0} s".format(
                    self.baseline_view.age_corrections)
            else:
                self.age_of_corrections = EMPTY_STR
Example #2
0
    def update_on_heartbeat(self, sbp_msg, **metadata):
        self.heartbeat_count += 1

        # --- determining which mode, llh or baseline, to show in the status bar ---
        llh_display_mode = "None"
        llh_num_sats = 0
        llh_is_differential = False

        baseline_display_mode = "None"
        baseline_num_sats = 0
        baseline_is_differential = False

        # determine the latest llh solution mode
        if self.solution_view:
            llh_solution_mode = self.solution_view.last_pos_mode
            llh_display_mode = mode_dict.get(llh_solution_mode, EMPTY_STR)
            if llh_solution_mode > 0 and self.solution_view.last_soln:
                llh_num_sats = self.solution_view.last_soln.n_sats
            llh_is_differential = (llh_solution_mode in DIFFERENTIAL_MODES)
            if getattr(self.solution_view, 'ins_used', False) and llh_solution_mode != DR_MODE:
                llh_display_mode += "+INS"

        # determine the latest baseline solution mode
        if self.baseline_view:
            baseline_solution_mode = self.baseline_view.last_mode
            baseline_display_mode = mode_dict.get(baseline_solution_mode, EMPTY_STR)
            if baseline_solution_mode > 0 and self.baseline_view.last_soln:
                baseline_num_sats = self.baseline_view.last_soln.n_sats
            baseline_is_differential = (baseline_solution_mode in DIFFERENTIAL_MODES)

        # select the solution mode displayed in the status bar:
        # * baseline if it's a differential solution but llh isn't
        # * otherwise llh (also if there is no solution, in which both are "None")
        if baseline_is_differential and not(llh_is_differential):
            self.mode = baseline_display_mode
            self.num_sats = baseline_num_sats
        else:
            self.mode = llh_display_mode
            self.num_sats = llh_num_sats

        # --- end of status bar mode determination section ---

        if self.settings_view:  # for auto populating surveyed fields
            self.settings_view.lat = self.solution_view.latitude
            self.settings_view.lon = self.solution_view.longitude
            self.settings_view.alt = self.solution_view.altitude
        if self.baseline_view:
            if self.baseline_view.age_corrections is not None:
                self.age_of_corrections = "{0} s".format(
                    self.baseline_view.age_corrections)
            else:
                self.age_of_corrections = EMPTY_STR
Example #3
0
    def update_on_heartbeat(self, sbp_msg, **metadata):
        self.heartbeat_count += 1
        # First initialize the state to nothing, if we can't update, it will be none
        temp_mode = "None"
        temp_num_sats = 0
        view = None
        if self.baseline_view and self.solution_view:
            # If we have a recent baseline update, we use the baseline info
            if time.time() - self.baseline_view.last_btime_update < 10:
                view = self.baseline_view
            # Otherwise, if we have a recent SPP update, we use the SPP
            elif time.time() - self.solution_view.last_stime_update < 10:
                view = self.solution_view
            if view:
                if view.last_soln:
                    # if all is well we update state
                    temp_mode = mode_dict.get(get_mode(view.last_soln),
                                              EMPTY_STR)
                    temp_num_sats = view.last_soln.n_sats

        self.mode = temp_mode
        self.num_sats = temp_num_sats

        if self.settings_view:  # for auto populating surveyed fields
            self.settings_view.lat = self.solution_view.latitude
            self.settings_view.lon = self.solution_view.longitude
            self.settings_view.alt = self.solution_view.altitude
        if self.system_monitor_view:
            if self.system_monitor_view.msg_obs_window_latency_ms != -1:
                self.latency = "{0} ms".format(
                    self.system_monitor_view.msg_obs_window_latency_ms)
            else:
                self.latency = EMPTY_STR
Example #4
0
    def update_on_heartbeat(self, sbp_msg, **metadata):
        self.heartbeat_count += 1
        # First initialize the state to nothing, if we can't update, it will be none
        temp_mode = "None"
        temp_num_sats = 0
        view = None
        if self.baseline_view and self.solution_view:
            # If we have a recent baseline update, we use the baseline info
            if time.time() - self.baseline_view.last_btime_update < 10:
                view = self.baseline_view
            # Otherwise, if we have a recent SPP update, we use the SPP
            elif time.time() - self.solution_view.last_stime_update < 10:
                view = self.solution_view
            if view:
                if view.last_soln:
                    # if all is well we update state
                    temp_mode = mode_dict.get(
                        get_mode(view.last_soln), EMPTY_STR)
                    temp_num_sats = view.last_soln.n_sats
                if getattr(view, 'ins_used', False):
                    temp_mode += "+INS"

        self.mode = temp_mode
        self.num_sats = temp_num_sats

        if self.settings_view:  # for auto populating surveyed fields
            self.settings_view.lat = self.solution_view.latitude
            self.settings_view.lon = self.solution_view.longitude
            self.settings_view.alt = self.solution_view.altitude
        if self.baseline_view:
            if self.baseline_view.age_corrections is not None:
                self.age_of_corrections = "{0} s".format(
                    self.baseline_view.age_corrections)
            else:
                self.age_of_corrections = EMPTY_STR
Example #5
0
    def update_on_heartbeat(self, sbp_msg, **metadata):
        self.heartbeat_count += 1
        # First initialize the state to nothing, if we can't update, it will be none
        temp_mode = "None"
        temp_num_sats = 0
        view = None
        if self.baseline_view and self.solution_view:
            # If we have a recent baseline update, we use the baseline info
            if time.time() - self.baseline_view.last_btime_update < 10:
                view = self.baseline_view
            # Otherwise, if we have a recent SPP update, we use the SPP
            elif time.time() - self.solution_view.last_stime_update < 10:
                view = self.solution_view
            if view:
                if view.last_soln:
                    # if all is well we update state
                    temp_mode = mode_dict.get(
                        get_mode(view.last_soln), EMPTY_STR)
                    temp_num_sats = view.last_soln.n_sats

        self.mode = temp_mode
        self.num_sats = temp_num_sats

        if self.settings_view:  # for auto populating surveyed fields
            self.settings_view.lat = self.solution_view.latitude
            self.settings_view.lon = self.solution_view.longitude
            self.settings_view.alt = self.solution_view.altitude
        if self.system_monitor_view:
            if self.system_monitor_view.msg_obs_window_latency_ms != -1:
                self.latency = "{0} ms".format(
                    self.system_monitor_view.msg_obs_window_latency_ms)
            else:
                self.latency = EMPTY_STR
Example #6
0
    def update_on_heartbeat(self, sbp_msg, **metadata):
        self.heartbeat_count += 1

        # --- determining which mode, llh or baseline, to show in the status bar ---
        llh_display_mode = "None"
        llh_num_sats = 0
        llh_is_differential = False

        baseline_display_mode = "None"
        baseline_num_sats = 0
        baseline_is_differential = False

        # determine the latest llh solution mode
        if self.solution_view:
            llh_solution_mode = self.solution_view.last_pos_mode
            llh_display_mode = mode_dict.get(llh_solution_mode, EMPTY_STR)
            if llh_solution_mode > 0 and self.solution_view.last_soln:
                llh_num_sats = self.solution_view.last_soln.n_sats
            llh_is_differential = (llh_solution_mode in DIFFERENTIAL_MODES)
            if getattr(self.solution_view, 'ins_used', False) and llh_solution_mode != DR_MODE:
                llh_display_mode += "+INS"

        # determine the latest baseline solution mode
        if self.baseline_view and self.settings_view and self.settings_view.dgnss_enabled():
            baseline_solution_mode = self.baseline_view.last_mode
            baseline_display_mode = mode_dict.get(baseline_solution_mode, EMPTY_STR)
            if baseline_solution_mode > 0 and self.baseline_view.last_soln:
                baseline_num_sats = self.baseline_view.last_soln.n_sats
            baseline_is_differential = (baseline_solution_mode in DIFFERENTIAL_MODES)

        # determine the latest INS mode
        if self.solution_view and (monotonic() -
                                   self.solution_view.last_ins_status_receipt_time) < 1:
            ins_flags = self.solution_view.ins_status_flags
            ins_mode = ins_flags & 0x7
            ins_type = (ins_flags >> 29) & 0x7
            odo_status = (ins_flags >> 8) & 0x3
            ins_error = (ins_flags >> 4) & 0xF
            if ins_error != 0:
                ins_status_string = ins_error_dict.get(ins_error, "Unk Error")
            else:
                ins_status_string = ins_type_dict.get(ins_type, "unk") + "-"
                ins_status_string += ins_mode_dict.get(ins_mode, "unk")
                if odo_status == 1:
                    ins_status_string += "+Odo"
            self.ins_status_string = ins_status_string

        # select the solution mode displayed in the status bar:
        # * baseline if it's a differential solution but llh isn't
        # * otherwise llh (also if there is no solution, in which both are "None")
        if baseline_is_differential and not(llh_is_differential):
            self.mode = baseline_display_mode
            self.num_sats_str = "{}".format(baseline_num_sats)
        else:
            self.mode = llh_display_mode
            self.num_sats_str = "{}".format(llh_num_sats)

        # --- end of status bar mode determination section ---

        if self.settings_view:  # for auto populating surveyed fields
            self.settings_view.lat = self.solution_view.latitude
            self.settings_view.lon = self.solution_view.longitude
            self.settings_view.alt = self.solution_view.altitude
        if self.baseline_view:
            if self.baseline_view.age_corrections is not None:
                self.age_of_corrections = "{0} s".format(
                    self.baseline_view.age_corrections)
            else:
                self.age_of_corrections = EMPTY_STR