What is a slew rate controller?

I’ve heard it everywhere but I don’t know what it is.

A slew rate controller is a controller in your code that in the long run keeps motors from tripping PTCs

It smooths the control input given to motors. Going from - 127 to 127 can be bad for every part of the system. So you limit the change to 25 motor power per 50 milliseconds

Instead of allowing the motor to go all the way to 127 right away, the slew rate controller brings you up in increments. This helps calm the current spikes down and not trip the PTC. Because the current spikes without the motor moving are what heats up the PTC so much. So the slew rate says you may want to go to 127 but I will get you there in steps.

As I was searching I found this one with all the handy links…

https://vexforum.com/t/slew-rate-code/37922/1

BLRS/SIGBots made a motor manager library for PROS. The library gives you slew rate, motor inversion, and also gives you the ability to recompute the commanded output speed, so you could to add a layer between the range -127,127] and actual value that’s sent to the motors - like a true speed computation. The library also allows you to bypass the slew rate if you should ever have a need to.


You can use the mtrmgr functions as a drop in replacement for the usual PROS


motorSet

functions - now you call


blrsMotorSet

.

The libblrs version has some slight modifications (mostly renaming functions), but the usage is essentially the same as my code from a couple years back if you want to see some example usage. There’s quite a bit of extra stuff going on, but if you ignore it and just focus on the MotorSet and MotorInit functions, you’ll get an idea of what’s going on: https://github.com/edjubuh/ose/blob/master/vulcan/Chassis.c#L156
https://github.com/edjubuh/ose/blob/master/vulcan/Chassis.c#L334

Edit: I went ahead and modified the clawbot tutorial code to use libmtrmgr as its published. Available at https://github.com/purduesigbots/libblrs/blob/master/libmtrmgr