Our flywheel motor is a Neo run by a SparkMax. Currently the motor only operates in brake mode, but we want to change it to coast mode.We tried changing the mode using the mode button on the SparkMax and also configured it in the Rev Client to be in coast mode. The status light on the SparkMax is blinking magenta, which I thought indicated it was in coast mode, but it keeps braking. Is there something else that is overriding the configuration and forcing it to brake?
Have you tried factory resetting the SparkMax and then setting it to Coast mode?
I had issues with this early in the build season and found that by factory resetting the controller through the Client, it made the motor actually coast.
Edit: I’ve also reached out to REV about this
If it is blinking magenta it is in coast. Are you running closed loop on the flywheel? If so, is it possible that the controller is demanding a negative value or not actually going into coast? If this is the case, one thing you could do is set the min output to 0 and max output to 1 such that the controller is never outputting negative. Or, when coasting, simply setting the output to 0 open loop.
I do have a closed loop set up and starting to think it is the cause. But I tried your first suggestion (setting min to 0) and there was no noticeable change. I’m not sure how to try your other suggestion though. Where would I set the output to be 0 when coasting?
Yep, tried resetting a few times and it doesn’t seem to help. I’m thinking now it might be the closed loop we have set (as suggested by Will below).
Instead of saying
pid.setReference(0, ControlType.kVelocity) you could run
pid.setReference(0, ControlType.kDutyCycle however I would expect both to command 0 output. One way you can tell if it is actually outputting 0 is to plot the actual value set to the motor by plotting
motor.getAppliedOutput(), having this on a plot with the velocity would be a good way to debug.
Thanks for the advice! I won’t be able to try it until later today, but I’ll definitely try these suggestions then. I was wondering if it may have something to do with the feedforward value? I left it at the default .000015.
I wouldn’t expect the feedforward value to have any impact. At a setpoint of 0, the feedforward component will simply kFF * 0 = 0.
Yes, but if you are using velocity control and the wheel is still spinning and you send it a 0 velocity request, the P term will jump in and try to force the wheel to stop, won’t it? This would look like brake mode, even though it isn’t.
We addressed this (on different motors) by switching into duty cycle to allow the wheels to coast down, as you suggested earlier in the thread.
Yes this is true, my thought here is if you set the min output to 0, the P term will saturate at 0 until the wheel comes to a stop.
Using DutyCycle seems to have worked, it’s coasting now. Thanks again for the help!