Spark Max SmartVelocity Deceleration

My team has started working with Spark Maxes and NEOs this year, and, using the Spark Max PID Controller, I’ve run into the issue where, when going from maximum speed to 0 RPM (we’re using SmartVelocity control mode) the motors will come to a total stop, roll in the opposite direction by half a rotation or so, and then come to a complete stop. Is this normal Spark Max operation and is there a built in way to decelerate, rather than come to a jarring stop? Thanks!

1 Like

Instead of directing the motors to zero, provide a gradual slow down. If this is while driving on joysticks, check the examples for “voltage ramping”; here you’re doing it for the opposite of the usual reason, but it’ll also work here.

1 Like

I’m not completely familiar with smart velocity mode, but this sounds symptomatic of a poorly tuned PID loop. What P, I, and D values are you using? Can you post your code?

I don’t have the code on me right now (forgot to push to GitHub, sadly), but I believe the parameters are P=0.000001, I=1e-6 (I honestly don’t know what that one means, but it’s the Spark Max example code standard), and D=0.

SmartVelocity includes a max acceleration parameter. Between that and coast mode you can force the flywheel to take forever to spin down.

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