-
Notifications
You must be signed in to change notification settings - Fork 102
Use urdf::*ShredPtr instead of boost::shared_ptr #144
Conversation
|
I'm going to close and re-open to trigger the ROS build farm pull request testing. |
|
travis failed because it tests indigo and jade, but the ROS build farm is happy when testing with kinetic |
|
Will this be a problem for debian jessie, which doesn't have urdfdom 0.4 (it has 0.3)? |
|
It needs at least urdfdom 0.4. |
dab2a13 to
0d684c2
Compare
|
Keep this one in mind too: |
urdfdom_headers uses C++ std::shared_ptr. As it exports it as a custom *SharedPtr type, we can use them to stay compatible.
0d684c2 to
b9e7729
Compare
|
Rebased on current master. Note that Travis still fails due to urdfdom being too old. Also this needs #165 now as well. |
rhaschke
left a comment
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.
Kinetic is also supported on Wily and Jessie which do not yet ship with urdfdom 0.4. Use the compatibility header from urdf package.
| USERDATA(double scale) : scale(scale) { | ||
| } | ||
| double scale; | ||
| #if __cplusplus <= 199711L |
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 decision for boost::shared_ptr vs. std::shared_ptr shouldn't implicitly depend on the c++ version, but it should be an deliberative decision of the developer. You should declare a type VoidSharedPtr for this.
| #include <boost/function.hpp> | ||
|
|
||
| #include <urdf_model/model.h> | ||
| #include <urdf_world/types.h> |
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 include doesn't exist in Kinect on Wily and Jessie. You should use the compatibility header of the urdfpackage instead to safely define ModelInterfaceSharedPtr.
| } | ||
|
|
||
| _getUserData(pdomjoint)->p = pjoint; | ||
| #if __cplusplus <= 199711L |
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.
see above
urdf_parser_plugin/CMakeLists.txt
Outdated
|
|
||
| find_package(catkin REQUIRED) | ||
| find_package(urdfdom_headers REQUIRED) | ||
| find_package(urdfdom_headers 0.4 REQUIRED) |
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 is not feasible for Kinetic on Wily and Jessie.
| #define URDF_PARSER_PLUGIN_H | ||
|
|
||
| #include <urdf_model/model.h> | ||
| #include <urdf_world/types.h> |
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.
see above
urdf_parser_plugin/package.xml
Outdated
| <buildtool_depend>catkin</buildtool_depend> | ||
| <build_depend>liburdfdom-headers-dev</build_depend> | ||
| <run_depend>liburdfdom-headers-dev</run_depend> | ||
| <build_depend version_gte="0.4">liburdfdom-headers-dev</build_depend> |
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.
see above
rhaschke
left a comment
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.
Kinetic is also supported on Wily and Jessie which do not yet ship with urdfdom 0.4. Use the compatibility header from urdf package.
You should update .travis.yml to build the Kinetic branch against a Kinetic ROS. |
|
@rhaschke Thanks for the review, I've integrated your proposals. |
rhaschke
left a comment
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.
Overall looks good. Thanks for taking the effort to replace all those type definitions. Please consider minor comments.
.travis.yml
Outdated
| matrix: | ||
| - CI_ROS_DISTRO="indigo" | ||
| - CI_ROS_DISTRO="jade" | ||
| - CI_ROS_DISTRO="kinetic" |
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.
Sorry. Replacing Indigo and Jade with Kinetic wasn't a good advice. Travis is stuck to a Trusty system, which doesn't support Kinetic. Please revert this. Using the compatibility header, the Kinetic branch should compile in Indigo and Jade too now.
| #define URDF_PARSER_PLUGIN_H | ||
|
|
||
| #include <urdf_model/model.h> | ||
| #include <urdf/urdfdom_compatibility.h> |
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 requires package urdf as a build dependency too.
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 also means you need to have urdf as a run_depend. If we were using package xml version 2, it would be a build_export_depend. Basically, since there is no separate -dev package urdf needs to be installed at "run time" so other packages would be able to build against it. This is likely handled implicitly as a transitive dependency of one of the other run_depend's.
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 would result in a circular dependency, as we tried already ;).
urdf/urdfdom_compatibility.h.in
Outdated
|
|
||
| URDF_TYPEDEF_CLASS_POINTER(ModelInterface); | ||
|
|
||
| typedef boost::shared_ptr<void> VoidSharedPtr; |
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.
Why do you define VoidSharedPtrhere? This is a compatibility header to declare types of urdfdom. However, VoidSharedPtris only used internally by ColladaParser. Hence, the declaration should go to collada_parser/src/collada_parser.cpp:179.
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 see how to do it, as we would need @URDFDOM_DECLARE_TYPES@ in there to ifdef between the different urdfdom versions.
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.
..we cloud export a define in the urdf/urdfdom_compatibility.h.in, would that be ok?
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 see your issue. VoidSharedPtris a datatype declared and used internally in ColladaParseronly. It's not related to urdfdomor urdf package. You simply typedef boost::shared_ptr<void> VoidSharedPtr just before collada_parser/src/collada_parser.cpp:179.
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.
but we need to differentiate between boost::shared_ptr and std::shared_ptr depending on the urdfdom version.
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.
No, not at all. VoidSharedPtr doesn't depend on urdfdom. It's introduced only in ColladaParser. It's the free choice of the ColladaParserdeveloper when to switch to std::shared_ptr for this.
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.
but it's used to point to either point to urdf::LinkSharedPtr or urdf::JointSharedPtr
So it depends on them.
(not commenting on the programming style)
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 see. Didn't look that deep into the code. Nevertheless, VoidSharedPtr is a type within ColladaParser and should be declared there and not in the urdf package. You can convert between std::sharedptr and boost::sharedptr like this:
This reverts commit f1c085c.
urdf_parser_plugin/package.xml
Outdated
|
|
||
| <buildtool_depend>catkin</buildtool_depend> | ||
| <build_depend>liburdfdom-headers-dev</build_depend> | ||
| <build_depend>urdf</build_depend> |
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.
Argh! This defines now a circular dependency:
07:42:37 Error: Circular dependency in subset of packages: urdf, urdf_parser_plugin
07:42:37 Can not build workspace with circular dependency
You only need to have the urdf headers to be present. As it worked for you before (compatibility_header.h was found), it's probably safe to drop this dependency.
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.
Just saw it as well, done :)
wjwwood
left a comment
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.
Other than a small comment, the changes lgtm. Thanks for working on it guys.
|
@scpeters Do you have any feedback before this gets merged? |
* Use urdf::*SharedPtr instead of boost::shared_ptr urdfdom_headers uses C++ std::shared_ptr. As it exports it as a custom *SharedPtr type, we can use them to stay compatible. * Add compatibility urdf::VoidSharedPtr * Use urdfdom compatibility header * Build kinetic for kinetic branch * Add missing namespace and includes * Revert "Build kinetic for kinetic branch" This reverts commit f1c085c. * Add build dependency * Revert "Add build dependency" This reverts commit 9417509. * Export urdfdom version to header * Add dummy version in case it's not set by urdfdom_headers * Add missing header
* Use urdf::*SharedPtr instead of boost::shared_ptr urdfdom_headers uses C++ std::shared_ptr. As it exports it as a custom *SharedPtr type, we can use them to stay compatible. * Add compatibility urdf::VoidSharedPtr * Use urdfdom compatibility header * Build kinetic for kinetic branch * Add missing namespace and includes * Revert "Build kinetic for kinetic branch" This reverts commit f1c085c. * Add build dependency * Revert "Add build dependency" This reverts commit 9417509. * Export urdfdom version to header * Add dummy version in case it's not set by urdfdom_headers * Add missing header
urdfdom_headers uses C++ std::shared_ptr. As it exports it as custom
*SharedPtr type, we can use the to sty compatible.