Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Admittance] multiple state/command interfaces #1196

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

MarcoMagriDev
Copy link

This PR aims to address the following issues:

  1. Fix wrong has flags used in write and read methods
  2. Fix wrong fields of state_commanded used in write_state_to_hardware
  3. Fix that multiple state interfaces are configured only the position state interface is considered due to else if statement.

Moreover:

  1. Makes position state interface mandatory, otherwise the controller will not be able to perform computations. The controller will not be configured if not provided.
  2. Adds compatibility with velocity command interface without position command interface.

@MarcoMagriDev
Copy link
Author

Hi everyone, just a gentle reminder to review this PR when you get a chance. Let me know if anything needs clarification. Thanks!

Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello!

Sorry for the late review. I have a comment on a change. Rest seems fine to me.
Is this fix tested on any hardware?

admittance_controller/src/admittance_controller.cpp Outdated Show resolved Hide resolved
@MarcoMagriDev
Copy link
Author

Hello!

Sorry for the late review. I have a comment on a change. Rest seems fine to me. Is this fix tested on any hardware?

At that time, I tested it on a UR10e robot using both the position command interface and the velocity command interface separately. That’s why I didn’t notice the missing pos_ind +. You’re absolutely right--let me fix this in a new commit.

Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There exists a newer PR #1434 addressing similar issues. Does it make sense to fix everything at once, and add proper tests for the multiple interfaces?

Copy link

codecov bot commented Feb 4, 2025

Codecov Report

Attention: Patch coverage is 91.66667% with 4 lines in your changes missing coverage. Please review.

Project coverage is 84.33%. Comparing base (ae6efeb) to head (e13863c).

Files with missing lines Patch % Lines
...dmittance_controller/src/admittance_controller.cpp 85.71% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1196      +/-   ##
==========================================
+ Coverage   84.27%   84.33%   +0.06%     
==========================================
  Files         123      123              
  Lines       11359    11390      +31     
  Branches      961      969       +8     
==========================================
+ Hits         9573     9606      +33     
+ Misses       1470     1466       -4     
- Partials      316      318       +2     
Flag Coverage Δ
unittests 84.33% <91.66%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...nce_controller/test/test_admittance_controller.cpp 100.00% <100.00%> (ø)
...nce_controller/test/test_admittance_controller.hpp 94.79% <ø> (ø)
...dmittance_controller/src/admittance_controller.cpp 76.17% <85.71%> (+1.45%) ⬆️

... and 1 file with indirect coverage changes

@MarcoMagriDev
Copy link
Author

There exists a newer PR #1434 addressing similar issues. Does it make sense to fix everything at once, and add proper tests for the multiple interfaces?

@christophfroehlich If you'd like, I can integrate those commits into my branch and push them to this PR. Let me know what you think!

@christophfroehlich
Copy link
Contributor

There exists a newer PR #1434 addressing similar issues. Does it make sense to fix everything at once, and add proper tests for the multiple interfaces?

@christophfroehlich If you'd like, I can integrate those commits into my branch and push them to this PR. Let me know what you think!

If you approve the changes and they are related, yes please merge them into your PR. Do you have an idea for adding a proper test for this use-case?

@MarcoMagriDev
Copy link
Author

MarcoMagriDev commented Feb 11, 2025

Yes I think that they are somehow related to this PR since it deals with interfaces.


Planned Tests for This PR:

  • Verify that if only the velocity state_interface is exported, the controller fails during configuration.
  • Ensure that if only the velocity command_interface is exported, there are no indexing errors in the vectors.

Planned Tests for the Other PR (After Integrating Changes):

  • Check that if a single reference_interface is exported, no errors are returned.

@christophfroehlich Do you have any other tests in mind that we should consider?

@christophfroehlich
Copy link
Contributor

sounds good. if the error you have encountered and fixed is tested, we already have improved it

- configuration failed if position state interface is not provided
- compatibility with only velocity command interface
@christophfroehlich christophfroehlich added the backport-humble This label should be used by maintainers only! Label triggers PR backport to ROS2 humble. label Feb 11, 2025
Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding tests and the other fixes. Failing tests are not related to this PR.

Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Just a minor comment
Thanks for adding tests

…faces` to position and velocity to ensure same default behavior after `allowed_reference_interfaces_types_` removal
saikishor
saikishor previously approved these changes Feb 12, 2025
Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now, LGTM

Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one_init_parameter_is_missing is failing now

…ted missing parameters after default value addition
@MarcoMagriDev
Copy link
Author

one_init_parameter_is_missing is failing now

one_init_parameter_is_missing was failing because we now define a default value for chainable_command_interfaces, whereas the test expected the controller to crash when this parameter was not explicitly provided.

I just pushed a new commit that removes this parameter from the list of tested ones in the test suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-humble This label should be used by maintainers only! Label triggers PR backport to ROS2 humble.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants