Allow supplying NodeHandle for initParam#168
Conversation
|
Corresponding PR in ros_controllers: ros-controls/ros_controllers#245 |
27b6f92 to
4073f54
Compare
|
Apart from providing backward compatibility with a consistent behaviour, this PR eases namespacing 👍 from me |
|
This would cause a ABI break as-is, and I'd prefer not to do that. You could instead add a new method, something like |
|
👍 Good idea @wjwwood , we'd need this in Kinetic |
|
I can forward/back port anything when preparing for release. |
|
Sounds good. I'm swamped on other things at the moment, and I'll try and get back to this in a week or two. |
4073f54 to
ab7c9d7
Compare
|
Looks like CI is failing for Indigo and Jade, is that expected? |
|
@wjwwood: My bad. Forgot a return statement. Checks are passing now. |
|
No worries that's why we have CI 😄. @clalancette / @sloretz can you one of you guys review this change too? |
sloretz
left a comment
There was a problem hiding this comment.
I think package.xml may need to be updated too
| #include <tinyxml.h> | ||
| #include <boost/shared_ptr.hpp> | ||
| #include <boost/weak_ptr.hpp> | ||
| #include <ros/ros.h> |
There was a problem hiding this comment.
@wjwwood correct me if I'm wrong, but I think the package.xml needs <build_export_depend>roscpp</build_export_depend> because of this addition
There was a problem hiding this comment.
build_export_depend is unsupported in package.xml format 1, which is what urdf is using. I believe the format 1 build_depend did that behavior by default.
There was a problem hiding this comment.
AFAIK in package format 1 "exported build depends" have to be declared as run_depend.
Source: http://www.ros.org/reps/rep-0127.html#run-depend-multiple and http://www.ros.org/reps/rep-0140.html#removing-run-depend
| /// \brief Load Model given the name of a parameter on the parameter server | ||
| bool initParam(const std::string& param); | ||
| /// \brief Load Model given the name of a parameter on the parameter server using provided nodehandle | ||
| bool initParamWithNodeHandle(const std::string& param, const ros::NodeHandle& nh = ros::NodeHandle()); |
There was a problem hiding this comment.
Adding this looks good to me. It makes using the library easier.
I think the specific case of ros-controls/ros_controllers#244 could be solved by using NodeHandle::resolveName("robot_description") and passing the fully qualified name into initParam()
There was a problem hiding this comment.
@sloretz: You're right. However, after discussion, we decided to go this route.
01f76f9 to
a9e5fb8
Compare
|
@wjwwood: Any chance we could push this one through since it's been approved? Thanks! |
|
Awesome. Thanks! |
Previously, initParam always constructs a default NodeHandle, which
works correctly as long as robot_description param and the node
calling initParam are in the same namespace. This is not true,
when initParam is called via a ros_control controller running in
the global namespace (gazebo), but robot_descriptions still need
to be namespaced. This backwards compatible change allows setting
the NodeHandle.
See ros-controls/ros_controllers#244