Skip to content

Reduce explicit mention of boost::shared_ptr in moveit_planners and moveit_experimental - #97

Merged
davetcoleman merged 2 commits into
moveit:kinetic-develfrom
fizyr-forks:shared_ptr_macro
Aug 23, 2016
Merged

davetcoleman merged 2 commits into
moveit:kinetic-develfrom
fizyr-forks:shared_ptr_macro

Conversation

@de-vri-es

@de-vri-es de-vri-es commented Aug 21, 2016 •

Copy link
Copy Markdown
Contributor

I'm working down grep results for boost::shared_ptr in pretty much arbitrary order. This PR tackles moveit_planners/* and moveit_experimental/*.

Additionally, I added a macro MOVEIT_STRUCT_FORWARD. When compiling with -Wall -Wextra, gcc will emit a warning when a forward declaration and definition mismatch in use of struct or class. The extra macro can avoid that warning.

I also added MOVEIT_DECLARE_PTR (and modified the other macros to use it) to support declaring shared_ptr types for more complex types. For example, there was a typedef boost::shared_ptr<std::vector<ConstraintApproximation> > ConstraintApproximations. That becomes MOVEIT_DELCARE_PTR(ConstraintApproximations, std::vector<ConstraintApproximation>) with the new macro (order of arguments chosen to match the new using x = y; type aliases rather than the old typedef syntax).

Note that only the ompl code is actually compiled as far as I can tell. The rest has not been migrated to catkin, so I did not compile it. If that is a reason to hold off this type of work until it is actually compiling, I can understand. Then I'll strip the PR of everything but the changes to the ompl code.

@v4hn

v4hn commented Aug 21, 2016

Copy link
Copy Markdown
Contributor

On Sun, Aug 21, 2016 at 07:36:21AM -0700, Maarten de Vries wrote:

Note that only the ompl code is actually compiled as far as I can tell.
The rest has not been migrated to catkin, so I did not compile it.
If that is a reason to hold off this type of work until it is actually compiling, I can understand.
Then I'll strip the PR of everything but the changes to the ompl code.

I don't think we should merge untested (and actually at the moment untestable) patches.
Please strip the packages that have not been catkinized from this request.

@@ -0,0 +1,55 @@
/*********************************************************************

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why did you create a second file for this, instead of keeping in class_forward.h? these files are already very small

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It didn't seem logical to put something for declaring shared_ptr types in a file called class_forward.h. It has nothing to do with forward declaring a class, it just creates two type aliases. I suppose a different name could logically house both macros (though I can't think of one right now), but I'm guessing that would require keeping a backwards compatibility header for the old name for a while.

I figured this was the cleanest solution.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

class_forward has always been somewhat miss-named by also declaring shared_ptrs. I don't mind too much either way how we do it, just seemed slightly more complicated your way.

@de-vri-es de-vri-es Aug 22, 2016 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm also not too picky here, but I do feel the separate file is somewhat more clean. If you (or another maintainer) really prefers it I'll move it to the class_forward.h header, but otherwise I'll keep it as is.

That is partly because is is intended as a internal public macro, and not as an implementation detail of CLASS_FORWARD, so good naming is somewhat important. If it was just an implementation detail of CLASS_FORWARD, I wouldn't have hesitated to put it in the same file as CLASS_FORWARD.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1 to declare_ptr.h.

The "class forward" header/macro is miss-named.
We could provide a combined header for both in kinetic and deprecate the class_forward.h header there,
but then I don't think it is worth the effort...

@davetcoleman

Copy link
Copy Markdown
Member

@v4hn since the uncatkinized packages (untouched and untested for several years) are basically dead code at the moment, I don't see the harm in helping it a long by applying simple changes across the whole code base to it as well. i think @de-vri-es efforts with it are unnecessary, but if he's so inclined why not? otherwise it'll just be more hurdles to revive it in the future

@v4hn

v4hn commented Aug 22, 2016

Copy link
Copy Markdown
Contributor

On Sun, Aug 21, 2016 at 10:21:51PM -0700, Dave Coleman wrote:

basically dead code at the moment, I don't see the harm in helping it a long by applying simple changes across the whole code base

If you're playing compiler to be 100% sure they do not introduce new compiler errors, fine by me...

I'd say leave them out until somebody cares for them enough to actually update and test them.

@de-vri-es

Copy link
Copy Markdown
Contributor Author

I can't guarantee there are no new compiler errors of course. I'm fine with removing the changes to the uncompiled code.

I could give a short stab at getting the code to compile if nobody else is working on that, but I don't think that should be in this PR then. Plus I don't know what the things in there are supposed to do, so the best I could do is get it to compile, without any guarantee that it does what it should do. It's probably more logical if someone who can verify correctness works on something like that.

@de-vri-es

Copy link
Copy Markdown
Contributor Author

I only noticed it wasn't actually getting compiled when I was half way in by the way, otherwise I wouldn't have started on it in the first place. I could have known, but still it might be worth moving the disabled bits to some obvious place like moveit_disabled/* or something similar.

@v4hn

v4hn commented Aug 22, 2016

Copy link
Copy Markdown
Contributor

On Mon, Aug 22, 2016 at 04:27:07AM -0700, Maarten de Vries wrote:

I could have known, but still it might be worth moving the disabled bits to some obvious place like moveit_disabled/* or something similar.

Feel free to file a request. Honestly speaking, I do not really care...
Last time we discussed that, the overall attitude was "well, they don't do harm, so we'll leave them where they are..."

@bmagyar

bmagyar commented Aug 22, 2016 •

Copy link
Copy Markdown
Member

The unification of moveit repos is the perfect opportunity to leave old and untested (let alone unwanted) code behind.

@davetcoleman

Copy link
Copy Markdown
Member

perfect opportunity to leave old and untested (let alone unwanted) code behind.

FYI we are discussing two old planning plugins right now:

sbpl

I've been in email communication with Dr. Likhachev and one of his students @aurone about reviving this plugin for MoveIt!. They are interested in continuing it, perhaps starting tomorrow (World MoveIt! Day) and I've just created an issue to track progress for it: #101

chomp

@ksatyaki and perhaps @jrgnicho have been working on reviving this in this issue. I'm hoping they can share back their progress through a PR. a good starting PR would be one that simply catkinizes the folder.

@de-vri-es

Copy link
Copy Markdown
Contributor Author

Removed the changes to sbpl, chomp and moveit_experimental.

For posterity, the old branch is still available here: https://github.com/delftrobotics/moveit/tree/experimental_shared_ptr

@davetcoleman

Copy link
Copy Markdown
Member

Created two PRs to I/J

@ksatyaki

ksatyaki commented Aug 23, 2016 •

Copy link
Copy Markdown
Contributor

@davetcoleman I have two separate repos containing my changes + @jrgnicho 's changes (moveit_planners and moveit_experimental). How do I merge these? Once I merge the changes from the "Reduce explicit mention of boost::shared_ptr ..." issue, I could test my code and then issue a pull request?

Is this (using shared_ptr <>) a mistake or simply something to make code look cleaner?

@de-vri-es

de-vri-es commented Aug 23, 2016 •

Copy link
Copy Markdown
Contributor Author

@ksatyaki: I would say there is no need to merge the changes regarding the shared_ptrs before reviving CHOMP.

The reason for using MOVEIT_CLASS_FORWARD and the shared_ptr typedefs is mainly to ease migration to std::shared_ptr in the future (at least, as far as I am concerned). So it's nice to have, but not required on the short term.

Also, I'm willing to redo the shared_ptr changes after CHOMP has been revived, so if you don't want to you don't need to bother about it at all. It sounds like reviving CHOMP is hard enough without doing this at the same time.

/edit: To summarize: feel free to completely ignore the whole MOVEIT_CLASS_FORWARD and shared_ptr thing.

@ksatyaki

ksatyaki commented Aug 23, 2016 •

Copy link
Copy Markdown
Contributor

@de-vri-es , Ah okay. I have been trying to revive CHOMP with some help from @jrgnicho.

You can find some information on it here ##15. Any help is appreciated! :-)

@mikeferguson

Copy link
Copy Markdown
Contributor

So I'm getting some issues compiling after this is merged:

[ 47%] Building CXX object moveit/moveit_core/collision_detection/CMakeFiles/moveit_collision_detection.dir/src/collision_octomap_filter.cpp.o
/home/fergs/kinetic/src/moveit/moveit_core/collision_detection/src/collision_octomap_filter.cpp: In function ‘int collision_detection::refineContactNormals(const ObjectConstPtr&, collision_detection::CollisionResult&, double, double, bool, double, double)’:
/home/fergs/kinetic/src/moveit/moveit_core/collision_detection/src/collision_octomap_filter.cpp:118:71: error: conversion from ‘const boost::shared_ptr<const octomap::OcTree>’ to non-scalar type ‘std::shared_ptr<const octomap::OcTree>’ requested
         std::shared_ptr<const octomap::OcTree> octree = shape_octree->octree;
                                                                       ^
moveit/moveit_core/collision_detection/CMakeFiles/moveit_collision_detection.dir/build.make:134: recipe for target 'moveit/moveit_core/collision_detection/CMakeFiles/moveit_collision_detection.dir/src/collision_octomap_filter.cpp.o' failed
make[2]: *** [moveit/moveit_core/collision_detection/CMakeFiles/moveit_collision_detection.dir/src/collision_octomap_filter.cpp.o] Error 1
CMakeFiles/Makefile2:8831: recipe for target 'moveit/moveit_core/collision_detection/CMakeFiles/moveit_collision_detection.dir/all' failed
make[1]: *** [moveit/moveit_core/collision_detection/CMakeFiles/moveit_collision_detection.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j8 -l8" failed

@davetcoleman

Copy link
Copy Markdown
Member

i am having this same problem

@mikeferguson

Copy link
Copy Markdown
Contributor

doing geometric_shapes from source fixes this

@davetcoleman

Copy link
Copy Markdown
Member

i actually had it installed from source, per the moveit.rosinstall, but i also had it installed from debian with an older version and it was conflicting. i added a note to help future users:

https://github.com/ros-planning/moveit.ros.org/commit/01d03d975883bb621ab59218678a0f0e30cd4e8f

@IanTheEngineer

Copy link
Copy Markdown
Contributor

I also encountered this FCL issue when building from source. I have geometric_shapes as source, and seeing @davetcoleman 's last response, went to uninstall the deb version. It actually takes ros-kinetic-robot-model and ros-kinetic-collada-urdf with it, and then all the ros-kinetic-* core metapkgs.

Regardless, even grabbing those uninstalled packages back in my workspace source, and trying to build again, I still have the FCL issue.

@de-vri-es

Copy link
Copy Markdown
Contributor Author

Interesting that it got triggered after this PR though, it should be caused by the FCL shared_ptr changes before the repository merge, not the use of MOVEIT_CLASS_FORWARD.

At any rate, I will look at improving the error message by adding a static assert.

@davetcoleman

Copy link
Copy Markdown
Member

The geometric_shapes problems should be fixed today(?) once @wjwwood released robot_model

@wjwwood

wjwwood commented Aug 23, 2016

Copy link
Copy Markdown
Contributor

It was just merged: ros/rosdistro#12469

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants