Repository navigation
fix(protective_stop_node): stop if any paired remote is pressed or lost - #211
Draft
iliabaranov wants to merge 1 commit into
Draft
iliabaranov wants to merge 1 commit into
iliabaranov wants to merge 1 commit into
Conversation
process_heartbeat overwrote the stop flag with each active remote's state, so with two paired remotes only the last one in the registry decided: a press on the other was ignored, and a missed heartbeat on the other was overwritten by the last remote's released state. The stop is now the OR over every non-deactivated remote. When the registry was full, activation pruned the oldest remote even if it was still active, which silently dropped its stop (its later messages were ignored as coming from an unknown source). It also pruned before rejecting a repeated activation from an already active remote. Now only deactivated remotes are pruned, and activation is refused while every registered remote is active. Adds multiple_remotes.test.py (any pressed remote stops, any silent remote stops, both released runs, full registry) and updates test_max_connections.
This branch has not been deployed
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.
Fixes #210.
Why
With two paired remotes (for example the operator's Polyglot P-stop panel and a safety person's), only the remote
paired last could stop the robot:
process_heartbeat()overwrotestopwith each remote's state in turn, so a press on any other remote was ignored,and so was another remote missing its heartbeat.
max_pstop_countwas reached, activation deleted the oldest remote even while it was active. Its presses werethen ignored as coming from an unknown source. Polyglot makes a new uuid every session, so this happens after a few
page reloads. The pruning also ran before the "Already activated" check, so a repeated activation could drop a
different remote.
This node ships in polymath_core v14.0 as
pstop-legacy, the service Polyglot's P-stop panel pairs with.What changed
process_heartbeat(): the heartbeat'sstopis the OR over every non-deactivated remote. Any pressed remote, orany remote that missed its heartbeat, stops the robot. With no remotes, the behaviour is unchanged (stop when user
monitored, run when not).
oldest first. A remote re-activating reuses its own entry. If every entry is active or unstable, activation is
refused with
Max pstop count of N reached and every remote is active. Retry once a remote is deactivated.Polyglot shows a refused activation as a connection error.
max_pstop_countdescription documents this.Behaviour that stays the same: a remote silent longer than
deactivation_timeoutis deactivated and no longer counts.Tests
test/multiple_remotes.test.py(ownROS_DOMAIN_ID79), two paired remotes:stop: false;stop: true;stop: true;registered and the oldest still stops the robot; after one is deactivated, a new remote takes its slot and the
active ones stay.
test_max_connectionsnow checks the refusal and the pruning of deactivated remotes (it used to deactivate randomuuids that were never activated).
test_err_for_multiple_activationsdeactivates its remote, because a silentactive remote now holds the stop and a slot for
deactivation_timeout.Run in the polymath_core v14.0 image (
toborlife_ai:jazzy-a13dbf62) with--network none:colcon build/test --packages-select protective_stop_node.test_max_connections); "bothreleased" passes.
The new tests space out each remote's messages within a heartbeat period, because the node's
/protective_stopsubscription has queue depth 1 and drops a message that arrives right behind another.