Closed medvedevigorek closed 8 months ago
Looking more into what could be the cause for such behavior it comes down to SimpleSetup::print()
that's invoked in postSolve()
. Apparently this print()
method performs sanity checks and collects some various stats by sampling states and sampling time varies for different state spaces.
For example, with path constraints by default a PoseModel
state space is used which shows slow sampling rate with sampleGaussian()
method (it may be even not used during the actual planning but it is part of OMPL sanity checks). With the rate being 30 samples per second and 1000 samples to process it takes about 35 seconds.
[moveit_cpp_tutorial-4] [INFO] [1702596675.825390391] [moveit.ompl_planning.model_based_planning_context]: Properties of the state space 'panda_arm_PoseModel'
[moveit_cpp_tutorial-4] - signature: 2 0 7
[moveit_cpp_tutorial-4] - dimension: 7
[moveit_cpp_tutorial-4] - extent: 18.8913
[moveit_cpp_tutorial-4] - sanity checks for state space passed
[moveit_cpp_tutorial-4] - probability of valid states: 1
[moveit_cpp_tutorial-4] - average length of a valid motion: 0.176752
[moveit_cpp_tutorial-4] - average number of samples drawn per second: sampleUniform()=14542.7 sampleUniformNear()=15112.2 sampleGaussian()=29.1753
The call to SimpleSetup::print()
was added by #1330 and while it's useful to get some insights of OMPL for debugging and verification purposes it might be less useful for production deployments.
I can certify that I've seen this behavior in Humble as well. Here are a couple of pointers from when I was looking into this:
allowed_planning_time
. Since we moved away from 2+ path constraints, I stopped looking into what is causing the bug, but I can certify that it was there in ROS2 Humble as well.We just migrated from MoveIt1 to MoveIt2 and the same planning with 2+ path constraints worked fine in case of Moveit1 and became extremely slow with Moveit2. So we kind of knew that planning can be fast as we looked into planning optimizations back in Moveit1 so it was clearly something new in Moveit2.
Unfortunately for us, every arm motion is either not constrained at all or constrained on both position and orientation of the end effector. So we had no choice but find the cause.
The fix has been merged into main branch. Closing the issue. Thx.
Description
PlanningComponent::plan()
method may takes tens of seconds to complete while the motion plan request hasplanning_time
set to smaller value than actual execution time. This seems to be happening only in presence of multiple path constraints, with no path constraints the execution time is within theplanning_time
.Your environment
Steps to reproduce
The issue is reproducible by having 2 or more path constraints defined. We initially noticed such behavior in our application and could easily reproduce it by modifying
MoveItCpp
example by including path constraints into one of the planning requests.Expected behaviour
If
planning_time
is set thenplan()
method shouldn't take more defined planning time.Actual behaviour
The execution of
plan()
method may take tens of seconds. We observed up to 50-60 seconds.Backtrace or Console output