[JTC] Add Parameter to Toggle State Setting on Activation (backport #1231) #1319
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.
This pull request introduces a new parameter in the JointTrajectoryController that enables toggling whether the last command interface value should be set as both the current_state and last_commanded_state upon activation.
Motivation
Consider a scenario where there is a transition from a JTC to another controller and back to a JTC. Due to the implementation specifics of the intermediary controller, it is possible that the command interface values from the first JTC remain. This can lead to dangerous situations where, upon reactivation, the second JTC inadvertently uses these stale command values to command the hardware.
To mitigate this risk, I have added an option within the JTC that ensures command values are reliably reset to reflect the current state upon activation, enhancing system safety.
This is an automatic backport of pull request #1231 done by Mergify.