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

[Controller Interface] Make assign and release interfaces virtual #1743

Conversation

saikishor
Copy link
Member

Hello!

I wanted to open this PR to see if making assign_interfaces and release_interfaces is fine or not. This would be helpful if the user wants to deal with a different type instead of having them inside the vectors as it is by default

protected:
std::vector<hardware_interface::LoanedCommandInterface> command_interfaces_;
std::vector<hardware_interface::LoanedStateInterface> state_interfaces_;

void ControllerInterfaceBase::assign_interfaces(
std::vector<hardware_interface::LoanedCommandInterface> && command_interfaces,
std::vector<hardware_interface::LoanedStateInterface> && state_interfaces)
{
command_interfaces_ = std::forward<decltype(command_interfaces)>(command_interfaces);
state_interfaces_ = std::forward<decltype(state_interfaces)>(state_interfaces);
}
void ControllerInterfaceBase::release_interfaces()
{
command_interfaces_.clear();
state_interfaces_.clear();
}

By making them virtual, we can let the user able to define the internal structure and then clean them when the release interface is called

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.77%. Comparing base (4472287) to head (a288f57).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1743   +/-   ##
=======================================
  Coverage   86.77%   86.77%           
=======================================
  Files         116      116           
  Lines       10703    10703           
  Branches      981      981           
=======================================
  Hits         9288     9288           
  Misses       1062     1062           
  Partials      353      353           
Flag Coverage Δ
unittests 86.77% <ø> (ø)

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

Files with missing lines Coverage Δ
...controller_interface/controller_interface_base.hpp 87.50% <ø> (ø)

@saikishor
Copy link
Member Author

We need to add @mamueluth to the Reviewers group for the Reviewer Lottery job to succeed!

@bmagyar
Copy link
Member

bmagyar commented Sep 9, 2024

Thanks @saikishor , fixed!

bmagyar
bmagyar previously approved these changes Sep 11, 2024
Copy link
Member

@bmagyar bmagyar left a comment

Choose a reason for hiding this comment

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

Please highlight this and the intended use-case in the docs migration notes

@saikishor
Copy link
Member Author

Please highlight this and the intended use-case in the docs migration notes

@bmagyar Done!. Thank you!

Copy link
Member

@bmagyar bmagyar left a comment

Choose a reason for hiding this comment

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

thank you!

@bmagyar bmagyar merged commit eb4c19d into ros-controls:master Sep 11, 2024
17 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants