Sigma How to Define Tasks - chitsaw/psi GitHub Wiki
Sigma Task Definition
Sigma can help guide users through tasks that are predefined in a .json file. The file is part of Sigma's persistent state, and is pointed to by the Sigma server configuration file under the <PersistentStateFilename>
tag. For instance the following entry in the server configuration file:
<PersistentStateFilename>C:\psi\Applications\Sigma\Sigma\Resources\sigma.state.diamond</PersistentStateFilename>
specifies that the persistent state is saved at that location on disk. The tasks are specified in a file that has the same name and .tasklibrary.json
appended to it. So, in the case above the task definition file is at C:\psi\Applications\Sigma\Sigma\Resources\sigma.state.diamond.tasklibrary.json
. Here is a link to an existing sample task library file in the repo.
The first few lines of this file look like this:
{
"Tasks": [
{
"Name": "Replace a hard-drive in a PC",
"Steps": [
{
"$type": "Sigma.GatherStep, Sigma",
"Label": "1",
"Verb": "Gather",
"Noun": "Objects",
"Objects": [
"hard-drive",
"screwdriver"
]
},
{
"$type": "Sigma.ComplexStep, Sigma",
"Label": "2",
"Description": "Open the PC case",
"SubSteps": [
{
"$type": "Sigma.SubStep, Sigma",
"Label": "1",
"Description": "Unscrew the case screw using the screwdriver.",
"VirtualObjects": [
{
"Name": "Unscrew PC case",
"ModelType": "Half circle",
"SpatialPose": {
"$type": "Sigma.AtKnownSpatialLocation, Sigma",
"SpatialLocationName": "unscrew PC case"
}
}
]
},
{
"$type": "Sigma.SubStep, Sigma",
"Label": "2",
"Description": "Pull the handle and open and remove the case lid. Place the case lid on the table next to you.",
"VirtualObjects": [
{
"Name": "Open PC case",
"ModelType": "Quarter Circle",
"SpatialPose": {
"$type": "Sigma.AtKnownSpatialLocation, Sigma",
"SpatialLocationName": "Open PC case"
}
}
]
}
]
},
...
...
The library consists of an array of tasks. Each task has a Name
(in the example above "Replace a hard-drive in a PC"), and an array of steps. The $type
parameter for each step specifies the type of the step. Sigma currently supports GatherStep
, ComplexStep
and DoStep
step types.
A Gather
step can specify a set of objects (or tools, ingredients, etc.) that the system will instruct the user to gather. A DoStep
contains a simple description of an instruction to execute. The ComplexStep
is a step that decomposes into a number of sub-steps.
The task library therefore contains a .json-serialized version of the corresponding data types in the code, see more in GatherStep.cs, ComplexStep.cs, DoStep.cs.