how does motion profiling work for a drivetrain
Motion profiling controls a drivetrain by gradually and consistently changing its desired speed over time, rather than instantaneously setting the motors to full power . This gradual change prevents uncontrolled movements, inconsistent autonomous runs, and mechanism damage caused by the drivetrain taking time to physically catch up to instantaneous full-power commands .
For FTC drivetrains, trapezoidal profiles are recommended over S-Curve profiles . While S-Curve profiles assume constant jerk to reduce wheel slippage, they are not optimal for controlling 2D trajectories like driving . Trapezoidal profiles instead accelerate the system at a constant rate .
In practice, a motion profile algorithm calculates target velocity and acceleration values over time . These calculated outputs are then passed into a PID and/or feedforward control loop to operate the drivetrain's position smoothly and predictably .
These profile ramp inputs can also be used to estimate the velocity (Kv) and acceleration (Kₐ) gains needed for a feedforward controller . Because these gains change based on the robot's mass and friction, they must be re-estimated whenever significant changes are made to the robot .
More advanced motion profiling for drivetrains is covered in the restricted Road Runner documentation at Road Runner — Motion Profiling and Road Runner — Motion Profiling .