Repository navigation
fix: join the capture thread when the move fails in example 07 - #10
Merged
Merged
Conversation
07_vel_jitter_trace starts a capture thread before the move and joins it after. If the move throws -- a refused cartesian plan or a timeout are both normal operating conditions -- the stack unwinds past the join and the joinable std::thread is destroyed, so std::terminate fires: the example core-dumps (exit 134) and, because stdout is block-buffered on a pipe, the error message is lost too. Stop and join the capture thread in a catch block before rethrowing, so the failure surfaces through the normal error path.
|
🎉 This PR is included in version 0.1.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
07_vel_jitter_tracestarts a capture thread before the move and joinsit after. If the move throws — a refused cartesian plan or a timeout are
both normal operating conditions — the stack unwinds past the join, the
joinable
std::threadis destroyed andstd::terminatefires: theexample core-dumps (exit 134) and, because stdout is block-buffered on a
pipe, even the error message is lost.
Changes
examples/07_vel_jitter_trace.cpp: the log start and the move now runin a
tryblock; on failure the capture thread is stopped and joinedbefore rethrowing, so the error surfaces through the normal error path.
Testing
Offline:
./build.sh— 28/28 pass (test_protocol_syncSKIP: nofirmware tree). The example harness has no injectable transport, so the
failure path was verified on the real machine instead.
Real machine (LiteArm 7J, firmware Litearm1.10.0-7J, USB 1d50:606f). A
-Xcartesian move at this pose is refused by the firmware planner(fail-closed), which reproduces the failure.
Before this change:
./run_example.sh 07_vel_jitter_trace --go --dist -0.01→terminate called without an active exception, core dump, exit 134,no trace CSV written, error output lost to buffering
After this change:
./run_example.sh 07_vel_jitter_trace --go --dir 2 --dist 0.01→出错: 固件笛卡尔规划失败: 路点 IK 无解或解跳变 (err=1), exit 1, nocrash, the full plan printout and the error are visible
./run_example.sh 07_vel_jitter_trace --go --dir 3 --dist 0.01→规划: ok=1 n_wp=5 settled=1, both trace CSVs written (0 droppedframes on the 100 Hz channel)
Issues
None.