VR-Link API Documentation for HLA Evolved
smoothUtil.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 1992-2010 VT MAK
00003 ** All rights reserved.
00004 *********************************************************************/
00005 
00006 
00009 
00010 #ifndef DtSmoothPos_H_
00011 #define DtSmoothPos_H_
00012 
00013 #include <matrix/vlMath.h>
00014 #include <matrix/vlDcm.h>
00015 #include <matrix/vlVector.h>
00016 #include <vlutil/vlTime.h>
00017 #include <vlutil/vlPrint.h>
00018 
00019 
00022 class DT_DLL_VLPROTIND DtSmoothPos
00023 {
00024 public:
00025 
00028    DtSmoothPos(void *usr, DtTime smoothT, 
00029       const DtVector& pos, const DtVector& vel, const DtVector& acc);
00031    DtSmoothPos(void *usr, DtTime smoothT);
00032 
00033    virtual ~DtSmoothPos() {}
00034 
00035 private:
00036 
00038    DtSmoothPos(const DtSmoothPos&);
00039 
00041    DtSmoothPos& operator=(const DtSmoothPos&);
00042 
00043 public:
00044 
00045    void input(const DtVector& pos, const DtVector& vel, const DtVector& acc,
00046       DtTime simTime, int freeze=0);
00047    void tick(DtTime simTime);
00048 
00049    const DtVector& position() const { return ps; }
00050    const DtVector& velocity() const { return vs; }
00051 
00056    virtual void setSmoothEnable(int on); 
00057    virtual int smoothEnable() const;
00058 
00061    virtual void setSmoothPeriod(DtTime t); 
00062    virtual DtTime smoothPeriod() const;
00063 
00064 public:
00065 
00067    static void setDfltSmoothPeriod(DtTime t); 
00068    static DtTime dfltSmoothPeriod();
00069 
00071    static void setMasterSmoothEnable(bool onOff);
00072    static bool masterSmoothEnable();
00073 
00074 protected:
00075 
00076 
00077    virtual void dfltAction(DtTime simTime, void *usr, 
00078       DtVector& vs, DtVector& ps) = 0;
00079    void init(void *u, DtTime t);
00080    void setT1data();    
00081 
00082 protected:
00083 
00084    int myFrozen;
00085 
00086    DtTime myT0;
00087    DtTime myT1;
00088    DtTime myT2;
00089    DtTime myLastT;
00090 
00091    DtTime myLocalTau;
00092    DtTime myLocalHtau;
00093    DtTime myLocalTauInv;
00094    DtTime* myTau;
00095    DtTime* myHtau;
00096    DtTime* myTauInv;
00097 
00098    DtVector ps, vs, p0, v0, dp, dv, p1, v1, a1, a2, ap;
00099    int myEnable;
00100    int myNeedT1Data;
00101    int myNeedT2Data;
00102    void *myUsr;
00103 
00104 protected:
00105 
00106    static DtTime theDfltTau;
00107    static DtTime theDfltHtau;
00108    static DtTime theDfltTauInv;
00109    static bool theMasterSmoothEnable;
00110 };
00111 
00112 
00115 class DT_DLL_VLPROTIND DtSmoothOrient
00116 {
00117 public:
00118 
00121    DtSmoothOrient(void *usr, DtTime smoothT, 
00122       const DtDcm & orient, const DtDirectedRotRate &drr);
00124    DtSmoothOrient(void *usr, DtTime smoothT);
00125 
00126    virtual ~DtSmoothOrient() {} 
00127 
00128    void input(const DtDcm & orient, const DtDirectedRotRate &drr, 
00129       DtTime simTime, int freeze=0);
00130    void tick(DtTime simTime);
00131 
00132    const DtDcm & orientation() const { return myOs; }
00133 
00138    virtual void setSmoothEnable(int on); 
00139    virtual int smoothEnable() const;
00140 
00143    virtual void setSmoothPeriod(DtTime t); 
00144    virtual DtTime smoothPeriod() const;
00145 
00146 public:
00147 
00149    static void setDfltSmoothPeriod(DtTime t); 
00150    static DtTime dfltSmoothPeriod();
00151 
00153    static void setMasterSmoothEnable(bool onOff);
00154    static bool masterSmoothEnable();
00155 
00156 protected:
00157 
00158    virtual void dfltAction(DtTime simTime, void *usr, DtDcm& os) = 0;
00159    void init(void *u, DtTime t);
00160    void setT1data();    
00161 
00162 protected:
00163 
00164    int myFrozen;
00165    DtTime myT0, myT2, myLastT;
00166    DtTime* myTau;
00167    DtTime myLocalTau;
00168    DtDcm myOs, myO0;
00169    DtVector myWs;
00170    int myEnable;
00171    void *myUsr;
00172 
00173 protected:
00174    
00175    static DtTime theDfltTau;
00176    static bool theMasterSmoothEnable;
00177 };
00178 
00179 
00180 inline DtTime DtSmoothPos::smoothPeriod() const 
00181 { 
00182    return *myTau;
00183 }
00184 
00185 inline DtTime DtSmoothOrient::smoothPeriod() const 
00186 { 
00187    return *myTau;
00188 }
00189 
00190 #endif /* _SMOOTHUTIL_H_ */
00191 

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)