|
Re: How to display motor speed for PID Tuning
You can see the current motor voltage set by your motor controller if you're using CAN. Use the GetOutputVoltage method on your motor controller object and send it to SmartDashboard.
If you want to see actual speed, you'll need an encoder on your drive. Then, you'll need to periodically read the encoder and convert the value into rotations, degrees, or whatever you need. Then divide the amount that it has changed by the time since your last read the value (typically 1/50 sec if nothing is bogging down your program loop). That should give you the velocity.
|