Tuning PIDF with NavX sensor input

Hi all -
We’re off-season experimenting with closed-loop turning using a NavX gyro and a PIDController class. We’ve used closed-loop control before directly with the Talon SRXs we have, but not with a class object and a gyro as sensor input.

Right now we are in the PIDF tuning phase. We have historically tuned PIDF using the following steps:

  1. start with an F value that gets close.
  2. move to the P value that adjusts error.
  3. move to the D value until oscillating.
  4. move to the I value to smooth out (if necessary).

We’ll typically only do steps 1 & 2, moving to 3 and 4 if more precision is needed.

My assumption is this tuning method doesn’t change with the gyro as input. Thoughts?

Thanks,
Rob

Turning angular velocity or turning angular position?

We have historically tuned PIDF using the following steps:

  1. start with an F value that gets close.

This seems to imply velocity control.

My assumption is this tuning method doesn’t change with the gyro as input.

Tuning position and tuning velocity are two different animals.

This would be turning position - turning to a particular angle.

F gain deals with the nominal dynamics of a system. So when tuning a velocity controller, F is used to get close to the desired velocity. However, with a position controller, when in the desired state the robot shouldn’t be moving anymore. In this case, the nominal dynamics require no input to remain stationary, so the F gain should be 0.

From there you can tune P, I and D. But we’ve found that just P is usually sufficient for a simple ‘spin to angle’ routine.

Edited to reflect the fact that not all position controllers should have an F gain equal to 0.

In this particular case, yes. But in the general case, not necessarily. For example, lifting an unbalanced arm in a gravitational field, when a force (or torque) is required to hold the (static) position.

Very clear - thanks for the info guys.
We’ll keep F at zero and mainly focus on P for our angle routine.

Have fun in the off-season!
Rob

It may be more convenient to use a PIDCommand than a PIDController.

For optimal performance, “cascade” the output of your angle loop by sending the output as setpoints to a velocity-controlled drive, rather than as raw voltages. If you do this, you should not need anything other than a simple P loop.