![]() |
VR-Forces 4.6.1 Class Documentation
|
If you want to derive a new task from DtSimTask, you have to complete the following general steps:
The first step in creating a new task type is to create a new task class derived from DtSimTask. You need to assign it a unique integer type to identify the task (task type names are defined in radioMsgTypes.h). The entity’s controllers use the task type to determine how to handle an incoming task.
The DtSimTask class has the following pure virtual member functions that you must override in the derived task:
To make your new DtSimTask capable of being sent over the network, as part of a DtTaskMessage or as part of a DtIfPlan message, you must override the following member functions in your derived task:
Once you have defined a new task and have registered the task with the factory, add a new controller to the simulation object to carry out the action described by the task. To do this, you must derive a new controller from DtTaskControllerComponent. (For details, please see 5.2.7 Controller Components.) The new controller must have a unique string type and must be registered with the corresponding component factory.
In your new task controller component, you must override registerTaskMsgCallbacks() to register your callback function for handling the new task. Once it is registered, your callback function will be called when a message of the new derived type is received on its radio net. In your callback (actually, in a virtual member function of your controller, called from the static callback), extract the necessary data from the task message parameters and start executing the task.
The addTaskSim example demonstrates how to add a new kind of DtSimTask to the back-end.
[<< Adding a New Task for a Simulation Object] [Home] [Top of Page] [Starting and Processing C++ and Scripted Tasks >>]