Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Although the inputs may be angles or rates, the output of a PID should be a motor % that can be understood by each actuator.

Implementation

A new PID will be will be designed to solve the issues with the previous iteration and saved in the PID.cpp file. The goal is to have multiple PID controllers at the same time each with a PID controller class that can be used by multiple managers (although will be used by attitude manager at first), each object of the class will calculate their own integral & derivative terms being calculated independently, also the PID’s should will update at the same fixed frequency, so that derivative and integral calculations work properly. There are 2 motors per prop on the drone, a yaw servo motor and a roll BLDC (brushless DC) motor. Thus, a wrapper class will be designed for the PIDs so that all the yaw PIDs can be accessed/updated together and same for the roll PIDsBy having one PID instance per axis rather than one per motor the output will be cleaner and more consistent. When the PID does its computations to output, it will calculate it’s own derivative and integral values.

Fixed Time Frequency Updating:

The goal, is have all the PID controllers controller for an axis update at the same a fixed frequency, all axis do not necessarily have to update at the same frequency but the PID controllers of the same axis should. This will be implemented using freeRTOS, where , the wrapper class will have an update method in which it uses tasks PID update method will use a task and vTaskDelayUntil from freeRTOS inside the PID update function, to ensure that the roll/yaw controllers update at controller for an axis is updating at a fixed frequency. When an object of the class is instantiated one of the parameters will be the frequency at which the PID should update.