More general initialization of state from command (backport #2294)#2357
Merged
Conversation
(cherry picked from commit f6ee8cb) # Conflicts: # doc/release_notes.rst
Contributor
Author
|
Cherry-pick of f6ee8cb has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## kilted #2357 +/- ##
==========================================
+ Coverage 85.77% 85.81% +0.03%
==========================================
Files 152 152
Lines 15073 15060 -13
Branches 1293 1293
==========================================
- Hits 12929 12923 -6
+ Misses 1685 1682 -3
+ Partials 459 455 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Description
When operating a robot which does not always track desired positions accurately (e.g. torque controlled) you may sometimes want the JTC to initialize based on the current/latest command from the hardware interface, rather than the current measured state. This will ensure the "command" is unchanged when activating the controller. Otherwise, if you use measured state, the arm can move unexpectedly (usually, it will droop).
To handle this, JTC has
set_last_command_interface_value_as_state_on_activationparameter. However, it's implementation is weird to me. Specifically,bool read_state_from_command_interfaceswill returnFalseif you have avelocitystate interface but novelocitycommand interface. For me, this restriction seems unnecessary. You simply should need a state interface for eachcommandinterface, but not the other way around. Extra state interfaces are simply ignored.Explanation of changes
Now, we always first call
read_state_from_state_interfacesinon_activate.Then, if the parameter is set, we update this state from the command interfaces.
Thus, we renamed
read_state_from_command_interfacestoupdate_state_from_command_interfaceand change its behavior to only update fields that have command interfaces.To minimize code duplication, I refactored out
interface_has_valuesandassign_point_from_command_interface. This is the reason we have more deletions than additions :)Also I updated the tests to reflect the desired change in behavior.
Fixes # (issue)
https://discourse.openrobotics.org/t/handling-missing-command-interfaces-in-read-state-from-command-interface/53551
Is this user-facing behavior change?
Yes!
Did you use Generative AI?
A bit of copilot autocompletion.
This is an automatic backport of pull request #2294 done by Mergify.