This document gives a very brief overview of the desired functionality of the PID controllers inside ZeroPilot 3.5’s Attitude Manager.
Understanding PID’s
Hopefully, PID’s make sense to you, but if they don’t, check out the following guides:
Within Attitude Manager, we run PID’s on each axis exclusively. Since the axis are (mostly) decoupled from each other, we can do this to great success in both quadcopters and fixed-wing aircraft. The output from each PID essentially decides how much to “drive” actuators in that axis to move our current angle / rate to the desired angle / rate. For quadcopters, multiple-axis PID’s are combined on different motors. In a fixed-wing, most actuators only correspond with one PID - and that axis' PID will deal with secondary effects such as adverse yaw.
The PID Class
Typically, PID exists as a class which is then implemented per-axis. This means that each axis has a singular output, so it’s necessary to determine Positive and Negative orientations, as certain actuators may need to reverse the PID output depending on their orientation. See the ZP3.0 architecture for our drone reference frame ZeroPilot 3.0 Architecture - Embedded Flight Software - WARG (atlassian.net)
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 their own integral & derivative terms being calculated independently, also the PID’s should 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 PIDs.
Fixed Time Frequency Updating:
The goal, is have all the PID controllers for an axis update at the same 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 and vTaskDelayUntil from freeRTOS inside the PID update function, to ensure that the roll/yaw controllers update at at a fixed frequency.
Add Comment