VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
4.8 - 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 Configuration 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 entity, 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 an entity 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 an entity 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 entity 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 Configuration Guide.

4.8.1 Reporting that a Task is Complete

The Task Manager sends Task Complete messages when an entity 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 entity itself, in the case of a subtask, a superior aggregate, or a force-level aggregate.) It also calls awaitingTask() on the entity’s DtPlan to get it to issue the next task in the plan.

4.8.2 Skipping a Task

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

4.8.3 Responding to the Tasked by Superior Request

When you task an entity from the GUI, you essentially remove it from the control of its superior in the entity hierarchy. This puts the entity into an ‘independently-tasked’ state - it no longer participates in the execution of tasks coordinated by its immediate superior. You can return control of an entity 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 entity back to its superior entity.

4.8.4 Handling Clear Task Messages

Aggregates can issue Clear Task requests to subordinates to manage how they execute a behavior. Each entity 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 Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)