Skip to content

Commit

Permalink
✨ add 'pipeline found' field to saved data
Browse files Browse the repository at this point in the history
  • Loading branch information
Rezenders committed Feb 19, 2024
1 parent 83f51d9 commit 2fa61c8
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions suave_missions/suave_missions/mission_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ def __init__(self, node_name: str = 'suave_metrics'):
self.mission_name += ' ' + self.adaptation_manager

self.metrics_header = [
'mission_name',
'mission name',
'datetime',
'initial pos (x,y)',
'time_mission (s)',
'time search (s)',
'mission duration (s)',
'pipeline found',
'time searching pipeline (s)',
'distance inspected (m)']

self.mission_start_time = None
Expand Down Expand Up @@ -155,14 +156,16 @@ def save_mission_results_cb(

def save_mission_results(self) -> None:
"""Process mission data and save it into a .csv file."""
detection_time_delta = -1
mission_time_delta = \
self.get_clock().now() - self.mission_start_time

pipeline_detected = False
detection_time_delta = mission_time_delta.to_msg().sec
if self.pipeline_detected_time is not None:
detection_time_delta = \
self.pipeline_detected_time - self.mission_start_time
detection_time_delta = detection_time_delta.to_msg().sec

mission_time_delta = \
self.get_clock().now() - self.mission_start_time
pipeline_detected = True

self.get_logger().info(
'Time elapsed to detect pipeline: {} seconds'.format(
Expand All @@ -177,6 +180,7 @@ def save_mission_results(self) -> None:
'({0}, {1})'.format(
round(self.initial_x, 2), round(self.initial_y, 2)),
mission_time_delta.to_msg().sec,
pipeline_detected,
detection_time_delta,
self.distance_inspected
]
Expand Down

0 comments on commit 2fa61c8

Please sign in to comment.