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

Table of Contents

The Sim Engine 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 sim engine. It is a standalone console application that enables users to create/manipulate VR-Forces scenarios through a simple command line 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 Ala Moana.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 sim engine command line arguments from the Launcher UI. If using the HLA protocol, you do not need 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 "Ala Moana.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. Example inputs located in the source code are built for the Ala Moana.mtf terrain.

  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 sim engine.
  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.
DtCommandLineRemoteControllerThis 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.
*******************************************************************************/
//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)
{
// Resolve the connection settings directory and combine the path to include the default vr-link configuration file name.
const DtString& defaultConfigFilePath = DtFilename::combine(makVrf::DtAppPathResolver::Instance().connectionsSettingsDirectory(), DtDefaultConfigFile);
// Create initializer object used to provide initialization data to the
// exercise connection, configured through command line arguments.
DtRemoteControlInitializer appInitializer(argc, argv, defaultConfigFilePath);
appInitializer.parseCmdLine();
// Create the controller. This class used to be a DtVrfRemoteController, 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.
// Instantiate the remote controller before the DtExerciseConn to avoid requiring a VR-Link license.
// 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
remoteController->init(exConn, nullptr, nullptr, nullptr, nullptr, "entity-identifier", false);
remoteController->setMonitorBackendState(true);
remoteController->vrfMessageInterface()->setSessionId(appInitializer.sessionId());
// Start the local exercise clock
remoteController->communicationManager()->run();
// Create our command line interface so we can enter text commands.
DtCommandLineRemoteController* commandLineInterface = new DtCommandLineRemoteController(remoteController);
// Processing: read stdin and call drainInput.
// Calling drainInput() ensures that the controller receives
// necessary feedback from VR-Forces sim engine applications.
while (!commandLineInterface->timeToQuit())
{
commandLineInterface->readStdin();
remoteController->tick();
DtSleep(0.1);
}
delete commandLineInterface;
delete remoteController;
delete exConn;
return 0;
}

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)