-
Notifications
You must be signed in to change notification settings - Fork 14
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 the robot_description as an arg in initialize() with fallback to using node's parameters #66
Pass the robot_description as an arg in initialize() with fallback to using node's parameters #66
Conversation
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.
Hello!
I think it is better to add a completely new initialize
method that doesn't have the parameter interface but has the robot_description and then reuse it within the other initialize
method
but there are more ROS parameters used with the kdl interface. how would you design the |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #66 +/- ##
==========================================
- Coverage 71.50% 70.93% -0.57%
==========================================
Files 4 4
Lines 200 203 +3
Branches 134 136 +2
==========================================
+ Hits 143 144 +1
- Misses 25 26 +1
- Partials 32 33 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
I agree it will be hard in that case?. Either we go with this implementation (or) have a method called |
The only other ROS parameter being used by the KDL plugin is Do we have any examples of other plugins besides KDL using |
I don't think that there are others than |
Do you have a recommended parameter map implementation or library? Using a parameter map will have the same potential issues as using the node_parameter_interface. It's not obvious to the user of the kinematics_interface library which parameters need to be present by the plugin that will be loaded. Thus, it seems that adding the robot_description back into the node parameter interface is just like using a separate parameter map interface. It would require the user of the kinematics_interface library to add the robot_description to the node_parameter_interface before calling Let me know what you think and I can make the change. |
I thought about a simple unordered_map like we use it here.
I think that's up for the authors of the respective plugin to document that and give proper warnings if a parameter is not given or not within expected specs. |
Hm, maybe I was wrong: For example, to make the admittance controller work with different (possibly unknown) kinematics_interfaces, we can't use an unordered map without an additional parser for parameters which aren't known at compile time. So maybe it's cleaner to stay with ROS-parameters. |
I would avoid parameter maps. I think having things explicit makes it easier |
but how to make things explicit with a dynamically loaded library, where we can't know all parameters when writing the caller (in admittance controller in our example)? |
Sorry for the confusion, as for any kinematic interface it would need the robot description right?, this would be an explicit parameter for me, and all other individual parameters should be taken care of from the parameter interface we provide by those respective derived classes. If it's possible, It is better to have another initialize method where the robot description is not the last argument as it is very clear about its importance here. This way we use the old API in the older ROS versions and from rolling on we use the new API and deprecate the other one eventually |
const std::string & end_effector_name, | ||
const std::string & robot_description = "") = 0; |
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.
Let's be crazy here and just replace "end_effector_name" with "param_base_name" to know where to search for the parameters. And make robot_description
mandatory. To have backwards compatibility, I propose a new method with the following signature:
virtual bool initialize(
const std::string & robot_description,
std::shared_ptr<rclcpp::node_interfaces::NodeParametersInterface> parameters_interface,
const std::string & param_base_name = "kinematics",
) = 0;
Then we read `end_effector` from the parameters by provided `parameters_interface`.
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 think the word we are looking for is namespace, see below ;)
virtual bool initialize(
const std::string & robot_description,
std::shared_ptr<rclcpp::node_interfaces::NodeParametersInterface> parameters_interface,
const std::string & param_namespace = "kinematics",
) = 0;
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.
Yes exactly! This is the right way to do it. I want to avoid making the robot_description
an optional arg.
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.
In general I like the way this is going.
Closed in favor of #83. |
Per the discussion in the admittance_controller of ros2_controllers (ros-controls/ros2_controllers#1094), pass the robot_description string as an input argument to
initialize()
and fallback to getting the robot_description from the node's parameters.