Exponential Profiles
What is a Motion Profile?
A motion profile is a trajectory that defines how a mechanism should move from one position to another over time. Instead of commanding a mechanism to instantly jump to a target position (which would require infinite acceleration), motion profiles generate a smooth path that respects the physical limitations of your system.
Motion profiles output a series of intermediate setpoints (position and velocity) that your closed-loop controller tracks. This results in:
Predictable motion - You know exactly how long a movement will take
Smooth transitions - No jerky movements that stress mechanical components
Controlled acceleration - Prevents excessive current draw and brownouts
Trapezoidal vs Exponential Profiles
Trapezoidal Profiles
Trapezoidal profiles are the most common type. The name comes from the trapezoidal shape of the velocity-time graph.
Velocity
^
| ___________
| / \
| / \
| / \
| / \
|_/___________________\____> TimeKey characteristics:
Constant acceleration until max velocity is reached
Cruise at max velocity (if distance is long enough)
Constant deceleration to stop at target
Assumes unlimited torque during acceleration phases
When trapezoidal profiles struggle:
When a disturbance knocks the mechanism off the profile
When the motor cannot actually provide the commanded acceleration
When current limiting reduces available torque
Exponential Profiles
Exponential profiles model how DC motors actually behave. Instead of assuming constant acceleration, they account for the motor's torque-speed curve and the system's physical dynamics.
Key characteristics:
Acceleration naturally decreases as velocity increases (following motor physics)
Uses motor kV (velocity constant) and kA (acceleration constant) to model behavior
More accurately represents what the motor can actually achieve
Better disturbance rejection
Exponential profiles are named for the exponential approach to maximum velocity, which mirrors the natural response of a first-order system like a DC motor.
The Physics Behind Exponential Profiles
DC motors produce torque proportional to current. However, as the motor spins faster, back-EMF reduces the effective voltage across the windings, which reduces current and therefore torque.
The relationship is:
V=kS+kV⋅ω+kA⋅α
Where:
V = Applied voltage
kS = Static friction voltage (voltage to overcome stiction)
kV = Velocity constant (volts per unit velocity)
kA = Acceleration constant (volts per unit acceleration)
ω = Angular velocity
α = Angular acceleration
Rearranging for acceleration:
α=kAV−kS−kV⋅ω
This shows that as velocity (ω) increases, the available acceleration (α) decreases. This is the fundamental insight that exponential profiles capture.
When to Use Each Profile Type
Motor is always current-limited
Trapezoidal
Current limiting makes torque roughly constant regardless of speed
Motor is never current-limited
Exponential
Motor follows natural torque-speed curve
Heavy mechanism with adequate motor
Exponential
Gravity/friction dominate, exponential handles disturbances better
Lightweight mechanism
Either
Both work well when inertia is low
Mechanism with significant disturbances
Exponential
Better recovery when knocked off profile
Precise timing required
Trapezoidal
Deterministic duration calculation
Rule of thumb: If your mechanism works well with trapezoidal profiles, keep using them. Switch to exponential profiles when you encounter disturbance rejection issues or when you want the profile to better match your motor's capabilities.
Exponential Profiles in YAMS
YAMS provides ExponentialProfilePIDController which combines an exponential motion profile with a PID controller. This replaces ProfiledPIDController (which uses trapezoidal profiles) or PIDController (which has no profiling).
Creating Constraints
YAMS provides factory methods to create exponential profile constraints for common mechanism types:
For Elevators
For Arms
For Flywheels
Custom Constraints
If the factory methods don't fit your use case, you can create constraints directly:
Using with SmartMotorControllerConfig
Tuning Exponential Profiles
Step 1: Characterize Your System
The exponential profile needs accurate kV and kA values. You have two options:
Use the factory methods - They calculate kV and kA from motor specs and mechanism parameters
Run SysId - Get experimental values from your actual mechanism
Factory methods use theoretical values. Real mechanisms have friction, cable drag, and other losses. SysId values are more accurate but require testing.
Step 2: Set Maximum Voltage
The maximum voltage determines how aggressively the profile will command the mechanism. Consider:
12V - Full battery voltage, most aggressive
10V - Leaves headroom for PID corrections
8V - Conservative, good for testing
Step 3: Tune PID Gains
With exponential profiles, the feedforward does most of the work. The PID handles:
kP - Corrects position error. Start low (1-5) and increase until responsive
kI - Usually not needed with good feedforward. Use only if steady-state error persists
kD - Dampens oscillations. Add if mechanism oscillates around target
Step 4: Add Feedforward
Even with exponential profiles, you still need feedforward for:
Gravity compensation (arms, elevators) - The profile doesn't know about gravity
Friction compensation (kS) - Helps overcome stiction
When using exponential profiles, the profile itself handles the velocity and acceleration feedforward. You typically only need kS (static friction) and kG (gravity) in your feedforward object.
Motor Controller Support
TalonFX (Kraken, Falcon)
On-device (Motion Magic)
On-device (Motion Magic Expo)
Best performance
TalonFXS
On-device (Motion Magic)
On-device (Motion Magic Expo)
Best performance
SparkMax/SparkFlex
On-device (MAXMotion)
RoboRIO
Exponential runs on RoboRIO
Nova
RoboRIO
RoboRIO
All profiles run on RoboRIO
When exponential profiles run on the RoboRIO, there's slightly more latency compared to on-device execution. However, the profile calculation is still very fast and suitable for most mechanisms.
Common Issues and Solutions
Profile is too slow
Increase maximum voltage
Check that your mechanism parameters (mass, length, gearing) are accurate
Verify motor type matches actual hardware
Profile overshoots target
Decrease kP
Add kD for damping
Check that kV and kA values aren't underestimated
Mechanism can't keep up with profile
Your motor may be undersized for the mechanism
Reduce maximum voltage
Check for mechanical binding or excessive friction
Profile works in sim but not on real robot
Run SysId to get real kV and kA values
Account for friction with kS in feedforward
Check current limits aren't restricting torque
Example: Complete Elevator with Exponential Profile
Further Reading
CTRE Motion Magic Expo Documentation - CTRE's explanation of exponential profiles
How do I use Exponential Profiles? - Quick how-to guide
Trapezoidal/Exponential Motion Profiling Whitepaper - Advanced hybrid profiling techniques
WPILib Tuning Guide - General PID and feedforward tuning
Last updated