Skip to content

Commit 2a7334b

Browse files
committed
Refactor file
1 parent 658ae3d commit 2a7334b

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

behavior_metrics/utils/controller.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ def record_metrics(self, perfect_lap_filename, metrics_record_dir_path, world_co
204204

205205
self.perfect_lap_filename = perfect_lap_filename
206206
self.metrics_record_dir_path = metrics_record_dir_path
207-
timestr = time.strftime("%Y%m%d-%H%M%S")
208-
self.experiment_metrics_filename = timestr + '.bag'
207+
time_str = time.strftime("%Y%m%d-%H%M%S")
208+
self.experiment_metrics_filename = time_str + '.bag'
209209
topics = ['/F1ROS/odom', '/clock']
210210
command = "rosbag record -O " + self.experiment_metrics_filename + " " + " ".join(topics) + " __name:=behav_metrics_bag"
211211
command = shlex.split(command)
@@ -234,15 +234,14 @@ def stop_recording_metrics(self, pitch_error=False):
234234
self.lap_metrics = metrics.get_metrics(self.experiment_metrics_filename, perfect_lap_checkpoints, circuit_diameter)
235235
else:
236236
self.lap_metrics = {'percentage_completed': 0, 'average_speed': 0, 'lap_seconds': 0,
237-
'circuit_diameter': 0, 'position_deviation_mae': 0,
238-
'position_deviation_total_err': 0}
239-
logger.info("END ----> Stopping metrics bag recording")
237+
'circuit_diameter': 0, 'position_deviation_mae': 0, 'position_deviation_total_err': 0}
238+
logger.info("Stopping metrics bag recording")
240239

241240
def save_metrics(self, mean_iteration_time, mean_inference_time, frame_rate, gpu_inference, first_image):
242241
time_metrics = {'mean_iteration_time': mean_iteration_time,
243-
'mean_inference_time': mean_inference_time,
244-
'frame_rate': frame_rate,
245-
'gpu_inference': gpu_inference}
242+
'mean_inference_time': mean_inference_time,
243+
'frame_rate': frame_rate,
244+
'gpu_inference': gpu_inference}
246245
time_metrics_str = json.dumps(time_metrics)
247246
lap_metrics_str = json.dumps(self.lap_metrics)
248247
with rosbag.Bag(self.experiment_metrics_filename, 'a') as bag:

0 commit comments

Comments
 (0)