Skip to content
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

Add nonlinear part to obstacle cost to improve narrow gap #140

Conversation

howardcochran
Copy link

This solves a major problem when the robot is faced with a narrow gap
that the global planner wants to traverse. The previous straight-line
obstacle cost function does not work well when there is a sufficiently
close obstacle on the left and right that the straight lines overlap.

The sum of two straight lines with opposite slope is a horizontal line,
which has zero derivative. Thus, there is no net force from obstacles
pushing poses to the center of the gap. So other slopes in the
optimization graph tend to pull these poses onto an obstacle, causing the
planned trajectory to be rejected, resetting the planner from the global
plan. We can stay in an endless loop in this case.

Reducing the obstacle weight helps a little bit in this case because the
solver becomes more stable. However, this makes it hard to avoid turning
a corner of a non-round robot into a nearby obstacle because the
gentle straight line slope of the obstacle cost is insufficient to
overcome other forces.

The new solution is to add a nonlinear cost component that will:

  1. Make the minimum cost point between left & right obstacles be
    in the middle.

  2. Drive the cost very high as distance to obstacle aproaches zero. This
    helps prevent us from turning a corner into an obstacle. Instead,
    the solver will typically pull forward or backward in a slight
    turn until clear enough to turn the desired direction, much like a
    human driver would.

The new parameter, obstacle_cost_exponent, controls how nonlinear
the obstacle error function will be. The default is 1.0 which preserves
existing behavior. I have found that setting the exponent to 4.0 and
increasing weight_obstacle to 100 (from 10) leads to excellent
narrow gap performance on our robot.

This solves the following open issues:
#28
#16

This solves a major problem when the robot is faced with a narrow gap
that the global planner wants to traverse. The previous straight-line
obstacle cost function does not work well when there is a sufficiently
close obstacle on the left and right that the straight lines overlap.

The sum of two straight lines with opposite slope is a horizontal line,
which has zero derivative. Thus, there is no net force from obstacles
pushing poses to the center of the gap. So other slopes in the
optimization graph tend to pull these poses onto an obstacle, causing the
planned trajectory to be rejected, resetting the planner from the global
plan. We can stay in an endless loop in this case.

Reducing the obstacle weight helps a little bit in this case because the
solver becomes more stable. However, this makes it hard to avoid turning
a corner of a non-round robot into a nearby obstacle because the
gentle straight line slope of the obstacle cost is insufficient to
overcome other forces.

The new solution is to add a nonlinear cost component that will:
1. Make the minimum cost point between left & right obstacles be
in the middle.

2. Drive the cost very high as distance to obstacle aproaches zero. This
helps prevent us from turning a corner into an obstacle. Instead,
the solver will typically pull forward or backward in a slight
turn until clear enough to turn the desired direction, much like a
human driver would.
@croesmann
Copy link
Member

Thanks a lot for all the PRs :). I'll review them in a few days.

@croesmann
Copy link
Member

Thanks for this PR. I reviewed the code and did some tests in simulation. We can merge this now and it's good to be deactivated by default in kinetic to not break any existing configurations.

@croesmann croesmann merged commit 70382cb into rst-tu-dortmund:kinetic-devel Jun 18, 2019
croesmann added a commit that referenced this pull request Jul 3, 2019
@howardcochran howardcochran deleted the improve-handling-of-narrow-gaps branch November 26, 2019 21:11
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants