Public Member Functions | Public Attributes

PID3Axis Class Reference

A PID Based 3 axis controller for spacecraft. More...

List of all members.

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.
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.
void Reset (void)
 Reset the pid.
void SetRotateCommand (ml_matrix axis, double angle)
 Set the rotate command.
void SetAlignCommand (ml_matrix body_vector, ml_matrix eci_vector)
 Set the align command.
void SetAlignAndRotateCommand (ml_matrix body_vector, ml_matrix eci_vector, double angle)
 Set the align and rotate command.
void SetInertia (ml_matrix inertia)
 Set the inertia.
void SetDesQuat (ml_matrix qdes)
 Set the desired quaternion.
ml_matrix GetDesQuat (void)
 Set the desired quaternion to the default.
bool GetStatus (void)
 Get the PID status.
ml_matrix GetInertia (void)
 Get the inertia.
void SetMaximumDeltaAngle (double delta)
 Set the maximum delta per step.

Public Attributes

ml_matrix q_desired_state
 Target quaternion.

Detailed Description

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


Member Function Documentation

void PID3Axis::Initialize ( ml_matrix  a,
ml_matrix  b,
ml_matrix  c,
ml_matrix  d,
double  angle,
ml_matrix  inr 
)

Initialize the class with the discrete controller gains (state space format).

Parameters:
aGain matrix A
bGain matrix B
cGain matrix C
dGain matrix D
angleMaximum angle constraint (rad)
inrVehicle inertia matrix (3x3)
ml_matrix PID3Axis::Update ( ml_matrix  q_ECI_body )

Update the controller.

Parameters:
q_ECI_bodyCurrent vehicle orientation (4x1)
Returns:
Torque demand (3x1)
void PID3Axis::SetRotateCommand ( ml_matrix  axis,
double  angle 
)

Set a rotation command using an axis and angle.

Parameters:
axisAxis in the body frame to rotate around (3x1)
angleAngle in rad to rotate
void PID3Axis::SetAlignCommand ( ml_matrix  body_vector,
ml_matrix  eci_vector 
)

Set an alignment command using a body vector and an inertial vector.

Parameters:
body_vectorAxis in the body frame to align (3x1)
eci_vectorInertial vector to align with (3x1)
void PID3Axis::SetAlignAndRotateCommand ( ml_matrix  body_vector,
ml_matrix  eci_vector,
double  angle 
)

Set an alignment command and rotate using a body vector, an inertial vector and an angle about the inertial vector.

Parameters:
body_vectorAxis in the body frame to align (3x1)
eci_vectorInertial vector to align with (3x1)
angleAngle about inertial vector
void PID3Axis::SetDesQuat ( ml_matrix  qdes )

Set a target quaternion.

Parameters:
qdesThe new desired quaternion (4x1)
ml_matrix PID3Axis::GetDesQuat ( void   )

Get the target quaternion.

Returns:
The current target quaternion (4x1)
bool PID3Axis::GetStatus ( void   )

Get the status of the controller.

Returns:
True if PID is initialized, false otherwise
ml_matrix PID3Axis::GetInertia ( void   )

Get the inertia matrix.

Returns:
The current inertia matrix (3x3)