Repository navigation
Step 1: fix GUI/worker races while preserving live trajectories - #590
Conversation
|
Somewhat faster processing, since previously, rendering would frequently keep the mutex required for calculations occupied. The change is significant for long-running processes. |
|
The latest commit separates the trajectory calculation data from the data used for rendering. |
michalpelka
left a comment
There was a problem hiding this comment.
This is agentic coding results. I am fine with agentic coding, but I won't accept this PR in this form:
- it is large change,
- it introduce some tests, that are more than burden and test a features that could be tested by simply looking at output - I am not against TDD, but it seems that agent workflow dealing with UX things,
- it itroduces two things : race condition in step1 and UX improvement.
I recommend:
- issue for found UB,
- split PR to minimal fix for potential UB in step 1 (two - ten LOCs),
- larger PR that will reuse existing code for drawing, utilize raylib buffers.
| { | ||
| float x, y, z; | ||
| float r, g, b; | ||
| }; |
There was a problem hiding this comment.
Duplication of existing structure from codebase.
| }; | ||
|
|
||
| //! Independent line pairs, with the same persistent position/color storage. | ||
| class CachedLineSegments : private CachedPointCloud |
There was a problem hiding this comment.
Raylib has its own strucutres for drawing lines with buffer.
There was a problem hiding this comment.
I believe it is thought process of the agent not TDD.
0e00366 to
03b44d6
Compare
|
I’ve ruined all the charm. I’ll find a solution. |
|
Let fix #592 with few mutexes than discuss what to add next. Step1's visualization is not essential, and meant to give operator early hint that LIO has exploded. |
|
Thanks for refactor! |
Fixes #592.
Step 1 reads trajectory and prediction vectors in the GUI while background odometry modifies or reallocates them. The sliding-window reset also clears bucket maps without taking the mutexes used by the renderer.
Keep the live trajectory, axis and prediction overlays using the existing WorkerData type and drawing functions. The producer copies only the displayed trajectory/prediction fields at safe pipeline boundaries, normally at most every 100 ms, with forced snapshots at initialization, pause and completion/failure. A mutex protects only the shared-pointer exchange; copying the display data and destroying the previous snapshot happen outside the lock. The GUI retains an immutable snapshot for each frame during processing and uses its original data while idle, so manual edits remain visible. Overlay toggles remain usable while paused.
Lock both bucket-map mutexes around the reset clear, and keep settings/gizmo editing disabled during the background run. The scope is limited to three existing Step 1 files. It adds no drawing structures, GPU buffers, maintained test targets or visual tests.
Validation:
The display snapshot introduces copying and RAM overhead. Live updates can lag while the worker is between safe publication points; no numerical speedup is claimed. Full-recording behavior, numerical output equivalence, ThreadSanitizer validation and Linux/macOS behavior still need validation. This PR addresses the identified trajectory display accesses and map reset; it is not a claim that every application threading issue is resolved.