Task Scriptby Synthiam Inc.
Split complex tasks into several simple scripts. Each script is a stage of completing a task.
How to add the Task Script robot skill
- Load the most recent release of ARC (Get ARC).
- Press the Project tab from the top menu bar in ARC.
- Press Add Robot Skill from the button ribbon bar in ARC.
- Choose the Scripting category tab.
- Press the Task Script icon to add the robot skill to your project.
Don't have a robot yet?
Follow the Getting Started Guide to build a robot and use the Task Script robot skill.
How to use the Task Script robot skillSplit complex tasks into several simple scripts. Each Script is a stage of completing a task, executed one after another. A large, seemingly overwhelming task will be transformed into a set of smaller, more manageable microtasks that can each be accomplished independently. For example, you can use this to have your robot navigate into a room, look for an item, move toward the object, pick up the article, and return to another point. Each task step is split into stages with a script for each stage.
A task contains multiple scripts that may include programmatic logic or instructs other robot skills. When each Script is completed, it waits until it receives the ControlCommand NEXT signal, which moves to the following Script. You can also have the task canceled by sending the ControlCommand() CANCEL.
Makes Asynchronous Synchronous
It is easy to think of a task as having multiple smaller steps. However, today's computers and software use an asynchronous execution model known as multitasking. Robot skills will each run their functions independently of each other. In ARC, there may be many robot skill processes running at the same time.
Because robot skills are asynchronous, they do not pause the execution of a calling script when using the ControlCommand() command.
As you can imagine, calling ControlCommand() to robot skills and not knowing when they have completed their ask makes it challenging to create a synchronous step-by-step task. Using the Task Script, each step can instruct a robot skill to perform a function, wait for the process to complete, receive the data from that function, and move to the next step of the task.
How does the task know when to move to the next step? The task knows to move to the next step when the other robot skill uses the ControlCommand to send the Task Script the NEXT signal. That will instruct the task to advance to the next step. The next step will now be able to obtain the data from the robot skill.
Here is an example of a task "Go to the kitchen and get me a soda." The project will have a movement panel, lidar sensor, The Better Navigator, and this robot skill. The task will save the current location, navigate to the kitchen, announce to whoever is there that it needs a soda repeatedly until it hears the OK response, returns to the original location, and announce that it has returned with a soda.
Each step of the task waits for the ControlCommand NEXT to be sent. When completed, this can be sent by the Script within the Task Script itself or by an external script. You can see both used in this example. Some of the Task Scripts will call the ControlCommand NEXT to advance to the next item in the list. Otherwise, you can see The Better Navigator sending the ControlCommand NEXT when it has completed navigating.
Task: Go to the kitchen and get me a soda
You can manually start tasks in the main window, choose a task, and view the log information. These tasks can also be executed by the ControlCommand programmatically.
Configuration - Tasks
1) Add a new task button
This button will add a new task tab below. You can add as many tasks as you like. Each task contains as many scripts as necessary.
2) Task Name
The task's name will appear in the dropdown and ControlCommand() list.
3) Task Description
The description of the task is for your reference. This is not used anywhere other than displayed back to you. It allows you to keep detailed notes on what the task does.
4) Start Script
This Script will execute when the task begins.
5) Cancelled Script
This Script will execute when the task has been canceled. This will execute before the Completed Script if the task is canceled.
6) Completed Script
This Script will execute when the task has been completed. This also runs when the Script is canceled.
7) Script Controls
These allow for inserting and managing scripts. You can move scripts up and down, or insert, delete and append new scripts.
Each Script is executed from the top down. When a script is completed, it will wait for the ControlCommand NEXT to be sent. When it receives the signal, it will execute the following Script in the list.
A few variables are set to make interacting with this robot skill easier.
Holds true (1) or false (0) if a task is currently running
An array of task names.
You can interact with the robot skill through the ControlCommand of other robot skills.
ControlCommand("Task Script", "Start", "Task Name")
This starts a task from another robot skill programmatically
ControlCommand("Task Script", "Next")
Each Script waits for a signal before executing the following Script when a task is running. A script can call this command within the task or externally from another robot skill.
ControlCommand("Task Script", "Cancel")
Cancels a task that is running.