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

Pass URDF to controllers on init #1088

Merged
merged 9 commits into from
Nov 6, 2023

Conversation

bmagyar
Copy link
Member

@bmagyar bmagyar commented Jul 26, 2023

This should help avoiding extra legwork in controllers to get access to the /robot_description.

@bmagyar bmagyar force-pushed the pass-urdf-to-controllers branch from 7f832b4 to c80c1e6 Compare July 26, 2023 18:28
@@ -223,6 +223,7 @@ class ControllerInterfaceBase : public rclcpp_lifecycle::node_interfaces::Lifecy
std::vector<hardware_interface::LoanedStateInterface> state_interfaces_;
unsigned int update_rate_ = 0;
bool is_async_ = false;
std::string urdf_ = "";
Copy link
Member

Choose a reason for hiding this comment

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

Should this be a std::optional<std::string> urdf_ = std::nullopt instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't want to communicate the option of not being set as anything close to valid. The empty string initial value is only there so we can test if it was properly set...

I also thought about how we could do this better, a const string would be nice but that can only be set once which doesn't work well with the longer term idea of getting URDF updates from topics.

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.

The provision of the URDF directly to the controllers is a brilliant idea. This reduces the hassles one should go through to set up their controllers.

controller.c->init(controller.info.name, get_namespace()) ==

However, I think there is a missing part in assigning this URDF from the controller_manager's end, and at least one test that verifies the robot_description string from the topic or param is the same as that inside the controller.
Another test that checks when a URDF is updated in the topic, the newly initialized controllers get the new URDF rather than the old one.

Brilliant work 👏

destogl
destogl previously approved these changes Jul 31, 2023
Copy link
Member

@destogl destogl left a comment

Choose a reason for hiding this comment

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

This looks good!

@mergify
Copy link
Contributor

mergify bot commented Sep 18, 2023

This pull request is in conflict. Could you fix it @bmagyar?

@codecov
Copy link

codecov bot commented Oct 22, 2023

Codecov Report

Merging #1088 (caef34d) into master (bd6911d) will decrease coverage by 0.08%.
The diff coverage is 11.86%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1088      +/-   ##
==========================================
- Coverage   31.62%   31.55%   -0.08%     
==========================================
  Files          94       94              
  Lines       10838    10878      +40     
  Branches     7419     7454      +35     
==========================================
+ Hits         3428     3433       +5     
+ Misses        804      802       -2     
- Partials     6606     6643      +37     
Flag Coverage Δ
unittests 31.55% <11.86%> (-0.08%) ⬇️

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

Files Coverage Δ
...controller_interface/controller_interface_base.hpp 33.33% <ø> (-16.67%) ⬇️
...roller_interface/src/controller_interface_base.cpp 48.14% <100.00%> (+1.99%) ⬆️
...er_interface/test/test_controller_with_options.hpp 45.00% <100.00%> (ø)
.../include/controller_manager/controller_manager.hpp 18.18% <ø> (ø)
...r_manager/test/test_controller/test_controller.hpp 100.00% <ø> (ø)
...roller_failed_init/test_controller_failed_init.cpp 55.55% <ø> (ø)
...roller_failed_init/test_controller_failed_init.hpp 20.00% <ø> (ø)
...er_interface/test/test_controller_with_options.cpp 29.62% <0.00%> (ø)
...oller_interface/test/test_controller_interface.cpp 21.79% <0.00%> (ø)
...rface/test/test_chainable_controller_interface.cpp 14.44% <0.00%> (ø)
... and 3 more

@bmagyar bmagyar added the holding label Nov 4, 2023
@bmagyar bmagyar merged commit b33e579 into ros-controls:master Nov 6, 2023
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants