diff --git a/settings.json b/settings.json index cf8a97c..e675819 100644 --- a/settings.json +++ b/settings.json @@ -114,7 +114,7 @@ "target_azimuth_deg": 45.0 } ], - "use_spline": true + "use_spline": false }, { "target_id": 1, diff --git a/target_simulator/core/models.py b/target_simulator/core/models.py index 7ac62d3..b48ea00 100644 --- a/target_simulator/core/models.py +++ b/target_simulator/core/models.py @@ -200,6 +200,8 @@ class Target: if total_duration <= 0 or self._sim_time_s >= total_duration: # Simulation finished, stay at the last point self._spline_index = len(self._spline_path) - 1 + self.active = False + self.current_velocity_fps = 0.0 else: # Find the current index in the spline path based on time progress = self._sim_time_s / total_duration diff --git a/target_simulator/gui/main_view.py b/target_simulator/gui/main_view.py index 89edd0d..002ab8d 100644 --- a/target_simulator/gui/main_view.py +++ b/target_simulator/gui/main_view.py @@ -338,6 +338,10 @@ class MainView(tk.Tk): while not self.gui_update_queue.empty(): updated_targets: List[Target] = self.gui_update_queue.get_nowait() self._update_all_views(updated_targets) + # Stop simulation and update buttons if all targets are inactive + if self.is_simulation_running.get(): + if all(not t.active for t in self.scenario.get_all_targets()): + self._on_stop_simulation() finally: if self.is_simulation_running.get(): self.after(GUI_QUEUE_POLL_INTERVAL_MS, self._process_gui_queue)