diff --git a/Data/Brain/Sessions/session_028_2026-04-22/detections.tmp b/Data/Brain/Sessions/session_028_2026-04-22/detections.tmp deleted file mode 100644 index e69de29..0000000 diff --git a/Lidar/SLAM_worker.py b/Lidar/SLAM_worker.py index 4045fc3..c79e920 100644 --- a/Lidar/SLAM_worker.py +++ b/Lidar/SLAM_worker.py @@ -64,6 +64,28 @@ def slam_worker( loc_cfg: LocalizationConfig, run_cfg: RuntimeConfig, ): + # ───────────────────────────────────────────────────────────────────── + # Redirect this subprocess's stderr to logs/lidar_sdk.log. The Livox + # C++ SDK prints directly to stderr (not Python logging) and spams + # thousands of lines/second when the LiDAR is offline or flaky. Keeping + # it in a file lets us still debug Livox issues without the errors + # drowning the interactive terminal. stdout stays attached so our own + # Python `print`s (pose updates, status lines) still reach the terminal. + # ───────────────────────────────────────────────────────────────────── + import os as _os, sys as _sys + try: + _log_dir = _os.path.join( + _os.path.dirname(_os.path.dirname(_os.path.abspath(__file__))), + "logs", + ) + _os.makedirs(_log_dir, exist_ok=True) + _err_path = _os.path.join(_log_dir, "lidar_sdk.log") + _fd = _os.open(_err_path, _os.O_WRONLY | _os.O_CREAT | _os.O_APPEND, 0o644) + _os.dup2(_fd, 2) # replace stderr FD so even C++ libs are captured + _sys.stderr = _os.fdopen(2, "w", buffering=1) + except Exception: + pass # never crash just because the log redirect failed + # suppress noisy warning from ctypes->numpy conversion import warnings warnings.filterwarnings(