modiificato sistema logging e cambiato aggiornamento tabello target

This commit is contained in:
VALLONGOL 2025-11-13 10:01:30 +01:00
parent 3df1be97c4
commit c1baee45b4

View File

@ -159,19 +159,22 @@ class SimulationStateHub:
):
"""
Adds a new simulated state for a given target.
LOCK-FREE: Writes directly to write_buffer without lock.
Thread: Called from SimulationEngine thread.
Args:
target_id: The ID of the target.
timestamp: The local timestamp (e.g., from time.monotonic()) when the state was generated.
state: A tuple representing the target's state (x_ft, y_ft, z_ft).
"""
with self._lock:
if target_id not in self._target_data:
self._initialize_target(target_id)
# LOCK-FREE: Write directly to write buffer
if target_id not in self._write_buffer['target_data']:
self._initialize_target_in_buffer(target_id, self._write_buffer)
# Prepend the timestamp to the state tuple
full_state = (timestamp,) + state
self._target_data[target_id]["simulated"].append(full_state)
# Prepend the timestamp to the state tuple
full_state = (timestamp,) + state
self._write_buffer['target_data'][target_id]["simulated"].append(full_state)
def add_real_state(
self, target_id: int, timestamp: float, state: Tuple[float, ...]