Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

SingleAxisController.cpp

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////////////////////////////////
00002 /*! \file SingleAxisController.cpp
00003 *  \brief Implementation of the SingleAxisController class.
00004 *  \author $Author: mavandyk $
00005 *  \version $Revision: 1.2 $
00006 *  \date    $Date: 2003/08/06 21:47:54 $
00007 *//////////////////////////////////////////////////////////////////////////////////////////////////
00008 /*! 
00009 */
00010 //////////////////////////////////////////////////////////////////////////////////////////////////
00011 
00012 #include "SingleAxisController.h"
00013 
00014 int SingleAxisController::Initialize() {
00015 
00016         Matrix K(3,3);
00017         K(1,1) = 10;
00018         K(2,2) = 10;
00019         K(3,3) = 10;
00020         m_gainMatrix = K;
00021         
00022         return 0;       
00023 }
00024 
00025 int SingleAxisController::Run()
00026 {
00027         /** Grabs current information for the whrol object */
00028         GrabInfo();
00029         
00030         /** Get the current state */
00031         Vector states = PateraSilk->GetState();
00032         Vector z(3), w(3);
00033         z = states(_(1,3));
00034         w = states(_(4,6));
00035         
00036         /** Get the desired state */
00037         Vector wd(3), zd(3);
00038         zd = m_desiredState(_(1,3));
00039         wd = m_desiredState(_(4,6));
00040         Vector dz = z - zd,     dw = w - wd;
00041 
00042         /** Calculate the desired control torque */
00043         m_controlTorque = skew(w) * recentMOI * w - recentMOI * skew(z) * dz - m_gainMatrix * dw;
00044         
00045         /** Set the desired control torque in whorl object */
00046         PateraSilk->SetControl(m_controlTorque);
00047         
00048         /** Command the momentum wheels to produce the control torque if it's not too large */
00049         Vector zeroVector(3);
00050         if (norm2(m_controlTorque) < 300)
00051                 SetWheelTorque(m_controlTorque);
00052         else
00053                 SetWheelTorque(zeroVector);
00054 
00055         return 0;
00056 }
00057 
00058 // Do not change the comments below - they will be added automatically by CVS
00059 /*****************************************************************************
00060 *       $Log: SingleAxisController.cpp,v $
00061 *       Revision 1.2  2003/08/06 21:47:54  mavandyk
00062 *       Updated comments and notation and fixed class structure.
00063 *       
00064 *       Revision 1.1  2003/07/31 21:01:50  mavandyk
00065 *       A single axis attitude controller.
00066 *       
00067 *       Revision 1.3  2003/07/07 14:11:24  simpliciter
00068 *       Removed GetWhorlObject() calls following Whorl pointers.
00069 *       
00070 *       
00071 *
00072 ******************************************************************************/

Generated on Wed Sep 5 12:54:25 2007 for DSACSS Operational Code by  doxygen 1.3.9.1