Make sure motion control returns to main thread before stopping - #490
Merged
Conversation
When the watchdog times out, we halt in the external_control script and call stopj() just before that. However, ongoing motion will never happen in the main thread, but we always use a motion thread. Thus, calling stopj() here will result in an error that currently another thread is controlling the robot's motion. Since we still want to stop the robot using the predefined deceleration, we have to stop all motion beforehand. Effectively returning motion control to the main thread before calling stopj().
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #490 +/- ##
==========================================
- Coverage 76.40% 76.28% -0.13%
==========================================
Files 113 113
Lines 6603 6603
Branches 2696 2696
==========================================
- Hits 5045 5037 -8
- Misses 1209 1215 +6
- Partials 349 351 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
urrsk
approved these changes
Apr 23, 2026
urrsk
approved these changes
Apr 23, 2026
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.
When the watchdog times out, we halt in the external_control script and call stopj() just before that. However, ongoing motion will never happen in the main thread, but we always use a motion thread. Thus, calling stopj() here will result in an error that currently another thread is controlling the robot's motion.
Since we still want to stop the robot using the predefined deceleration, we have to stop all motion beforehand. Effectively returning motion control to the main thread before calling stopj().
Alternatively, we could remove the
stopj()command (it is effectively not doing anything right now, anyway), but that would result in a very sudden stop of the robot.This effectively fixes #479