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

stkvisualization.h

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////////////////////////////////
00002 /**     \class StkVisualization
00003 *       \brief Visualize satellite position and attitude using STK
00004 *       \author: spikeinferno
00005 *       \version $Revision: 1.7 $
00006 *       \date    $Date: 2006/07/31 19:07:37 $
00007 *//////////////////////////////////////////////////////////////////////////////////////////////////
00008 /*! 
00009 */
00010 //////////////////////////////////////////////////////////////////////////////////////////////////
00011 
00012 #ifndef __STK_VISUALIZATION_H
00013 #define __STK_VISUALIZATION_H
00014 
00015 #include <string>
00016 #include <iostream>
00017 using std::string;
00018 using std::ostringstream;
00019 using namespace std;
00020 
00021 // forward declarations
00022 class AgTConReturnInfo;
00023 
00024 class StkVisualization
00025 {
00026 private:
00027         /// private member data
00028         double Offset;                                  ///< Offset in seconds from current time
00029         char* ConID;                                    ///< STK connection ID
00030         bool ErrorExists;                               ///< Are we storing an error message?
00031         char CommandBuffer[512];                        ///< UGLY HACK -- JRS -- AgConInit takes a char* for hostname,
00032                                                         ///<    so copying string to buffer
00033         bool * SatellitePositionUpdate;                 ///< Used to determine if all satellites have a position so 3D
00034         bool AllSatellitesUpdated;                      ///<    animation windows can be centered about the satellites
00035         bool WindowsSet;                                ///< Used to determine if the animation windows have been set
00036         AgTConReturnInfo* ReturnInfo;                   ///< Pointer to AgTConReturnInfo to get results from STK
00037 
00038         /// private member functions
00039         double GetOffsetTime();                         ///< Returns current time in seconds 
00040                                                         ///<    (provided by gettimeofday) + input Offset
00041         void ClearError();                              ///< Resets error flag and cleans up ReturnInfo
00042         bool SendCommand(ostringstream & commandLine);  ///< Sends command to STK of type ostringstream
00043         bool SendCommand(string commandLine);           ///< Member function overload: reads in command line of type string
00044         
00045         // hide assignment and copy construction
00046         StkVisualization(const StkVisualization&) {}                    ///< :^)
00047         StkVisualization& operator=(const StkVisualization&) {}         ///< :^)
00048 
00049 public:
00050         // member data
00051         int NumberOfSatellites;                         ///< Number of Satellites in Visualization
00052         string ScenarioName;                            ///< Name of STK scenario specified by user
00053         string * SatelliteName;                         ///< Name of satellites to be stored in an array of strings
00054 
00055         // construct StkVisualzation and set time offset (default = 0.0)
00056         StkVisualization(double offset=0.0);            ///< Constructor
00057         ~StkVisualization();                            ///< Destructor
00058 
00059         // public member functions
00060                                 
00061         bool ConnectStk(const char* stkHostAddress, const char* stkHostPort="5001"); ///< Connects to Satellite Tool Kit;
00062                                                         ///< stkHostAddress is the IP address of the computer running STK
00063         bool SetUpScenario();                           ///< Sets up the scenario
00064         bool SetUpNumberOfSatellites();                 ///< Creates array of satellite names
00065         bool SetUpSatellite();                          ///< Creates the satellites as specified by user
00066         bool StartAnimation();                          ///< Starts the animation in STK
00067         bool SetWindows();                              ///< Divides the screen into 2D and 3D windows
00068 
00069         /** Updates the animation with new attitude information; angles 1-3 are the Euler angles in degrees
00070         \param[in] satelliteNumber an integer corresponding to one greater than the index number of the satellite's name, as stored in the string array SatelliteName
00071         \param[in] rotationSequence an integer storing the Euler angle rotation sequence (ex: 321, 212, 123)
00072         \param[in] angle1 a double storing the first rotation in the sequence
00073         \param[in] angle2 a double storing the second rotation in the sequence
00074         \param[in] angle3 a double storing the third rotation in the sequence   
00075         */
00076         bool Update(int satelliteNumber, int rotationSequence, double angle1, double angle2, double angle3);
00077         ///< Updates attitude using Euler angles
00078 
00079         /** \overload Update(int satelliteNumber, double Q1, double Q2, double Q3, double Q4);  
00080         \param[in] satelliteNumber an integer corresponding to one greater than the index number of the satellite's name, as stored in the string array SatelliteName
00081         \param[in] Q1 a double storing the first quaternion component
00082         \param[in] Q2 a double storing the second quaternion component
00083         \param[in] Q3 a double storing the third quaternion component
00084         \param[in] Q4 a double storing the fourth, scalar quaternion component 
00085         */
00086         /// Updates the animation with new attitude information: quaternions
00087         bool Update(int satelliteNumber, double Q1, double Q2, double Q3, double Q4);
00088         ///< Updates attitude using quaternions
00089 
00090 
00091         /** \overload Update(int satelliteNumber, double latitude, double longitude, double altitude, double latitudeRate, double longitudeRate, double altitudeRate);
00092         \param[in] satelliteNumber an integer corresponding to one greater than the index number of the satellite's name, as stored in the string array SatelliteName
00093         \param[in] latitude a double storing the latitude of the subsatellite point in degrees
00094         \param[in] longitude a double storing the longitude of the subsatellite point in degrees
00095         \param[in] altitude a double storing the altitude of the satellite in kilometers (as specified in the function SetUpScenario()
00096         \param[in] latitudeRate a double storing the rate of change of latitude, in degrees per second
00097         \param[in] longitudeRate a double storing the rate of change of longitude, in degrees per second
00098         \param[in] altitudeRate a double storing the rate of change in altitude, in kilometers per second
00099         */
00100         /// Updates the animation with new orbit position information
00101         bool Update(int satelliteNumber, double latitude, double longitude, double altitude, 
00102                     double latitudeRate, double longitudeRate, double altitudeRate); 
00103         ///< Updates the animation with new orbit information using latitude, longitude, altitude, latitude 
00104         ///<    and longitude rates, and altitude rate.\n
00105         ///< Latitude and longitude are in degrees.  Altitude is kilometers (set by SetUpScenario).  
00106         ///<    Latitude and longitude rates are is degrees per second.\n
00107         ///< Altitude rate is in kilometers per second.\n
00108 
00109         const char* GetLastError(char* buffer);         ///< Returns the errors
00110         bool ShutDownStk();                             ///< Closes connection to STK and frees memory
00111 };
00112 
00113 #endif //__STK_VISUALIZATION_H
00114 
00115 // Do not change the comments below - they will be added automatically by CVS
00116 /*****************************************************************************
00117 *       $Log: stkvisualization.h,v $
00118 *       Revision 1.7  2006/07/31 19:07:37  spikeinferno
00119 *       Additional comments
00120 *       
00121 ******************************************************************************/

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