Spacecraft Control Framework 1.0
Spacecraft Control Library
|
#include <sc_pid3axis.h>
Public Member Functions | |
PID3Axis (void) | |
Constructor. | |
void | Initialize (ml_matrix a, ml_matrix b, ml_matrix c, ml_matrix d, double angle, ml_matrix inr) |
Initialize all state matrices. More... | |
void | InitializePitch (ml_matrix a, ml_matrix b, ml_matrix c, ml_matrix d, double angle, ml_matrix inr) |
Initialize pitch matrices. | |
void | InitializeRoll (ml_matrix a, ml_matrix b, ml_matrix c, ml_matrix d, double angle, ml_matrix inr) |
Initialize roll matrices. | |
void | InitializeYaw (ml_matrix a, ml_matrix b, ml_matrix c, ml_matrix d, double angle, ml_matrix inr) |
Initialize yaw matrices. | |
void | AddWindupCompensation (ml_matrix l, ml_matrix saturation) |
Add windup compensation. | |
ml_matrix | Update (ml_matrix q_eci_to_body) |
Update the output. More... | |
void | Reset (void) |
Reset the pid. | |
void | SetRotateCommand (ml_matrix axis, double angle) |
Set the rotate command. More... | |
void | SetAlignCommand (ml_matrix body_vector, ml_matrix eci_vector) |
Set the align command. More... | |
void | SetAlignAndRotateCommand (ml_matrix body_vector, ml_matrix eci_vector, double angle) |
Set the align and rotate command. More... | |
void | SetInertia (ml_matrix inertia) |
Set the inertia. | |
void | SetDesQuat (ml_matrix qdes) |
Set the desired quaternion. More... | |
ml_matrix | GetDesQuat (void) |
Set the desired quaternion to the default. More... | |
bool | GetStatus (void) |
Get the PID status. More... | |
ml_matrix | GetInertia (void) |
Get the inertia. More... | |
void | SetMaximumDeltaAngle (double delta) |
Set the maximum delta per step. | |
Public Attributes | |
ml_matrix | q_desired_state |
Target quaternion. | |
A PID Based 3 axis controller for spacecraft. Includes a limit on the max angle command allowed per update step. Uses the input inertia to compute a torque demand. Acceleration is computed
for each axis independently. Supports several input formats including a desired quaternion, a rotation about an axis, and an align command. The PID is implemented as a state space controller of the form.
void PID3Axis::Initialize | ( | ml_matrix | a, |
ml_matrix | b, | ||
ml_matrix | c, | ||
ml_matrix | d, | ||
double | angle, | ||
ml_matrix | inr | ||
) |
Initialize all state matrices.
Initialize the class with the discrete controller gains (state space format).
a | Gain matrix A |
b | Gain matrix B |
c | Gain matrix C |
d | Gain matrix D |
angle | Maximum angle constraint (rad) |
inr | Vehicle inertia matrix (3x3) |
References Reset().
ml_matrix PID3Axis::Update | ( | ml_matrix | q_ECI_body | ) |
Update the output.
Update the controller.
q_ECI_body | Current vehicle orientation (4x1) |
References au_to_q(), q_desired_state, q_to_angle(), q_to_vec(), sc_warn(), u_to_q(), and unwrap().
void PID3Axis::SetRotateCommand | ( | ml_matrix | axis, |
double | angle | ||
) |
Set the rotate command.
Set a rotation command using an axis and angle.
axis | Axis in the body frame to rotate around (3x1) |
angle | Angle in rad to rotate |
void PID3Axis::SetAlignCommand | ( | ml_matrix | body_vector, |
ml_matrix | eci_vector | ||
) |
Set the align command.
Set an alignment command using a body vector and an inertial vector.
body_vector | Axis in the body frame to align (3x1) |
eci_vector | Inertial vector to align with (3x1) |
void PID3Axis::SetAlignAndRotateCommand | ( | ml_matrix | body_vector, |
ml_matrix | eci_vector, | ||
double | angle | ||
) |
Set the align and rotate command.
Set an alignment command and rotate using a body vector, an inertial vector and an angle about the inertial vector.
body_vector | Axis in the body frame to align (3x1) |
eci_vector | Inertial vector to align with (3x1) |
angle | Angle about inertial vector |
References au_to_q(), q_desired_state, and u_to_q().
void PID3Axis::SetDesQuat | ( | ml_matrix | qdes | ) |
Set the desired quaternion.
Set a target quaternion.
qdes | The new desired quaternion (4x1) |
References q_desired_state.
ml_matrix PID3Axis::GetDesQuat | ( | void | ) |
Set the desired quaternion to the default.
Get the target quaternion.
References q_desired_state.
bool PID3Axis::GetStatus | ( | void | ) |
Get the PID status.
Get the status of the controller.
ml_matrix PID3Axis::GetInertia | ( | void | ) |
Get the inertia.
Get the inertia matrix.