Cosmos Forum

Cosmoneer Proto => Guidance, Navigation and Control (CMG, Compass & microController) => Topic started by: Cosmoneer on December 21, 2016, 11:27:03 AM

Title: PID Heading Control Loop
Post by: Cosmoneer on December 21, 2016, 11:27:03 AM
The current version of the Cosmoneer Proto's guidance & navigation uses a crude PID loop to control the heading.

It features:
-  Left or Right turn logic
   This logic is used to determine when to turn left or turn right.
   Basically, Which direction is less than 180 degrees from the current heading.
   The current turn rate and direction should be compensated for.

-  CMG Gimbal Reset
   When the CMG is out of usable range, it simply returns to the center point.
   The GN&C must then regain control of the Cosmoneer.
   The reset procedure could "swim" back to center in incremental steps.
   Each increment uses a two gimbal step to home w/slow gyro, then one gimbal step away with faster gyro.
   This improvement maintains the current heading while resetting the CMG gimbal angle.

-  Angular Error PID loop
   The current PID loop uses the target heading and compass heading to compute heading error.
   Does not compensate for torque output due to current CMG gimbal position and gyro speed.
   An improved PID loop would use torque or angular velocity instead of simple heading difference.
   Also, CMG gimbal angle and gyro speed should be factored in.

-  Heavy compass heading value smoothing
   Prior to Compass calibration, it was necessary to utilize a heading smoothing function.
   Utilize the HMC5883L setting for (1 is default) 2, 4 or 8 averaged reads per heading calculation.

-  Pre-flight compass calibration
   During initialization, the Cosmoneer Proto executes a spin and attempts to self-calibrate the compass.
   Notify user to manually calibrate when a complete 360deg sweep cannot be performed.
   Detect when calibration failed and retest/recalibrate.