Skip to content

Commit

Permalink
Merge branch 'mc_reasoner'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rezenders committed Jun 5, 2024
2 parents 038d1e5 + ccf4afa commit 8584506
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions suave_metrics/suave_metrics/mission_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def maintain_motion_transition_cb(self, msg):
self.component_recovery_time.append(reaction_time)
self.thrusters_failed = False
self.get_logger().info(
'Component recovery time: {} seconds'.format(reaction_time))
'Thruster failure reaction time: {} seconds'.format(reaction_time))

def generate_recharge_path_transition_cb(self, msg):
if msg.goal_state.label == "active" and self.battery_low is True:
Expand All @@ -292,7 +292,7 @@ def generate_recharge_path_transition_cb(self, msg):
self.battery_reaction_time.append(reaction_time)
# self.battery_low = False
self.get_logger().info(
'Battery reaction time: {} seconds'.format(reaction_time))
'Battery drop reaction time: {} seconds'.format(reaction_time))

def param_change_cb(self, msg):
time = self.get_clock().now()
Expand All @@ -308,8 +308,7 @@ def param_change_cb(self, msg):
reaction_time)
self.wrong_altitude = False
self.get_logger().info(
'Water visibility correction time: {} seconds'.
format(reaction_time))
'Water visibility change reaction time: {0} seconds'.format(reaction_time))
return

def save_mission_results_cb(
Expand Down Expand Up @@ -356,6 +355,14 @@ def save_mission_results(self) -> None:
]

date = datetime.now().strftime("%d-%b-%Y-%H-%M-%S")
mean_reaction_time = 0.0
try:
mean_reaction_time = statistics.fmean(
self.component_recovery_time +
self.wv_reaction_time +
self.battery_reaction_time)
except statistics.StatisticsError as e:
pass
mission_data = [
self.mission_name,
date,
Expand All @@ -365,10 +372,7 @@ def save_mission_results(self) -> None:
pipeline_detected,
detection_time_delta,
self.distance_inspected,
statistics.fmean(
self.component_recovery_time +
self.wv_reaction_time +
self.battery_reaction_time)
mean_reaction_time
]

self.save_metrics(
Expand Down

0 comments on commit 8584506

Please sign in to comment.