From b0b692bc65f67c410751d659a614566e2782c289 Mon Sep 17 00:00:00 2001 From: William Brannon Date: Wed, 5 Jun 2024 14:51:56 -0600 Subject: [PATCH] Only add source_id argument to read calls involving Pose/PoseAux messages --- .../fusion_engine_client/analysis/analyzer.py | 53 +++++++------------ .../analysis/data_loader.py | 2 + .../parsers/mixed_log_reader.py | 2 +- 3 files changed, 23 insertions(+), 34 deletions(-) diff --git a/python/fusion_engine_client/analysis/analyzer.py b/python/fusion_engine_client/analysis/analyzer.py index 7fc1d74d..ddb7e865 100755 --- a/python/fusion_engine_client/analysis/analyzer.py +++ b/python/fusion_engine_client/analysis/analyzer.py @@ -327,8 +327,7 @@ def _calc_stats(input): 2, 1) # Read system timestamps from event notifications, if present. - result = self.reader.read(message_types=[EventNotificationMessage], source_ids=self.source_ids, - **self.params) + result = self.reader.read(message_types=[EventNotificationMessage], **self.params) event_data = result[EventNotificationMessage.MESSAGE_TYPE] system_time_sec = None @@ -362,8 +361,7 @@ def plot_reset_timing(self): return # Find reset events. - result = self.reader.read(message_types=[EventNotificationMessage], source_ids=self.source_ids, - return_message_index=True, **self.params) + result = self.reader.read(message_types=[EventNotificationMessage], return_message_index=True, **self.params) event_data = result[EventNotificationMessage.MESSAGE_TYPE] reset_idx = event_data.event_type == EventType.RESET @@ -597,8 +595,7 @@ def plot_calibration(self): return # Read the pose data. - result = self.reader.read(message_types=[CalibrationStatus], source_ids=self.source_ids, - **self.params) + result = self.reader.read(message_types=[CalibrationStatus], **self.params) cal_data = result[CalibrationStatus.MESSAGE_TYPE] if len(cal_data.p1_time) == 0: @@ -861,7 +858,7 @@ def plot_relative_position(self): return # Read the pose data. - result = self.reader.read(message_types=[RelativeENUPositionMessage], source_ids=self.source_ids, **self.params) + result = self.reader.read(message_types=[RelativeENUPositionMessage], **self.params) relative_position_data = result[RelativeENUPositionMessage.MESSAGE_TYPE] if len(relative_position_data.p1_time) == 0: @@ -980,8 +977,7 @@ def _plot_data(name, idx, source_id, marker_style=None): def plot_gnss_skyplot(self, decimate=True): # Read the satellite data. - result = self.reader.read(message_types=[GNSSSatelliteMessage], source_ids=self.source_ids, - **self.params) + result = self.reader.read(message_types=[GNSSSatelliteMessage], **self.params) data = result[GNSSSatelliteMessage.MESSAGE_TYPE] if len(data.p1_time) == 0: @@ -1077,8 +1073,7 @@ def plot_gnss_skyplot(self, decimate=True): def plot_gnss_cn0(self): # The legacy GNSSSatelliteMessage contains data per satellite, not per signal. The plotted C/N0 values will # reflect the L1 signal, unless L1 is not being tracked. - result = self.reader.read(message_types=[GNSSSatelliteMessage], source_ids=self.source_ids, - **self.params) + result = self.reader.read(message_types=[GNSSSatelliteMessage], **self.params) data = result[GNSSSatelliteMessage.MESSAGE_TYPE] if len(data.p1_time) == 0: @@ -1140,8 +1135,7 @@ def plot_gnss_signal_status(self): figure_title = "GNSS Signal Status" # Read the satellite data. - result = self.reader.read(message_types=[GNSSSatelliteMessage], source_ids=self.source_ids, - **self.params) + result = self.reader.read(message_types=[GNSSSatelliteMessage], **self.params) data = result[GNSSSatelliteMessage.MESSAGE_TYPE] is_legacy_message = True @@ -1274,7 +1268,7 @@ def plot_dop(self): This includes geometric, position, horizontal, and vertical DOP. """ - result = self.reader.read(message_types=[GNSSInfoMessage], source_ids=self.source_ids, **self.params) + result = self.reader.read(message_types=[GNSSInfoMessage], **self.params) data = result[GNSSInfoMessage.MESSAGE_TYPE] if len(data.p1_time) == 0: @@ -1311,7 +1305,7 @@ def plot_gnss_corrections_status(self): """! @brief Plot GNSS corrections status (baseline distance, age, etc.). """ - result = self.reader.read(message_types=[GNSSInfoMessage], source_ids=self.source_ids, **self.params) + result = self.reader.read(message_types=[GNSSInfoMessage], **self.params) data = result[GNSSInfoMessage.MESSAGE_TYPE] if len(data.p1_time) == 0: @@ -1422,8 +1416,7 @@ def _plot_wheel_ticks_or_speeds(self, source, type): if self.long_log_detected and self.truncate_data: params = copy.deepcopy(self.params) params['max_messages'] = 2 - result = self.reader.read(message_types=any_measurement_type, remove_nan_times=False, - source_ids=self.source_ids, **params) + result = self.reader.read(message_types=any_measurement_type, remove_nan_times=False, **params) data = result[any_measurement_type.MESSAGE_TYPE] if len(data.measurement_time) == 2: dt_sec = data.measurement_time[1] - data.measurement_time[0] @@ -1436,7 +1429,7 @@ def _plot_wheel_ticks_or_speeds(self, source, type): # Read the data. result = self.reader.read(message_types=[measurement_type, raw_measurement_type], - remove_nan_times=False, source_ids=self.source_ids, **self.params) + remove_nan_times=False, **self.params) def _extract_data(measurement_type): if measurement_type is not None: @@ -1736,7 +1729,7 @@ def _plot_imu_data(self, message_cls, filename, figure_title): if self.truncate_data: params = copy.deepcopy(self.params) params['max_messages'] = 2 - result = self.reader.read(message_types=[message_cls], source_ids=self.source_ids, **params) + result = self.reader.read(message_types=[message_cls], **params) data = result[message_cls.MESSAGE_TYPE] if len(data.p1_time) == 2: dt_sec = data.p1_time[1] - data.p1_time[0] @@ -1748,7 +1741,7 @@ def _plot_imu_data(self, message_cls, filename, figure_title): return # Read the data. - result = self.reader.read(message_types=[message_cls], source_ids=self.source_ids, **self.params) + result = self.reader.read(message_types=[message_cls], **self.params) data = result[message_cls.MESSAGE_TYPE] if len(data.p1_time) == 0: @@ -1808,8 +1801,7 @@ def plot_heading_measurements(self): return # Read the heading measurement data. - result = self.reader.read(message_types=[RawHeadingOutput, HeadingOutput], source_ids=self.source_ids, - **self.params) + result = self.reader.read(message_types=[RawHeadingOutput, HeadingOutput], **self.params) raw_heading_data = result[RawHeadingOutput.MESSAGE_TYPE] heading_data = result[HeadingOutput.MESSAGE_TYPE] @@ -2056,8 +2048,7 @@ def plot_system_status_profiling(self): return # Read the data. - result = self.reader.read(message_types=[SystemStatusMessage], remove_nan_times=False, - source_ids=self.source_ids, **self.params) + result = self.reader.read(message_types=[SystemStatusMessage], remove_nan_times=False, **self.params) data = result[SystemStatusMessage.MESSAGE_TYPE] if len(data.p1_time) == 0: @@ -2092,8 +2083,7 @@ def plot_events(self): # Read the data. data = self.reader.read(message_types={MessageType.EVENT_NOTIFICATION} | COMMAND_MESSAGES | RESPONSE_MESSAGES, - remove_nan_times=False, return_in_order=True, return_bytes=True, - source_ids=self.source_ids, **self.params) + remove_nan_times=False, return_in_order=True, return_bytes=True, **self.params) if len(data.messages) == 0: self.logger.info('No event notification data available.') @@ -2293,15 +2283,13 @@ def _set_data_summary(self): params['max_messages'] = 1 params['return_in_order'] = True - result = self.reader.read(message_types=None, require_p1_time=True, source_ids=self.source_ids, - **params) + result = self.reader.read(message_types=None, require_p1_time=True, **params) if len(result.messages) > 0: processed_t0 = result.messages[0].get_p1_time() else: processed_t0 = Timestamp() - result = self.reader.read(message_types=None, require_system_time=True, source_ids=self.source_ids, - **params) + result = self.reader.read(message_types=None, require_system_time=True, **params) if len(result.messages) > 0: processed_system_t0 = result.messages[0].get_system_time_sec() else: @@ -2349,7 +2337,7 @@ def _set_data_summary(self): # Create a software version table. result = self.reader.read(message_types=[VersionInfoMessage.MESSAGE_TYPE], remove_nan_times=False, - source_ids=self.source_ids, **self.params) + **self.params) if len(result[VersionInfoMessage.MESSAGE_TYPE].messages) != 0: version = result[VersionInfoMessage.MESSAGE_TYPE].messages[-1] version_types = {'fw': 'Firmware', 'engine': 'FusionEngine', 'os': 'OS', 'rx': 'GNSS Receiver'} @@ -2466,8 +2454,7 @@ def _auto_detect_message_type(self, types: List[MessageType]): params['max_messages'] = 1 selected_type = None for message_type in types: - result = self.reader.read(message_types=message_type, remove_nan_times=False, - source_ids=self.source_ids, **params) + result = self.reader.read(message_types=message_type, remove_nan_times=False, **params) data = result[message_type] if len(data.p1_time) > 0: selected_type = message_type_to_class[message_type] diff --git a/python/fusion_engine_client/analysis/data_loader.py b/python/fusion_engine_client/analysis/data_loader.py index fdbdb180..2ffdb025 100644 --- a/python/fusion_engine_client/analysis/data_loader.py +++ b/python/fusion_engine_client/analysis/data_loader.py @@ -305,6 +305,8 @@ def _read(self, else: time_range = TimeRange.parse(time_range) + if source_ids is None: + source_ids = self.reader.get_available_source_ids() if source_ids is not None: source_ids = set(source_ids) diff --git a/python/fusion_engine_client/parsers/mixed_log_reader.py b/python/fusion_engine_client/parsers/mixed_log_reader.py index c3aeacad..89b11b48 100644 --- a/python/fusion_engine_client/parsers/mixed_log_reader.py +++ b/python/fusion_engine_client/parsers/mixed_log_reader.py @@ -501,7 +501,7 @@ def filter_in_place(self, key, clear_existing: bool = False, unavailable_source_ids = list(source_ids.difference(self.available_source_ids)) if len(unavailable_source_ids) > 0: self.logger.debug('Not all source IDs requested are available. Cannot extract the following ' - 'source IDs: {}'.format(unavailable_source_ids)) + 'source IDs: {}'.format(unavailable_source_ids)) source_ids = list(source_ids.intersection(self.available_source_ids)) if len(source_ids) == 0: raise ValueError("Requested source ID(s) unavailable. Exiting.")