-
Notifications
You must be signed in to change notification settings - Fork 946
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
Addition of CHOMP planning adapter for optimizing result of other planners #1012
Addition of CHOMP planning adapter for optimizing result of other planners #1012
Conversation
Hi @davetcoleman @mamoll this PR is ready for review. |
@@ -129,6 +132,11 @@ class ChompTrajectory | |||
*/ | |||
void fillInCubicInterpolation(); | |||
|
|||
/** | |||
* \brief receives the path obtained from OMPL and puts it into the appropriate trajectory format required for CHOMP |
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.
Is MotionPlanDetailedResponse really OMPL-specific or can the trajectory be produced by other planners? If it's not OMPL-specific, then rename this to initializeWithTrajectory
or something like that.
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.
actually trajectory from STOMP can also be made to work with MotionPlanDetailedResponse
as in here . I can possibly change it to initializeWithTrajectory
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.
done ! replaced function name with fillInFromTrajectory()
int num_joints_trajectory = trajectory_msgs.joint_trajectory.points[0].positions.size(); | ||
|
||
// variables for populating the CHOMP trajectory with correct number of trajectory points | ||
int repeated_factor = num_chomp_trajectory_points / num_response_points; |
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 be 0 if num_response_points>num_chomp_trajectory_points
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 you are correct, I will write another way of setting of the trajectory whenever num_response>num_chomp_trajectory_points. For chomp there are generally 100 points and OMPL produces less than 100 points almost always, but I get it, I will implement another way of loading of trajectory for num_response_points > chomp_trajectory_points
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.
done! implemented a simple decimation down sampling of the input trajectory to address 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.
per @mamoll, you should add error checking and return false if the input trajectory_msgs has no points
res.trajectory_ = res_detailed.trajectory_[0]; | ||
res.planning_time_ = res_detailed.processing_time_[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.
If the initial trajectory is valid, but CHOMP makes it invalid, does the planning adaptor return the initial trajectory?
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, it should as per this block, if planning_success
from CHOMP is false
, then the res MotionPlanDetailedResponse
object is never changed from CHOMP and should stay the same as obtained from OMPL as this is the only place where the response trajectory is changed in the chomp_optimizer_adapter.cpp apart from being set initially here in the OMPL planner.
* checker for a constant planning scene whenever required, e.g., for some planners like CHOMP | ||
*/ | ||
const void | ||
addCollisionDetector_ConstVersion(const collision_detection::CollisionDetectorAllocatorPtr& allocator) const; |
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 _
underscore in function name
Also remove "Version" from function name
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.
sure will do
@@ -246,6 +246,14 @@ class PlanningScene : private boost::noncopyable, public std::enable_shared_from | |||
* */ | |||
void addCollisionDetector(const collision_detection::CollisionDetectorAllocatorPtr& allocator); | |||
|
|||
/** \brief Add a new collision detector type. | |||
* | |||
* this is the constant version of the function addCollisionDetector(), it is added here for changing the collision |
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.
Capitalize "this" at start of sentence here and below
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.
done
moveit_core/planning_scene/include/moveit/planning_scene/planning_scene.h
Show resolved
Hide resolved
* this is the constant version of the function setActiveCollisionDetector(), it is added here for setting the | ||
* collision checker for a constant planning scene whenever required, e.g., for some planners like CHOMP | ||
*/ | ||
const void setActiveCollisionDetector_ConstVersion( |
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 _
underscore in function name
Also remove "Version" from function name
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.
done
* name of a collision detector that has been previously added with | ||
* addCollisionDetector_ConstVersion(). | ||
*/ | ||
const bool setActiveCollisionDetector_ConstVersion(const std::string& collision_detector_name) const; |
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 _
underscore in function name
Also remove "Version" from function name
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.
done
|
||
virtual std::string getDescription() const | ||
{ | ||
return "CHOMP Optimizer !!!!"; |
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.
more professional (no !)
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.
oh yeah sure !! removed.
// populate the trajectory to pass to CHOMPPlanner::solve() method. Obtain trajectory from OMPL's | ||
// planning_interface::MotionPlanResponse object and put / populate it in the | ||
// moveit_msgs::MotionPlanDetailedResponse object | ||
moveit_msgs::RobotTrajectory trajectory_msgs2; |
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.
better variable name than "2"
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.
changed to trajectory_msg_from_response
|
||
chomp::ChompPlanner chompPlanner; | ||
planning_interface::MotionPlanDetailedResponse res_detailed; | ||
moveit_msgs::MotionPlanDetailedResponse res2; |
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.
better var name than 2
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.
changed to res_detailed_moveit_msgs
|
||
bool planning_success; | ||
|
||
bool temp = chompPlanner.solve(planning_scene, req, params_, res2); |
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.
you don't need temp
and planning_success
, combine them
@@ -34,5 +34,10 @@ | |||
<description> | |||
</description> | |||
</class> | |||
|
|||
<class name="default_planner_request_adapters/CHOMPOptimizerAdapter" type="default_planner_request_adapters::CHOMPOptimizerAdapter" base_class_type="planning_request_adapter::PlanningRequestAdapter"> |
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.
add line break instead of word wrap usage
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.
all others classes/plugins in the planning_request_adapters_plugin_description.xml
file also had a word wrap usage and not a line break, so I kept this as word wrap for now. I can change everything to line break, but I think it should be word wrap for all (I maybe wrong).
098c130
to
6df219b
Compare
is this ready for review again? |
yes |
👍 looks good to me. |
3e59acb
to
8419c39
Compare
8419c39
to
85262e8
Compare
travis failed, i just restarted it |
it still failed after you restarted, I just committed a a sample dot, to restart travis to double check, last time something similar happened to another of my PRs in moveit_tutorials, I just made a sample commit and it passed..lets see this time |
Ok so now travis passes which is good but weird, maybe my guess is when its only restarted it might be picking up some form of CMakeCache file but when a commit is made it restarts from scratch, I don't exactly know travis functionality so I may be wrong here. |
Travis failed:
I'm guessing you are missing a dependency on chomp_motion_planner in moveit_ros_planning |
…ges in planning_scene.h / .cpp files to make this work
…truction but works fine right now
…ajectory has more points than CHOMP trajectory points
…omp_initialization from trajectory simpler, now has if, for, for
309e845
to
1c24027
Compare
resolved merge conflicts by re-basing the PR and Travis passes currently |
As a note for others: This merged PR currently breaks kinetic-devel. There is a fix available (#1086), waiting for approval and merge. |
strange, why did this compile here? Shouldn't it have failed due to the missing package.xml entry here as well as it does in kinetic-devel (and on our internal build server) |
Probably, it was simply build-order luck that it compiled here. |
Fixing issues introduced by #1012.
…nners (moveit#1012) * added functionality for CHOMP Optimization Adapter and made some changes in planning_scene.h / .cpp files to make this work * added functionality for optimizing path obtained from OMPL, under construction but works fine right now * added functionality to initialize trajectories in CHOMP when input trajectory has more points than CHOMP trajectory points * hotfix moveit#1086
The way travis function sometimes confuses me, I wonder if there is a tutorial on its functionality somewhere online . . Sorry for temporarily breaking kinetic-devel , my bad ; In my defense, I was blindly dependent on travis results to ensure clean builds . . |
This wasn't your fault. It's our task as maintainers to actually ensure that nothing breaks. |
I don't think this is related to travis ... I remember seeing warnings/errors about cases like this some time ago, was that check pre catkin tools? |
thanks @rhaschke ; @simonschmeisser On these lines I have a small quick question, do you know a way to ensure that certain packages are built in a specific order, in this case how would you ensure chomp_planner package is built before some of its other packages on which it might depend (here =Planning_request_adapters package)... I am asking this as I observed this in my code while I was creating the STOMP planning adapter in my PR #1081 , which involved stomp_moveit package to be built before the planning_adapters is complied/built... I was getting a similar issue, I kind of pseudo hacked it on my local machine to install stomp_moveit and then reinstall moveit so that Planning adapters reads that package... but is there a concrete legit way to handle these order of builds in catkin... |
Or is releasing as a debian only the way |
no, having a dependency (stomp_moveit) in in package.xml (of planning_adapters) should ensure that stomp_moveit gets build before planning_adapters |
oh Yes you are right, thanks 👍 I did not do that, will do that |
Note that the right thing to do would be to move the adapter to it's own package in one of the chomp sub-directories to a) resolve this dependency inversion b) make it possible to CATKIN_IGNORE chomp completely and c) make it possible to release MoveIt! without it |
find_package(Boost REQUIRED) | ||
|
||
include_directories( | ||
../../../moveit_planners/chomp/chomp_motion_planner/include/ |
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 if I missed any discussion, but is relative path a good way to find resource?
I'm afraid using relative path of another package would limit the portability of a package.
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 guess with the suggestion in #1012 (comment) we'll be able to replace this hardcoded relative path with auto-substituted path.
…nners (moveit#1012) * added funcitonality for CHOMP Optimization Adapter and made some changes in planning_scene.h / .cpp files to make this work * added comments and cleaned up some code * added funcitonality for optimizing path obtained from OMPL, underconstruction but works fine right now * did some commenting and cleaning up of code * cleaned up some code and added comments * corrected my previous public/private small bug in planning_scene.h * changed CHOMP Parameter name to make more sense trajectory_initialization_method * added functionality to initialize trajectories in CHOMP when input trajectory has more points than CHOMP trajectory points * changed author for chomp_optimizer_adapter.cpp * addressed Dave's PR requested changes * addressed PR requested changes added a new helper function to make chomp_initialization from trajectory simpler, now has if, for, for * changed OMPL to fillTrajectory as the parameter value * just a dot * added chomp_motion_planner dependency in moveit_ros_planning
Addition of CHOMP planning adapter to act as an additional optimizer for other planners like OMPL
This PR is a work done by Raghavender as a part of 2018 Google summer of code. As a part of this PR, CHOMP planning adapter works and can be used as an additional optimization technique in combination with other motion planners like OMPL.
With this PR, CHOMP can act as a post-processor for other planners. one simply needs to add a line in their ompl_planning_pipeline.yaml file if they want to use this. Just add this line in your planning_adapter= >
default_planner_request_adapters/CHOMPOptimizerAdapter
to add CHOMP a an additional post-processing optimizer.Corresponding Tutorials PR available here!
Checklist