Giter Site home page Giter Site logo

Comments (7)

ryanluna avatar ryanluna commented on June 14, 2024

The ConstrainedGoalSampler will only attempt to sample a finite number of states (default is 1000) before declaring failure. This parameter is stored in the PlanningContext, a MoveIt concept, not an OMPL concept. If every goal state is invalid, the goal sampler stops sampling and RRTConnect quits early because there is no root for the goal tree.

Since no valid goal states are sampled, I suspect a problem with how you construct your goal constraints.

from moveit_planners.

arjungm avatar arjungm commented on June 14, 2024

Thanks for your comment! That explains why it only tries 1000 calls to IK.

I thought my goal pose was incorrect at first, but I derived the 6DOF goal pose from a collision-free set of joint positions in the planning scene (just moving arms around with interactive markers).

It bears some investigation if there's a mismatch in the goal pose it is trying to solve an IK for in the Goal Sampling Thread, and the goal pose I grabbed from the scene. I will try this out, and report back!

from moveit_planners.

arjungm avatar arjungm commented on June 14, 2024

Alright so I managed to figure out why I wasn't able to find an IK for a pose that should most definitely have a solution.

In the goal sampling thread, an outer loop iterates 1000 times (default) calling constraint_samplers::ConstrainedSampler::project.

The method resolves to constraint_samplers::IKConstraintSampler::project.

This calls IKConstraintSampler::sampleHelper with the project argument as true.

Then in the method, it loops 4 times (default) and calls IKConstraintSampler::callIK each time. Note the last argument is (project && a==0).

This means IKConstraintSampler::callIK is called with the use_as_seed argument as true the first inner iteration, and then false for the remaining attempts in loop in IKConstraintSampler::sampleHelper.

Inside IKConstraintSampler::callIK, it checks if there is a StateValidityCallback available. If so, it runs inverse kinematics with the callback. If not, it runs IK without checking for collisions, Line 564.

Because adapted_ik_validity_callback is not available, then the search for IK is done and a solution is found (possibly in collision). Because use_as_seed is true, it uses the passed in state as a seed.

Then it saves the solution back into the state passed in as a seed. This state is a reference to workstate from before.

Then it always returns true back to IKConstraintSampler::sampleHelper which then exits out of the inner loop immediately and returns true back to the outer loop in ConstrainedGoalSampler::sampleUsingConstraintSampler.

From here it checks for collisions.

If the collision check fails, it loops for another attempt and passes the workstate that is initialized to the previous IK solution (which is in collision) to IKConstrainstSampler::callIK as the seed because project && a==0 is true for the first inner attempt.

callIK returns the same solution as before, leading to a cycle that exhausts all 1000 attempts, and it never uses a randomized state because each callIK succeeded ( a solution was found ).

I attempted a fix for this issue and found that it let's RRTConnect succeed in planning to positions that are kind of cramped, where as before it would just declare failure to find an IK.

Pull requests incoming.

from moveit_planners.

arjungm avatar arjungm commented on June 14, 2024

Here's the pull requests that should fix it:

Adds a bool flag that forces random seed to ConstrainedSampler::project and its derived classes
ros-planning/moveit_core#188

Makes use of above bool flag, after failing to sample a goal once
#46

from moveit_planners.

davetcoleman avatar davetcoleman commented on June 14, 2024

Great write up! I'm trying to understand your issue, see comments in first PR.

from moveit_planners.

arjungm avatar arjungm commented on June 14, 2024

In this most recent pull request, you don't need to change the moveit_core classes for constraint samplers.

Instead, by setting the validity callback function means that randomization of the seed will be taken care of by IKConstraintSampler if it fails to find a valid IK.

Line 525 the call to IK is made. a==0 so the current state is used as a seed.
Line 564 the searchPositionIK uses the validity callback because it is set.

If the state it finds is invalid, it will correctly return false. Then it will loop again to Line 525 and now a!=0 so the use_as_seed flag is now false. This triggers a random seed for the remaining iterations.

from moveit_planners.

mikeferguson avatar mikeferguson commented on June 14, 2024

looks like this was fixed

from moveit_planners.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.