FRC2706 / FRC2706/2017-2706-Robot-Code

Deceleration curve for approaching target distance?

Open
#27 7 comments 0 reactions 2 assignees Claimed by @cnnradams View on GitHub
Dominant language
Java
Stars
3
Forks
3
PR merge metrics
No merged PRs in 30d

Description

We've been playing with different ways to solve the problem of "drive smoothly and quickly to a distance X away from the wall".

What about applying a simple deceleration factor with a curve?

Consider a DriveWithDecelerationCurve command:

The operator is driving at a set speed forward (e.g. 70%).

inputSpeed = 0.7

Measure the distance from the wall. Compare it to some threshold we can set (say, 1 meter). If we're nowhere near the wall, allow the motors to go at the full commanded speed.

If distance > Threshold
outputSpeed = inputSpeed

If the distance is less than the threshold then start comparing the distance to the target and scale the input speed using a curve. For example:

outputSpeed = inputSpeed * (1 / distance)

or

outputSpeed = inputSpeed * (1 - (1 / distance) )

So the closer and closer we get to the target distance the more and more we slow down the target speed.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.