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

[PR-1689] Follow-up PR of the controller interface variants integration #1779

Merged
merged 6 commits into from
Oct 9, 2024

Conversation

saikishor
Copy link
Member

Hello!

This PR is a follow-up PR of #1689 the minor things that could be nice to be addressed

Thank you!

Copy link

codecov bot commented Oct 8, 2024

Codecov Report

Attention: Patch coverage is 40.90909% with 13 lines in your changes missing coverage. Please review.

Project coverage is 86.85%. Comparing base (a6e44ab) to head (19118bf).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
...r_interface/src/chainable_controller_interface.cpp 38.88% 9 Missing and 2 partials ⚠️
...interface/include/controller_interface/helpers.hpp 66.66% 0 Missing and 1 partial ⚠️
controller_manager/src/controller_manager.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1779      +/-   ##
==========================================
- Coverage   86.90%   86.85%   -0.06%     
==========================================
  Files         118      118              
  Lines       11438    11447       +9     
  Branches     1051     1057       +6     
==========================================
+ Hits         9940     9942       +2     
- Misses       1131     1135       +4     
- Partials      367      370       +3     
Flag Coverage Δ
unittests 86.85% <40.90%> (-0.06%) ⬇️

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

Files with missing lines Coverage Δ
...oller_interface/chainable_controller_interface.hpp 100.00% <ø> (ø)
...interface/include/controller_interface/helpers.hpp 50.00% <66.66%> (-11.54%) ⬇️
controller_manager/src/controller_manager.cpp 77.07% <0.00%> (+0.24%) ⬆️
...r_interface/src/chainable_controller_interface.cpp 51.32% <38.88%> (-3.39%) ⬇️

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.

Overall looks good

Comment on lines +86 to +87
// Only add to the list if it doesn't exist
list.push_back(element);
Copy link
Member

Choose a reason for hiding this comment

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

when are we adding things multiple times?

Copy link
Member Author

Choose a reason for hiding this comment

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

std::vector<hardware_interface::StateInterface>
ChainableControllerInterface::on_export_state_interfaces()
{
state_interfaces_values_.resize(exported_state_interface_names_.size(), 0.0);
std::vector<hardware_interface::StateInterface> state_interfaces;
for (size_t i = 0; i < exported_state_interface_names_.size(); ++i)
{
state_interfaces.emplace_back(
get_node()->get_name(), exported_state_interface_names_[i], &state_interfaces_values_[i]);
}
return state_interfaces;
}
std::vector<hardware_interface::CommandInterface>
ChainableControllerInterface::on_export_reference_interfaces()
{
reference_interfaces_.resize(exported_reference_interface_names_.size(), 0.0);
std::vector<hardware_interface::CommandInterface> reference_interfaces;
for (size_t i = 0; i < exported_reference_interface_names_.size(); ++i)
{
reference_interfaces.emplace_back(hardware_interface::CommandInterface(
get_node()->get_name(), exported_reference_interface_names_[i], &reference_interfaces_[i]));
}
return reference_interfaces;
}

here we are creating the interfaces from the exported_state_interface_names_ and exported_reference_interface_names_ and later we are readding again to the same vector in the method. I think it is better to check and insert to not to have inconsistent sizes.

This will only happen if we use these variables to create and export the interfaces

Copy link
Member

Choose a reason for hiding this comment

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

sounds good, thank you

Comment on lines +86 to +87
// Only add to the list if it doesn't exist
list.push_back(element);
Copy link
Member

Choose a reason for hiding this comment

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

sounds good, thank you

@bmagyar bmagyar merged commit 0433960 into ros-controls:master Oct 9, 2024
18 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