Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ XR Studio

TaskManager

  • Last UpdatedDec 07, 2023
  • 5 minute read

The TaskManager is a special node that runs a storyboard made up of several tasks nodes. The storyboard is like a workflow.

  • Define a task hierarchy to group tasks together logically.

  • During storyboard playing, many tasks can simultaneously be in running state. This gives the storyboard writer great flexibility.

  • The end tag must be used to terminate a task with success or with failure.

Platform support

This node is supported on XR-Windows platform only.

XR-WIN

XR-P-WIN

XR-P-IOS

XR-P-AND

XR-P-WASM

Full support

No support

No support

No support

No support

Full support

No support

No support

No support

No support

Task states

Each task can exist in four states.

Task State

Description

Waiting

The task is not active.

Running

The task is active.

Success

the task is ended with success.

Fail

The task has ended with some error.

Changing status of a task

There are two ways to set a task from waiting to running. Both ways can be used to start one or more tasks.

  • From another task activation using startTasks task parameter.

  • From another task end using startTasks end parameter.

Scores

Each task can be associated one or more score clauses. If the node changes its state to Success, the score is added to Task Manager score. Scoring has a hierarchical handling so for each task we are able to know its maximum possible score (summing its and its children scores) and current score.

There are two kinds of scores: shot and time.

Score type

Description

Shot

If the task ends with success adds the set amount of points.

Time

If the task ends with success adds an amount of points on time basis. It uses two parameters minTime and maxTime. If task is completed before the minTime the score value is totally added. If the task ends between minTime and maxTime the score is linearly decreased. If the task takes longer then maxTime nothing is added.

A task can have 0,1, or more score clauses.

There should alway be only one TaskManager running at a time inside an application.

Task management and multi-player

To enable more than a one person (players or instructor) to participate in the same scenario, the task management must be configured and managed in the proper way. You must locate and execute the Task management code (task completion, score calculation) in a unique place. This is generally the server of the message bus network. Each TaskManager must have mode set to master in a unique application node and to slave in all the others.

To enable master update, the slave parameter taskStates must be shared. Slave update includes only task state and not all the other information.

Code example

This is a code example for the TaskManager node.

<taskmanager name="tm_0" >

<task name="mission" startTasks="t1">

<task name="t1" title="Power On" description="" startTasks="t1_1">

<task name="t1_1" title="Turn Insulator Power On" description="Turn KSHEON to On" >

<end condition="@KSHEON.value@==1" />

<score value="5" type="shot"/>

</task>

<end condition="@tm_0.t1_1_state@==success" startTasks="t2"/>

<score value="50" type="time" timeRange="20 200"/>

</task>

</task>

</taskmanager>

TaskManager fields

These are the fields for TaskManager node. Only the node-specific fields are indicated, not fields obtained by inheritance.

Field inheritance: NodeBase > TaskManager

Fields

Type

Use

Default value

Description

currentScore

sfloat

Read only

Internally calculated

The current score. This is the sum of all the scores totaled in ended tasks.

getTaskDescription

sfunction

Read only

Internally calculated

Can be used to retrieve description for a specific task.

getTaskTitle

sfunction

Read only

Internally calculated

Can be used to retrieve title for a specific task.

mode

senum

Optional

Master

Must be set to Master on a unique application node and to Slave in all the others to enable task management synchronization.

reset

sevent

Optional

No default

Resets the TaskManager. All tasks return to Waiting state and timers and scores are reset to 0.

startTasks

mstring

Optional

Null

Triggers storyboard start.

stateChanged

sevent

Read only

Internally calculated

Sent whenever one or more tasks changes their state. Can be used to refresh.

stop

sevent

Optional

No default

Stops storyboard playing.

taskFail

sevent

Read only

Internally calculated

Sent whenever one or more tasks goes into Fail state.

taskStates

sstring

Read only

Internally calculated

Synchronizes task manager state across different application nodes.

taskSuccess

sevent

Read only

Internally calculated

Sent whenever one or more tasks goes into Success state.

timeFromStart

sfloat

Read only

Internally calculated

Time in seconds from storyboard start.

Task Attributes

The parameters of the task can be accessed with the syntax:

taskManagerName.taskName_taskField

For example: tm_0.t1_1_state

Attribute

Type

Use

Default value

Description

currentScore

sfloat

Read only

Internally calculated

Current score. The sum of all the scores in the task and its children.

description

sstring

Optional

Null

Description text. Usually refers to text in the localizaion.

Example: @lang:tmX.tY_desc@

maxScore

sfloat

Read only

Internally calculated

Maximum possible score. The sum of the task and its children.

setState

sstring

Optional

Forces change of state for a task. Supports all state types and all the possible transitions.

startTasks

mstring

Optional

Null

Triggers other tasks to start on activating the task, usually child tasks.

state

senum

Read only

Waiting

Gets current overall task score. Options are: Waiting, Running, Success, and Fail.

timeFromStart

sfloat

Read only

Internally calculated

Time in seconds from task start.

title

sstring

Optional

Task name

Usually refers to text in the localization.

Example: @lang:tmX.tY_title@

value

sstring

Optional

Null

Stores content related to the task, such as a score, a state, or other content.

End attributes

Nodes of this clause are conditional endings for a task, so there is no way to access their parameters from outside. They have no name parameter.

Attribute

Type

Use

Default value

Description

condition

sstring

Mandatory

No default value

Ending condition. The task ends when the condition returns True. It has the same syntax used in all the conditional fields in the scripts.

result

senum

Optional

Success

Defines whether the task must change its status to Success or Fail when the end condition is verified.

startTasks

mstring

Optional

Null

Triggers other tasks start (usually children) on ending the task.

Score attributes

The score nodes are attributes of a task, so their parameters are not accessible from outside. They have no name parameter.

Attribute

Type

Use

Default value

Description

alpha

sstring

Optional

1

Can be set to a variable or a constant in the [0 1] range to graduate the achieved score when type is Shot.

timeRange

svec2

Optional

0 10

Defines minTime and maxTime for scores of time mode.

type

senum

Optional

Shot

Specifies type as Shot and Time.

value

sfloat

Mandatory

No default value

The score value.

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in