From f948c243f8eef1db625f9cc14c8ada0f4e59b164 Mon Sep 17 00:00:00 2001 From: Joseph VanPelt Date: Wed, 16 Oct 2024 17:10:00 -0400 Subject: [PATCH] move header setup to right before publishing --- .../activity_classifier_tcn.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ros/angel_system_nodes/angel_system_nodes/activity_classification/activity_classifier_tcn.py b/ros/angel_system_nodes/angel_system_nodes/activity_classification/activity_classifier_tcn.py index 8d33eea22..f2d3e66fe 100644 --- a/ros/angel_system_nodes/angel_system_nodes/activity_classification/activity_classifier_tcn.py +++ b/ros/angel_system_nodes/angel_system_nodes/activity_classification/activity_classifier_tcn.py @@ -642,8 +642,12 @@ def rt_loop(self): act_msg = self._process_window(window) # log.info(f"activity message: {act_msg}") self._collect_results(act_msg) - # overwriting this time to make sure the msg time is post inference + # set the header right before publishing so that the time is post image processing + act_msg.header.frame_id = "Activity Classification" act_msg.header.stamp = self.get_clock().now().to_msg() + act_msg.source_stamp_start_frame = window.frames[0][0] + act_msg.source_stamp_end_frame = window.frames[-1][0] + act_msg.label_vec = self._model.classes self._activity_publisher.publish(act_msg) except NoActivityClassification: # No ramifications, but don't publish activity message. @@ -794,13 +798,8 @@ def _process_window(self, window: InputWindow) -> ActivityDetection: # Prepare output message activity_msg = ActivityDetection() - activity_msg.header.frame_id = "Activity Classification" - activity_msg.header.stamp = ( - self.get_clock().now().to_msg() - ) # note: this will be overwritten later (post inference) - activity_msg.source_stamp_start_frame = window.frames[0][0] - activity_msg.source_stamp_end_frame = window.frames[-1][0] - activity_msg.label_vec = self._model.classes + + # save the activity probabilities activity_msg.conf_vec = proba.tolist() if self._enable_trace_logging: