Skip to content

Commit 217ea75

Browse files
author
Your Name
committed
Enhance AutonomyMetricsLogger with collision incident tracking and update metrics configuration
1 parent fa67060 commit 217ea75

File tree

3 files changed

+455
-55
lines changed

3 files changed

+455
-55
lines changed

src/autonomy_metrics/autonomy_metrics/db_mgr.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def init_session(self, env_variables, aoc_repos_info):
7272
"incidents": 0,
7373
"distance": 0,
7474
"autonomous_distance": 0,
75+
"collision_incidents": 0, # NEW
7576
"events": []
7677
}
7778
result = self.sessions_collection.insert_one(session_document)
@@ -155,4 +156,20 @@ def update_mdbi(self, mdbi):
155156
{"_id": ObjectId(self.session_id)},
156157
{"$set": {"mdbi": mdbi}}
157158
)
158-
return result.modified_count > 0
159+
return result.modified_count > 0
160+
161+
def update_collision_incidents(self, collision_incidents):
162+
"""
163+
Updates the collision_incidents value of the current session.
164+
165+
Args:
166+
collision_incidents (int): The new collision incidents value.
167+
168+
Returns:
169+
bool: True if the value was updated successfully, False otherwise.
170+
"""
171+
result = self.sessions_collection.update_one(
172+
{"_id": ObjectId(self.session_id)},
173+
{"$set": {"collision_incidents": collision_incidents}}
174+
)
175+
return result.modified_count > 0

0 commit comments

Comments
 (0)