![]() |
VR-Forces Developer's Guide
|
The Add Set example creates a new "Set" command that allows a user to set an entity's ordered speed and heading.
When the command is initiated, specified and executed in the GUI by the user, a Set message will be sent to an entity-specific controller in the sim engine. The larger architecture of set commands in the VR Forces sim engine is described in Tasks, Sets, Commands, and Reports.
The Add Set sim engine example demonstrates the following:
The DtSetSpeedAndHeadingRequest class is a child of the DtSetDataRequest class, and is the central object defining a set command in the sim engine. The DtSetDataRequest contains the netRepSIze(), the setToNet() and setFromNet() methods used to send and receive set commands from the network. The derived class, DtSetSpeedAndHeadingRequest, contains the central parameters of the set command (mySpeed and myHeading) as well as their accessor and mutator methods. It also contains the creator() static method used by the factory to create the object, which is registered in DtInitializeVrfPlugin (plugin.cxx).
The series of new controllers classes in this example, MyHumanSetController, MyLocalEntitySetController, MyFixedWingSetController and MyAirVehicleSetController, are derived from the default set controllers DtHumanSetController, DtLocalEntitySetController, DtFixedWingSetController and DtAirVehicleSetController, respectively. They stand with very minor modifications - a processSpeedAndHeading() method that applies the commanded speed and heading to the proper entity SR, and a setSpeedAndHeadingCallback() that is registered with the DtSetDataManager for callbacks. All of the other methods for processing set commands are inherited and retained from the originating class.
The respective entity-specific default set controllers are overridden in the factory with the new set controllers in DtInitializeVrfPlugin (plugin.cxx).
In the Launcher, click the Plug-ins button to bring up the Plug-ins Selection dialog. Enable the plugin.
To view the new behavior:
Please note that "speed" refers to "ordered speed," i.e., the speed at which the entity will travel when it is tasked to move. If the entity does not have a destination or move task, setting "speed" to a non-zero value will not make the entity move.
| DtSetSpeedAndHeadingRequest | The subclass of DtSetDataRequest that is used to communicate the new set request. |
| MyLocalEntitySetController | The subclass of DtLocalEntitySetController that is used to implement the new set command. |
| MyGroundVehicleSetController | The subclass of DtGroundVehicleSetController that is used to implement the new set command. |
| MyAirVehicleSetController | The subclass of DtAirVehicleSetController that is used to implement the new set command. |
| MyFixedWingEntitySetController | The subclass of DtFixedWingEntitySetController that is used to implement the new set command. |
| MyHumanSetController | The subclass of DtHumanSetController that is used to implement the new set command. |