VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
4.10 - The Task Manager

Table of Contents

Local entities that need to respond to and carry out tasks must have a Task Manager, DtSimTaskManager (taskMgr.h).

(Please see "Local and Remote Subcomponents" in VR-Forces Users Guide for information about configuring an object with a Task Manager.) The Task Manager works with an entity’s Component Manager to handle all tasks for a specific simulation object, skip task requests, and to report task completion to superiors and the entity’s Plan Manager. The Task Manager keeps a list of all components that have registered for various task types, and is responsible for notifying those task controllers when there is a task they need to execute. The Task Manager tracks which tasks will conflict with each other and clears out any conflicting tasks before starting a new task. The Task Manager does not handle the execution of specific tasks, such as Follow Route or Move To. The execution of specific tasks is handled by task controller components. The Task Manager is also responsible for reporting what tasks a simulation object is capable of executing. Any task type for which a controller has registered is considered to be a task which can be executed.

This section is primarily for conceptual purposes. As long as a simulation object has a Task Manager, there is very little that you as a developer need to do to make sure it is doing its job.

To access an entity’s Task Manager, do the following:

DtSimTaskManager* taskManager = vrfObject->taskManager();

The first time the Task Manager is ticked, it calls awaitingTask() on the DtPlan for the simulation object to get it to issue the first task from the plan.

The following sections explain several task management functions. You do not normally have to do anything special to implement them.

The Task Manager is also responsible for task interruption. It uses the task execution rules to know what types of tasks interrupt other types of tasks. When a new task is starting execution, the Task Manager checks the execution rules, and stops any top level tasks that are not allowed to run concurrently with the new task. Newer tasks always take precedence over older tasks. For details about configuring task execution rules, please see "Configuring Task Execution Rules", in VR-Forces Users Guide.

4.10.1 Reporting that a Task is Complete

The Task Manager sends Task Complete messages when a simulation object completes execution of a task or subtask. The task complete message contains the type of task completed, as well as the task ID, which was assigned to the task when it started. Controller components call DtSimTaskManager::taskComplete() to do this, passing in the original task. The Task Manager fills out the report and sends it to whoever originally issued the task. (The sender of the task may be the simulation object itself, in the case of a subtask, a superior unit, or a force-level unit.) It also calls awaitingTask() on the entity’s DtPlan to get it to issue the next task in the plan.

4.10.2 Skipping a Task

The skipTask() function handles DtIfSkipTask messages sent to the simulation object. In skipTask(), the Task Manager calls the Component Manager’s controller list clearTask(), and then calls awaitingTask(). This effectively causes the simulation object to stop executing any current task, and notifies a DtPlan (if one exists for the simulation object) that it is ready to receive its next task in the plan. Skip task messages are processed only if the simulation object is independently tasked or the message was sent from the entity’s superior.

4.10.3 Responding to the Tasked by Superior Request

When you task a simulation object from the GUI, you essentially remove it from the control of its superior in the simulation object hierarchy. This puts the simulation object into an ‘independently-tasked’ state - it no longer participates in the execution of tasks coordinated by its immediate superior. You can return control of a simulation object back to its superior by sending it a DtSetTaskedBySuperiorRequest (setTskBySupr.h) message. The local Task Manager handles these messages. In the taskedBySuperiorRequestCallback(), it sets the independently tasked state to false, returning control of the simulation object back to its superior simulation object.

4.10.4 Handling Clear Task Messages

Units can issue Clear Task requests to subordinates to manage how they execute a behavior. Each simulation object registers for these requests automatically through its Task Manager. To process the message, the local Task Manager looks up the task controller handling the type of task specified in the request. Then it invokes its clearTask() member function.

[<< Process State Repositories] [Home] [Top of Page] [The Set Data Manager >>]


Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)