Simulate a 3-axis stabilized control system

Modified on Thu, 7 Sep, 2023 at 3:46 PM

The Attitude3D demo Implements a 3-axis control system for a rigid spacecraft using a CAD model and the full disturbance model, which includes drag, solar and planetary radiation perturbations, and optionally magnetic and thermal torques. This demo loads the XYZSat CAD model from a mat-file, as shown in this snippet:

g = load('XYZSat');
ShowCAD( g );

The figure produced by ShowCAD is shown below.

The controller is implemented in state space form as:

  % Controller blocks, delta format. Each axis uses the same gains.
  %----------------------------------------------------------------
  accel    = zeros(3,1);
  accel(1) =          c*xRoll  + d*angleError(1);
  xRoll    = xRoll  + a*xRoll  + b*angleError(1);

  accel(2) =          c*xPitch + d*angleError(2);
  xPitch   = xPitch + a*xPitch + b*angleError(2);

  accel(3) =         c*xYaw   + d*angleError(3);
  xYaw     = xYaw  + a*xYaw   + b*angleError(3);

  torque = -g.mass.inertia*accel;

The full disturbance model is called by passing in the  data structure of the CAD Model as:

% Use disturbances model (uses CAD model)
e.r         = x2(1:3);
e.v         = x2(4:6);
[f,t]       = Disturbances('run',g,e,hD);
fDist = f.total/1000; % to kN from N
tDist = t.total;      % already in Nm


Module: SC/Demos/Attitude

Children: PIDMIMO, Disturbances, DrawSCPlugIn

Published demo: Attitude3D.m

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article