vsTASKER 7 Tutorial
×
Menu
Index

STK

 
This tutorial has been tested under STK 9.
Migration to later versions of STK remains on the customer side for the moment.
Contact support (support@vstasker.com) if you have problems with this demo.
 
Specific license is mandatory. Contact VirtualSim if you need this module.
 
 
Most of AGI’s customers are using STK for space, aircraft, UAV and intelligence mission design and analysis.
It includes trajectories and attitudes tuning, multi-sensors coverage computation taking into account terrain masking or budget links assessment. All results are visualized in a real time performing 3D viewer.
Up to now, behaviors of STK entities were purely deterministic that could induce some restrictions in scenario design process when faced with real operations complexity.
 
To answer this challenge, STK can be interfaced with vsTASKER to bring Event-Driven Behavioring capacity into STK. In managing behaviors and logic transitions of all assets during scenario runs, the combined application STK/vsTASKER produces a more realistic simulation than ever, putting similar reactivity as real operational theater.
 
STK software and license must be requested from a proper vendor (AGI), as vsTASKER does not provide them nor behave as a reseller or support line.
Supported version goes up to v3.
 
 
Automation with STK is similar to automation with MS Office.
So, the following article about « Office Automation Using Visual C++ » is a good entry point if you are not familiar with OLE Automation.
 
“Here are three basic ways you can use Automation: MFC, #import, and C/C++:
 
With MFC, use the Visual C++ ClassWizard to generate "wrapper classes" from the Microsoft Office type libraries. These classes, as well as other MFC classes, such as COleVariant, COleSafeArray, COleException, simplify the tasks of Automation. This method is usually recommended over the others, and most of the Microsoft Knowledge Base examples use MFC.
 
#import, a new directive that became available with Visual C++ 5.0, creates VC++ "smart pointers" from a specified type library. It is very powerful, but often not recommended because of reference- counting problems that typically occur when used with the Microsoft Office applications.
 
C/C++ Automation is much more difficult, but sometimes necessary to avoid overhead with MFC, or problems with #import. Basically, you work with such APIs as CoCreateInstance(), and COM interfaces such as IDispatch and IUnknown.”
 
 
First, use the "MFC Class from TypLib" wizard of VisualStudio to generate the header files of the STK classes.
 
Then, you can use the generated wrappers:
 
#include "CIAgStkObjectRoot.h"
// headers have been generated with VisualStudio using the "MFC Class from TypLib Wizard"
CIAgStkObjectRoot* stkRoot;
stkRoot=new CIAgStkObjectRoot(m_stkUiApp.get_Personality2());
stkRoot->ExecuteCommand(myCmd);
 
 
#import "C:\\Program Files\\AGI\\STK 9\\bin\\AgSTKUtil.dll" no_namespace
#import "C:\\Program Files\\AGI\\STK 9\\bin\\AgVGT.dll" no_namespace
#import "C:\\Program Files\\AGI\\STK 9\\bin\\AgSTKObjects.dll" no_namespace
IAgStkObjectRootPtr stkRootPtr;
stkRootPtr= m_stkUiApp.get_Personality2();
stkRootPtr->ExecuteCommand(myCmd);
 
 
You can use the native COM API or use the ATL API which facilitates the usage of COM components.
With ATL:
 
#include "Afxctl.h"
….
CComQIPtr<IAgStkObjectRoot> stkRootPtr;
stkRootPtr.CoCreateInstance(__uuidof (AgStkObjectRoot)));
stkRootPtr->ExecuteCommand(myCmd);