flywheel ratchet code

Is there a way to simulate a ratchet in a flywheel through programming?

If you have v5, set the motors to coast and you shouldn’t need a ratchet.

Our v5 isn’t coming in until after this weekend’s competition, is there anyway to coast on v4? @briancole

As far as I know, there is not. You’ll have to use a ratchet or risk breaking your internal gears.

Actually, I take that back. You might be able to code the bot so that in the last five seconds of the match it slew controls the flywheel to a stop, preventing internals from stripping.

You could theoretically create code that decelerates the wheel over a period of time avoiding the motor spinning from the flywheel while not commaned to.

The whole point of a ratchet is to prevent the energy stored in the flywheel from being transferred back into the motors; this is impossible to do in software alone. As for coasting, you should be able to use


vex::motor.setStopping(mode);

where


mode

is a


vex::brakeType

, in this case


coast

.

The main situation that a ratchet helps with is when the robot goes into disable at the end of autonomous or at the end of a match. At this time, your code doesn’t run so no amount of coding can help you. The only way you can mitigate it is by making sure you decelerate your flywheel gently before the end of a match/autonomous which you probably don’t want to be doing when you just need 1 more point to win…

This does bring up an interesting question I haven’t seen documented. Let’s say you set the brake type to coast. Will it still coast when the robot is disabled? I bet @jpearman knows the answer to this. That would be an important consideration for use of ratchets or not with V5 motors.