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
Fix bullet constructor not updating world objects #2830
Fix bullet constructor not updating world objects #2830
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2830 +/- ##
==========================================
+ Coverage 60.88% 60.94% +0.07%
==========================================
Files 368 373 +5
Lines 31715 31725 +10
==========================================
+ Hits 19306 19332 +26
+ Misses 12409 12393 -16
Continue to review full report at Codecov.
|
@v4hn I added the tests in the planning_scene folder as I believe they are related to the child scene collision environment not being correctly updated (when using Bullet). I created the same test for FCL as well. I verified that the test fails before this fix and passes after it. As I had to add the bullet dependency to the tests, I also replicated the FCL multithreaded test (as #2598 made Bullet thread-safe). |
RoboStack's Windows build cannot find bullet: -- Checking for module 'bullet'
-- No package 'bullet' found
-- Could NOT find Bullet: Found unsuitable version "", but required is at least "2.87" (found )
-- Version of Bullet too old or not available: disabling Bullet collision detection plugin. Try using Ubuntu 18.04 or later. Because of this BULLET_INC is not being set which leads to a build error: fatal error C1083: Cannot open include file: 'moveit/collision_detection_bullet/collision_detector_allocator_bullet.h': No such file or directory Any suggestions on how to proceed from here? |
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 Bullet code should be disregarded if Bullet was not found.
@@ -14,6 +14,7 @@ target_link_libraries(${MOVEIT_LIB_NAME} | |||
moveit_exceptions | |||
moveit_transforms | |||
moveit_collision_detection_fcl | |||
moveit_collision_detection_bullet |
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 lib shouldn't be added explicitly here as it is a plugin!
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.
If I remove it, the tests fail to compile as they cannot find the collision_detection::CollisionDetectorAllocatorBullet
definition. I thought it was ok to link bullet here as there is a link for fcl already, but I guess that this plugin wouldn't exist if Bullet was not available.
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 changed it (c7df778) to a conditional based on whether -DBULLET_ENABLE was defined or not.
if(BULLET_ENABLE)
set(BULLET_LIB moveit_collision_detection_bullet)
endif()
target_link_libraries(${MOVEIT_LIB_NAME}
moveit_robot_model
moveit_robot_state
moveit_exceptions
moveit_transforms
moveit_collision_detection_fcl
${BULLET_LIB}
moveit_kinematic_constraints
...
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.
Ideally, you would load the plugin via the plugin mechanism instead of instantiating it directly ;-)
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.
Got it!
#include <moveit/collision_detection_bullet/collision_detector_allocator_bullet.h> | ||
#include <moveit/collision_detection_bullet/collision_env_bullet.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.
These includes are not available when Bullet is not available. You need to conditionally include them!
My suggestion is to add add_definitions(-DBULLET_ENABLE) here and in c++ code use:
#ifdef BULLET_ENABLE
...
#endif
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.
Thank you for the suggestion! Added in 2433753
I will have a look into the remaining CI failure. Seems to be related to clang being used as the compiler... |
I ran industrial_ci locally and was able to fix it. I believe it was related to the compiler resetting the class_loader ptr first and then resetting the planning_scene ptrs (maybe trying to access the deleted BulletPlugin at destruction?). After explicitly setting the destruction order the segmentation fault disappeared (at least when running locally), Hopefully, it will pass now. |
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.
To avoid code duplication in tests, I provided https://github.com/makinarocks/moveit/pull/2 with more simplifications. However, this relies on #2834.
Otherwise, I approve.
@rhaschke as #2834 was merged, I cherry-picked the commits from https://github.com/makinarocks/moveit/pull/2 and rebased the branch on top of master. |
I pushed another commit to https://github.com/makinarocks/moveit/pull/2 to fix the |
Description
Bullet Collision Env's "copy constructor" does not update the manager with the copied world objects (by calling the notify function). This leads to an empty collision environment when planning a trajectory.
This is the constructor called in https://github.com/ros-planning/moveit/blob/master/moveit_core/planning_scene/src/planning_scene.cpp#L393-L397
which is used by the planning_scene_monitor to keep the move_group scene updated.
Checklist