Path: CubeSat/AttitudeControl
% Implement instantaneous magnetic control with torquers. Magnetic torquers only produce 2-axis torque. This function generates a least squares fit that matches the torque the torquers can produce to the torque demand. The output is the dipole demand in ATM^2 (amp-turn-meter-squared). The scalar cost is any number >= 0. It assumes that the cost of using any dipole is the same. The output will need to be pulsewidth modulated if the torquers do not have linear actuation. For example, the torque is T = [m1 m2 m3] x b, or T = -b x [m1 m2 m3] m1, m2 and m3 are dipoles. [b x] cannot be inverted hence the least squares. Has a built-in demo. -------------------------------------------------------------------------- Form: [m, tErr] = MagneticControl( b, tDemand, u, c ) -------------------------------------------------------------------------- ------ Inputs ------ b (3,1) Magnetic Field (T) tDemand (3,1) Torque Demand (Nm) u (3,n) Unit dipole vectors for n dipoles c (1,1) Scalar cost of using a dipole ------- Outputs ------- m (n,1) Dipole values (ATM^2) tErr (3,1) Torque error (Nm) --------------------------------------------------------------------------
AerospaceUtils: Coord/QLVLH SC: BasicOrbit/El2RV SC: Environs/BDipole Common: Quaternion/QForm Common: Time/Date2JD Math: Linear/Cross
Back to the CubeSat Module page