VR-Forces 4.1 Class Documentation
12.5 - Handling Unachievable Tasks

The API has functions that let you write code to handle situations in which a task is unachievable.

For example, suppose you have a ground vehicle and you give it a task to move to a waypoint, but there is already an entity parked at that waypoint. In this situation, the entity would never be able to successfully reach the waypoint. It would continuously try to reach that point, until it ran out of fuel. Therefore, you would like to add some reasoning to the entity, so that as it approaches the waypoint, it can evaluate the situation and take some more sensible alternative action, such as parking nearby.

Handling unachievable tasks is done on a per DtTaskControllerComponent basis. It has member functions, decideToGiveUpTask() and giveUpTask(), that let you add code for handling unachievable tasks. The decideToGiveUpTask() is a function that returns a boolean flag indicating whether or not the entity should give up its current task. It is called immediately after every tick when the simulation is running (in play mode) and entity is tasked. If it returns true, then it calls giveUpTask(). The giveUpTask() function provides a place where any special handling, such as calling taskComplete(), can be added. By default, the function decideToGiveUpTask() returns false, and the giveUpTask() function has an empty implementation.

The decideToGiveUp example demonstrates how to use this feature.

[<< Deriving a New Task from DtSimTask] [Home] [Adding a User Task >>]


Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)