Magnetorquer control
Can anyone help me. Im designing a control system for a cubesat in single-axis. I have two torquers placed on the x & y axis of the cubesat. I want to implement a state-feedback controller on a dsPIC microcontroller to control the dipole moment of each torquer. I am using a magnetometer for angular position. The microcontroller must compute the required torque to turn the satellite to a desired reference angular position.
I realize the contral law will be T (Torque) = M( dipole moment) x B (earths magnetic field), where M = NIA. Therefore T = NIABsin(x) where x is the angle between M and B. How does the controller come up with the current to control the torquers dipole moment.
The control law will be something like T = MxBy -MyBx where Mx is the dipole moment of the x-axis torquer and Bx is the x-component of the earths magnetic field.