Versions Compared

Key

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

TODO: Update docs for 2022 UAS competition

Overview

From a high level perspective, Attitude manager takes care of figuring out how to actuate the throttle and control surfaces to put the aircraft in the correct orientation and achieve the correct airspeed). The actuator commands it produces are sent to another microcontroller on the Zero-Pilot PCB; the “Safety chip”, from where they will be sent to the actuators.

When we talk about “Attitude manager”, we are talking about the Attitude manager state machine, all the sensor modules that belong to Attitude manager (airspeed and IMU), all the data processing modules that belong to Attitude manager (Sensor fusion, PID, and Output mixing), and the 2 communication modules that belong to path manager (1 to speak to Path Manager, the other to speak to the safety chip).

This page details the design of the state machine, which is the “highest level element” of Attitude Manager. The children pages detail the designs of all its modules.

State machine design

The Attitude manager state machine will be implemented in a thread of its own. A full cycle of this state machine needs to be executed at some constant frequency. The states as well as the flow between them is depicted in the drawing below. Each state corresponds to exactly 1 module action. The state machine itself only transfers data between modules. It may also repackage data to facilitate communication between modules, but it never processes or modifies and data, that is the exclusive job of the modules. The figure below depicts the states as well as the flow between them.

...

currently observed issue:

SFOutput_t *SF_output = SensorFusionMode::getSFOutput();

The SF_output struct is never got updated. in the file the struct is not updated.

possible solutions

SFOutput.pitch = attitudeOutput.pitch;
SFOutput.roll = attitudeOutput.roll;
SFOutput.yaw = attitudeOutput.yaw;
SFOutput.pitchRate = attitudeOutput.pitchRate;
SFOutput.rollRate = attitudeOutput.rollRate;
SFOutput.yawRate = attitudeOutput.yawRate;
SFOutput.altitude = pathOutput.altitude;
SFOutput.rateOfClimb = pathOutput.rateOfClimb;
SFOutput.latitude = pathOutput.latitude;
SFOutput.latitudeSpeed = pathOutput.latitudeSpeed;
SFOutput.longitude = pathOutput.longitude;
SFOutput.longitudeSpeed = pathOutput.longitudeSpeed;
SFOutput.track = pathOutput.track;
SFOutput.groundSpeed = pathOutput.groundSpeed;
SFOutput.heading = attitudeOutput.heading;

This is updating the member but is it actually updating the struct?