VEX Robotics Wiki

Covering VEX IQ, VEX EDR, and VEX Pro

User Tools

Site Tools


programming:controls_algorithms:slew_rate

Slew Rate

Motor Overload

Please read the article describing VEX motor circuit breakers (Motor Overload, called PTCs, before reading this article.

When a robot's program turns on a motor from a standstill up to full power (e.g., in autonomous, or via a joystick button), a large spike of current is travelling to the motor to try to make that happen all at once.

VEX DC motor, inside a 393 motorAs described in the Motor Overload article, a VEX motor's circuit breaker is a combination thermostat-and-resistor called a PTC (Positive Temperature Coefficient) component—the yellow tab in the photo at right.1) Current flows through it on the way to the motor, and heats the PTC as it does. If the PTC heats up faster than it can shed heat, its resistance increases, which in turn causes more heating. This creates a vicious cycle until no current gets through to the motor and it just stops.2)

Once the PTC trips, the motor won't work until it cools sufficiently. And it takes a loooong time to cool enough to get back up to full capacity (1 hour+, according to the tests performed by VEX Forum user @jpearman). What this means for competition robots is that everything possible should be done to avoid tripping them.

So, how to do that?

Use a Slew Rate Controller in Your Programming

Torque vs. Current DrawTo turn motors to turn on at full power (or if they are under heavy load), the robot's programming can be modified so that instead of just setting, say, motor5 = 127 power, the motor goes from 0 to 127 power in measured increments so that the current flowing through the PTC is nice and steady, and does not create any spikes. The current increasing quickly without the motor moving is what's the killer here, and what one is trying to avoid (the upper-right area on the graph3)). This programming method, called “slew rate,” also happens to be gentler on the motor's internal gears, so some better performance and maybe some longer life should be seen as well.

In the “while you're at it” category, this slew rate controller doesn't need to be limited in its use to only when a motor is going from 0 to 127 power; it can be used for all motor instructions, both in autonomous and driver-control. This functionality gets set up in the program as user functions with a repeating timer (easyC) or as a background task (RobotC), so once it's set up, its not really any extra work to use it instead of a standard motor block all over the place.

The VEX Forum user @jpearman has graciously written and posted code/instructions for how to do this in easyC, starting at the 7th or 8th comment down the page. All of the code is available to read and download in the post; a zip file download is not needed.

@jpearman also has RobotC code thoroughly explained, with a file available to download at the bottom of the post. The VEXMEN team then has a helpful explanation on their website on exactly how to implement jpearman's RobotC code into a competition program.

It's Not Magic

For all of its benefits, the slew rate controller is not magic. It cannot make up for an inferior robot design, or a great design that is underpowered. VEX motors are limited, and no amount of programming will make them give more than they've got. This slew rate controller WILL, however, help a team get the most out they can from their VEX motors.

A Note to Novice Teams

For novice teams, adding this functionality does mean that their programming group will have to spend a good bit of time on this and will probably need some mentor assistance. However, it will be well worth it if the robot doesn't stall in the middle of matches! Once a team gets this working, it can be re-used indefinitely in seasons to come. The team's programmers will be taking the next (giant) step beyond dragging-and-dropping motor modules and joystick blocks.

programming/controls_algorithms/slew_rate.txt · Last modified: 2017/06/14 06:37 (external edit)