Optimization - I have seen reoccurring twitching of the aircraft
chrishajduk84 opened this issue · 3 comments
Things to optimize:
-communication with the VectorNav sensor
-control loops
Needs more detail. Unclear what types of optimization you have in mind. Possibly break down into smaller issues.
VectorNav Sensor is one of the slowest processes on board the aircraft:
Overall AttitudeManager.C main: 15.2ms
ReadDatalink without incoming data: 7us
ReadDatalink with data:25.1us
WriteDatalink: 304us
Servo Output: 38.0us
controlSignalAltitude:204us
controlSignalThrottle:164us
controlSignalHeading:328us
controlSignalPitch:280us
controlSignalRoll:280us
VN100_SPI_GetRates:4.6ms
VN100_SPI_GetYPR:4.6ms
Input capture=33.8us
DMA = 58.2us
Outputbuffermaintenance = 52.4us
Inputbuffermaintenance = 50.2us
-
Note that the VectorNav currently takes 9.2ms of the entire process. Which is 60% of the CPU time. This should be optimized.
-
Everything else seems fairly efficient. The "controlSignal______" processes can also be optimized since there are a lot of them and they are used often. While optimizing, ensure that the code works correctly (integrals, derivatives). This code LIKELY has some useless type casting. Watch out for that.
State Machine Branch has fixed this.