Issue #16 resolved

RRTstar crashes when run on DubinsStateSpace

Luis Torres
created an issue

I directly took the GeometricCarPlanning.cpp demo, and made the following changes:

  • changed the planner to RRTstar
  • changed the minimum turning radius on the car to 2.0 (this bug has also occurred with rho=1.5)

I then ran the planner on the "easy" scenario with the Dubins state space. Quite frequently (although not always, due to randomness), the application crashes at line 384 of RRTstar.cpp, in the updateChildCosts() method. This is what the error looks like from GDB:

Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff5f3ffff8 0x00000001003827c1 in ompl::geometric::RRTstar::updateChildCosts (this=0x10200ae00, m=0x101c02240, delta=-1.7763568394002505e-15) at /Users/luis/code/ompl-0.12.1-Source/src/ompl/contrib/rrt_star/src/RRTstar.cpp:384 384 for (size_t i = 0; i < m->children.size(); ++i)

When I try to print a GDB backtrace from this line, it repeatedly and infinitely outputs this same function (updateChildCosts()), indicating that the function is infinitely recursing. This seems to indicate that there is a cycle in the RRT* graph.

Comments (4)

  1. Mark Moll

    Dubins distance is not a metric. The default nearest neighbor data structure that RRT* uses assumes a metric, so you need to change the nearest neighbor data structure type:

    ompl::geometric::RRTStar* rrtstar = new ompl::geometric::RRTStar(setup.getSpaceInformation());
    rrtstar->setNearestNeighbors<ompl::NearestNeighborsSqrtApprox>();
    setup.setPlanner(ompl::base::PlannerPtr(rrtstar));
    

    The reason you don't see the crash without your changes is that the default planner doesn't use a nearest neighbor structure.

    See also http://ompl.kavrakilab.org/blog/?p=18. Let me know if this fixes things.

  2. Luis Torres reporter

    I needed to use a different nearest neighbors structure, since DubinsStateSpace's distance function does not define a proper metric. I wonder if there would be a way to indicate within a StateSpace class whether its distance function defines a metric, so that if the wrong nearest neighbor structure is used, an exception could be raised.

  3. Mark Moll

    Yes, something like that would be good to have. Better yet, the default nearest neighbor data structure could be automatically selected to be compatible with the properties of the state space. Let me think about that. Thanks for the suggestion.

  4. Log in to comment