frc538 / 2020-infinite-recharge

Robot code for FRC Team 538.
0 stars 0 forks source link

Learn how to profile the Spark Max with Neo for Position. #1

Closed drewwhis closed 4 years ago

drewwhis commented 4 years ago

In order to play with this, the Test Bench needs to have one SparkMax and one Neo.

REV Spark Max Examples: https://github.com/REVrobotics/SPARK-MAX-Examples

Steps to Profiling (Initialization):

  1. Reset SparkMax to factory defaults
  2. Get the encoder and controller
  3. Track values for P, D, FF, Min, and Max (I and IZone are not needed yet, and not necessarily recommended in FRC).
  4. Initialize P, D, and FF to 0. Initialize Min to -1 and Max to 1. Initialize SetRotations to 0.
  5. Display the values (P, D, FF, Min, Max, SetRotations) in the dashboard.

Steps to Profiling (Periodic):

  1. Read P, D, FF, Min, Max, and SetRotations from the dashboard.
  2. If P, D, FF, Min, or Max changed their values, update them.
  3. Use the controller to set the reference to the SetRotations value (using position).
  4. Display the SetPoint in the dashboard (the SetRotations).
  5. Display the Output/Process Variable (the encoder position).

If this proves insufficient, we can work the I and IZone values in.

drewwhis commented 4 years ago

Once we get this initial profiling done, we want to see if we can use angles (rather than rotations) to streamline the process.

The last "next step" would be to checkout the smart motion (Trapezoid, Max Velocity, Max Acceleration) with rotations and then angles.

drewwhis commented 4 years ago

We spent some time on this tonight once we got everything imaged. We were able to adjust P, D, and FF on the single motor in Shuffleboard. We were also able to get position set in radians, not rotations.

We didn't play with smart motion this time, but it may not be necessary moving forward. We can try that out if it becomes necessary.

We'll use what we learned here when making the modules.

drewwhis commented 4 years ago

This will be useful in adding the turn motor to the swerve module.