# Ramsete calculations

For ramsete, what does b and zeta do and how do i calculate them? Thanks!

1 Like

Thanks for the link, but what does those values change? Does b make the curve flatter?

``````b    Tuning parameter (b < 0) for which larger values make convergence more
aggressive like a proportional term.
zeta Tuning parameter (0 < zeta < 1) for which larger values provide more damping
in response.``````

Thanks for the explanation, but what is that impact on the actual movement of the robot?

m_zeta scales out the curve, making the robot change speed slower. i cant figure out how m_b works, but this is the direct code from wpilib:

``````public ChassisSpeeds calculate(Pose2d currentPose,
Pose2d poseRef,
double linearVelocityRefMeters,
m_poseError = poseRef.relativeTo(currentPose);

final double eX = m_poseError.getTranslation().getX();
final double eY = m_poseError.getTranslation().getY();
final double vRef = linearVelocityRefMeters;

double k = 2.0 * m_zeta * Math.sqrt(Math.pow(omegaRef, 2) + m_b * Math.pow(vRef, 2));

return new ChassisSpeeds(vRef * m_poseError.getRotation().getCos() + k * eX,
0.0,
omegaRef + k * eTheta + m_b * vRef * sinc(eTheta) * eY);
}``````
1 Like

These controller gains donâ€™t affect the actual velocity tracking happening; they only affect how the controller outputs. Honestly, for our team, we used the constants from WPILibâ€™s Ramsete example: https://github.com/wpilibsuite/allwpilib/blob/master/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ramsetecommand/Constants.java

``````    // Reasonable baseline values for a RAMSETE follower in units of meters and seconds
public static final double kRamseteB = 2;
public static final double kRamseteZeta = 0.7;
``````

And these worked out pretty well.

3 Likes

With the link, @Sumifairy, I was directing you towards
`Gains of 2.0 and 0.7 for b and zeta have been tested repeatedly to produce desirable results when all units were in meters.`
Or as @mustangtech mentioned, using the default constants should work.

Thanks for the replies! I have one question about their example trajectory that is supposed to go 3 meters â€śforwardâ€ť facing 0 degrees at the end but their start is (0,0) and end is (3,0). wonâ€™t this be going to the right instead of forward? Thanks!

Headings are measured according to mathematical convention - counterclockwise from the +x axis.

Thanks for the reply! So just to clarify, if i wanted to go forward i would change the X to positive values and side to side is a change in the Y. And then that if i wanted to face left, i would say 90, which would be facing the positive Y axis? This kinda makes sense since we just learned unit circle in trig. Thanks!

2 Likes

Yes, the standard is exactly the same as the unit circle youâ€™ve learned.

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.