Open
Description
Under certain conditions, an exponential profile with a constant goal can produce oscillations that prevent it from finishing the profile. The graph below shows the position setpoint for one such profile.

This behavior appears to be extremely sensitive to the initial inputs. The example below produces the issue consistently, but changing the goal velocity to 2.99999
or 3.00001
fixes the issue. It's not clear whether this might be related to using a nonzero goal velocity given how sensitive it is to the exact values.
ExponentialProfile profile = new ExponentialProfile(
ExponentialProfile.Constraints.fromStateSpace(206.18996798292426, -4.0508214770151705, 0.07795421563066239));
ExponentialProfile.State state = new ExponentialProfile.State(0.1, 0.0);
ExponentialProfile.State goal = new ExponentialProfile.State(1.75, 3);
@Override
public void robotPeriodic() {
SmartDashboard.putNumber("Position", state.position);
SmartDashboard.putNumber("Velocity", state.velocity);
}
@Override
public void teleopPeriodic() {
state = profile.calculate(0.02, state, goal);
}
This log includes the positions and velocities of the setpoints for the example above: exponentialprofilebug.wpilog.zip
Desktop (please complete the following information):
- OS: macOS 15.2
- Project Information:
WPILib Information:
Project Version: 2025.2.1
VS Code Version: 1.96.4
WPILib Extension Version: 2025.2.1
C++ Extension Version: 1.23.2
Java Extension Version: 1.38.0
Java Debug Extension Version: 0.58.1
Java Dependencies Extension Version 0.24.1
Java Version: 17
Java Location: /Users/jonah/wpilib/2025/jdk
Vendor Libraries: