4533-phoenix / DeepSpaceRobot

This is the reprository where the code for the 2019 season is located.
1 stars 0 forks source link

Create Velocity Control Mode in DriveSystem and a DriveVelocity command #20

Closed BearsAreAwsome closed 5 years ago

BearsAreAwsome commented 5 years ago

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

BearsAreAwsome commented 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.

BearsAreAwsome commented 5 years ago

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

BearsAreAwsome commented 5 years ago

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).

BearsAreAwsome commented 5 years ago

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.

goobway commented 5 years ago

Created DriveVelocityControlMode and DriveVelocity command

goobway commented 5 years ago

Completed all the issues.