Hello,
I was following the WPILib state-space tutorial for flywheels, but I’m confused about the units the Spark MAX + NEO encoder returns and the units the Kalman filter correction takes.
Code from tutorial:
// Correct our Kalman filter's state vector estimate with encoder data.
m_loop.correct(VecBuilder.fill(m_encoder.getRate()));
I am unfamiliar with the encoderget.Rate(
) method. Is it comparable to sparkMAX.getEncoder().getVelocity]
? I believe the Spark MAX defaults to rev/s. What sort unit conversion do I need?
Modified code from Outtake.java
:
// Correct our Kalman filter's state vector estimate with encoder data.
m_loop.correct(
VecBuilder.fill(
flyWheelMotor
.getEncoder()
.getVelocity())); // .getRate() // TODO: What unit? This might be in rev/s