VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Back-End Remote Control (remoteControl)

Table of Contents

The Back-End Remote Control example demonstrates the following:

How to Run the Example

This example demonstrates how to use the remote control API for controlling a VR-Forces back-end. It is a standalone console application that enables users to create/manipulate VR-Forces scenarios through a simple text interface.

This example now includes simple usage of the DtRemoteEnvironmentController.

Usage

To run the application:

  1. Start VR-Forces GUI and SIM through the "vrfLauncher.exe" - e.g. select the DIS (7) localhost protocol.
  2. Do not load an existing or create new scenario
  3. Open the Ground_DB II.mtf terrain in the GUI
  4. Open a separate command line window and switch to the VR-Forces "/bin64/" directory
  5. Start the remoteControl application as "remoteControlDIS.exe" with the same command line arguments used to start vrfSimDIS, with the exception of appNumber. The appNumber for each application should always be different.

    Note: You need to supply the same set of command line arguments as the ones required to run the vrfSimDIS.exe. The necessary command line arguments for the remoteControlDIS.exe can be copied from the backend command line arguments from the Launcher UI. If using the HLA protocol, you do not theed the –hostAddressString –appNumber –siteId –sessionId command line arguments

  6. In the remoteControl console window - type "help" to display the complete list of commands
  7. In the remoteControl console, create a new scenario by entering 'new "Ground_DB II.mtf"'
  8. Enter commands in the remoteControl console as desired, to create and task entities.

    Note that location and point parameters should be entered using the geocentric coordinate system.

  9. The results of the commands will be observable in the VR-Forces GUI. The GUI is only being used as a passive display in this example. The remoteControl application is the one actually controlling VR-Forces back-end.
  10. This example uses a specialized subclass of the DtVrfRemoteController called DtVrlinkVrfRemoteController. This convenience class allows for the constuction of the remote controller around a DtExerciseConnection.
  11. You can use the DtVrfRemoteController, however, you will need to create a DtCommunicationManager and DtVrlinkNetworkInterface to add to that in order to be able to run the example.

Classes

DtRemoteControlInitializerThis subclass of DtVrlApplicationInitializer adds command line options for the HLA version of the example.
DtTextInterfaceThis class allows the user to type in commands that will be parsed and used to supply information to the remote controller.

Plugin Entry Points

/*******************************************************************************
** Copyright (c) 2020 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
#include "textIf.h"
#include "remoteControlInit.h"
//VR-Forces headers
//VR-Link headers
#include <vl/exerciseConn.h>
#include <vlutil/vlProcessControl.h>
#include <vl/reflectedEntityList.h>
using namespace makVrf;
int main(int argc, char** argv)
{
//Create initializer object used to provide initialization data to the
//exercise connection, configured through command line arguments.
DtRemoteControlInitializer appInitializer(argc, argv);
appInitializer.parseCmdLine();
//Create the controller. This class used to be a DtVrfRemoteContrller, however, now changed
//to use the specific vrlink version of the remote controller to allow easier creation of
//a DtVrlinkNetworkNetworkInterface class to add to the communication manager
//Create an exercise connection
DtExerciseConn* exConn = new DtExerciseConn(appInitializer);
// If disableRemoteDiscovery is true, then the DtRemoteObjectManager will not be created. There is no need to create this manager (as in
// a remote control example) if the specific DtStateData and DtStateComponents do not want to be discovered. The last parameter disables remote
// discovery
controller->init(exConn, nullptr, nullptr, nullptr, nullptr, "entity-identifier", false);
controller->vrfMessageInterface()->setSessionId(appInitializer.sessionId());
// Start the local exercise clock
controller->communicationManager()->run();
//Create our text interface so we can enter text commands.
DtTextInterface* textIf = new DtTextInterface(controller);
// Add a reflected entity list to the textIf so its commands have access to the entities.
textIf->setEntityList(entList);
//Processing: read stdin and call drainInput.
//Calling drainInput() ensures that the controller receives
//necessary feedback from VR-Forces backend applications.
while (!textIf->timeToQuit())
{
textIf->readStdin();
controller->tick();
DtSleep(0.1);
}
delete textIf;
delete controller;
delete exConn;
return 0;
}

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)