-
Notifications
You must be signed in to change notification settings - Fork 304
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
Conversation
7f832b4
to
c80c1e6
Compare
@@ -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_ = ""; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this 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 👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good!
This pull request is in conflict. Could you fix it @bmagyar? |
Codecov Report
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
Flags with carried forward coverage won't be shown. Click here to find out more.
|
This should help avoiding extra legwork in controllers to get access to the
/robot_description
.