Skip to content

Commit

Permalink
Added buffer to voltage and current logging
Browse files Browse the repository at this point in the history
  • Loading branch information
alekskl01 committed Feb 4, 2024
1 parent f09819f commit 33c5c76
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mission/internal_status/src/battery_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ def system_cb(self, event):

# Write voltage to CSV file
current_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
self.csv_writer.writerow(
[current_time, self.system_voltage,
self.system_current]) # 'None' for current placeholder
self.buffer.append([current_time, self.system_voltage, self.system_current]) # 'None' for current placeholder

if len(self.buffer) >= 100:
for data in self.buffer:
self.csv_writer.writerow(data)
self.buffer.clear()

if self.system_voltage < self.critical_level:
rospy.logerr(
Expand Down

0 comments on commit 33c5c76

Please sign in to comment.