RobotCasserole1736 / RobotCasserole2025SwerveBase

MIT License
2 stars 0 forks source link

Add curvature limit to planner #7

Open gerth2 opened 1 month ago

gerth2 commented 1 month ago

Currently, while navigating down local minima "troughs", the path planner will zig-zag across the gradient line.

It would be better if we smoothed these out. I propose to do that by imposing a maximum curvature - basically, given a certain direction of travel (from the current command), there is a maximum change in the angle of that direction of travel - the next-step logic needs to enforce this by not picking a next goal location which is at too great of an angle.

gerth2 commented 1 month ago

Note: If this doesn't pan out... there is another more computationally-intensive option - basically, detect the rapid change in angle, and then take smaller steps until the oscillation subsides.

Detecting this is hard (maybe need to look for a zero crossing in the derivative of the force 😬 ?). Taking the smaller steps to find the real minima is potentially unbounded... and fraught, depending on how small our local minima end up being.

gerth2 commented 1 month ago

From a coding perspective, and from an algorithm perspective (might be a good @schmile question), I think the smaller steps is probably the way to go.

Basically: 1) At each step, use a for loop (with max iter) to take a fraction of a step 2) Check if the result of taking that step has moved us at least one full step size away from the starting point 3) repeat with another fraction of a step 4) Report "stuck" if after max iterations we're done.

The big thing is that this will get kinda computationally intensive with lots of obstacles on the field

schmile commented 1 month ago

I think that is always the compromise and we would have to see if there is a way to plan "as much as possible"

On Wed, Oct 2, 2024 at 2:47 PM Chris Gerth @.***> wrote:

From a coding perspective, and from an algorithm perspective (might be a good @schmile https://github.com/schmile question), I think the smaller steps is probably the way to go.

Basically:

  1. At each step, use a for loop (with max iter) to take a fraction of a step
  2. Check if the result of taking that step has moved us at least one full step size away from the starting point
  3. repeat with another fraction of a step
  4. Report "stuck" if after max iterations we're done.

The big thing is that this will get kinda computationally intensive with lots of obstacles on the field

— Reply to this email directly, view it on GitHub https://github.com/RobotCasserole1736/RobotCasserole2025SwerveBase/issues/7#issuecomment-2389548760, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF63G66RQCJI7JHYSM3ZJ7TZZRET7AVCNFSM6AAAAABPGDHM6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBZGU2DQNZWGA . You are receiving this because you were mentioned.Message ID: <RobotCasserole1736/RobotCasserole2025SwerveBase/issues/7/2389548760@ github.com>