-
Notifications
You must be signed in to change notification settings - Fork 0
How to set up closed loop control for a motor
-
Choose and set up a MotorDriver with pin numbers that match your wiring.
-
Use MotorDriver.set() and see if the motor responds correctly. You will want to have realtime control of the motor; some of the examples show one way to control the motor from the Serial monitor. If the motor turns backwards, either fix the wiring or change the reverse setting in the constructor.
-
Choose and set up an Encoder with pin numbers that match your wiring. Also set the distPerCountFactor to match whatever units you want, and change the reverse setting if needed. Find a way to display the value of getVel().
-
Choose a VoltageCompensator and set it up.
-
Choose a MotorCompensator and pass it your VoltageCompensator.
-
Choose a ControlLoop. Start with tuning values of 0.
-
Finally, set up your MotorControllerClosed motor controller.