Closed BearsAreAwsome closed 5 years ago
To create a velocity drive mode, we first need to set up the magnetic encoders. To do this we use the method .configSelectedFeedbackSensor(). It has three parameters, the encoder that we are using (CTRE magnetic encoder), the PID index which is 0, and the timeout ms, which is 100.
Next we need to create a driveVelocity method. It has parameters of left and right. Those values are the joysitck input. Next we need to create some private ints called targetL and targetRight with values of 0
Then in the driveVelocity method set targetL and targetR equal to left (or right depending on what you are setting) times the units per revolution of the wheels (4096) divided by the amount of 100 ms in 1 minute (600).
Then set the master motors to velocity mode and to targetL and targetR respectively. Set the slave motors to follower and set them to follow their masters.
Created DriveVelocityControlMode and DriveVelocity command
Completed all the issues.
This control mode is what we used last season, and it worked pretty well. So this year I plan on the velocity control mode to be the main control mode for this year. So our goal is to create the same sort of control mode as last year