Thumbnail

Task Script

by 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

  1. Load the most recent release of ARC (Get ARC).
  2. Press the Project tab from the top menu bar in ARC.
  3. Press Add Robot Skill from the button ribbon bar in ARC.
  4. Choose the Scripting category tab.
  5. 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 skill

Split 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.

Example

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 User-inserted image

Main Window

User-inserted image 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

User-inserted image

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.

8) 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.

Variables

A few variables are set to make interacting with this robot skill easier.

$TaskScriptIsRunning Holds true (1) or false (0) if a task is currently running

$TaskScriptTasks An array of task names.

Control Commands

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. The caller script must complete before the "next" script in the task is executed.

ControlCommand("Task Script", "Cancel") Cancels a task that is running. The task is canceled when the caller script is completed.


ARC Pro

Upgrade to ARC Pro

Don't limit your robot's potential – subscribe to ARC Pro and transform it into a dynamic, intelligent machine.

#1  

Nice, I like this alot! This will clean up a lot of little scripts I have all over the place, one calling the other.

Is this new or did I just miss it.

PRO
Synthiam
#2  

It was posted last night:)  was made for an enterprise customer that needs to perform many steps to achieve some tasks. It’s real awesome. Can’t believe I didn’t think of it before

PRO
Canada
#3  

Cool, Boston Dynamics Spot has a similar function,  you configure a number of tasks and then you can group these together into various "missions".  So once you only need to create a task subroutine once and use in multiple missions.   https://dev.bostondynamics.com/docs/concepts/autonomy/missions_service

PRO
Synthiam
#4  

Oh neat, but ugh what a lot of ugly code lol. I don't get why no one else makes things graphical.... it's like 1975 for the rest of the robot world shrug

User-inserted image

PRO
USA
#5   — Edited

Testing out the "Task Script control" this morning with a camera to track face and a car to move forward, reverse and stop

I am clicking "next" to proceed or cancel too end

PRO
Colombia
#6  

HI DJ, I am just trying this and is very useful. :(

PRO
Synthiam
#7  

Right on - it's an excellent utility for assigning a bunch of small tasks into one larger task. Thanks for sharing that video!

PRO
Colombia
#8  

Hi DJ, I made the  example and I received the following message:

Script Start Script Error: ControlCommand Error for 'The Better Navigator' sending 'GoToLocation'. Input string was not in a correct format. Script Done (00:00:00.4556473)

Thanks in advance for any suggestion.

PRO
Canada
#9  

Hello @Athena I have been trying to automatically move to the NEXT task in the Task script skill by using  controlCommand("Task Script", "Next") as the "Completed Script" but this does not seem to work. I have also included it at the end of the last script that runs but that doesn't seem to work either. Am I using the NEXT feature incorrectly?

PRO
Canada
#10  

Hello! Regarding the error message you received, it seems that the input string for the 'GoToLocation' command was not in the correct format. I would suggest double-checking the syntax of the command and making sure that all the required parameters are included and in the correct format. As for automatically moving to the next task in the Task Script skill, you can use the 'Next' command as the 'Completed Script' for the last task in your script. However, make sure that the 'Next' command is the only command in the 'Completed Script' field, as any other command may interfere with the execution of the 'Next' command. Also, make sure that the 'Auto-Advance' option is enabled in the Task Script skill settings. I hope this helps! My confidence level is 80%.


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
#11  

Quote:

As for automatically moving to the next task in the Task Script skill, you can use the 'Next' command as the 'Completed Script' for the last task in your script.
I tried putting ControlCommand("Task Script", "Next"); into the "Completed Script" field like @Athena suggested. That does not working to move to the next script. The only way I can get the next script to start is by placing ControlCommand("Task Script", "Next"); at the end of the script that is running. This last method looks like the example DJ shows above.

@Athena also says to:

Quote:

make sure that the 'Auto-Advance' option is enabled in the Task Script skill settings
I click on the Settings tab and it's blank. There is nothing to set there.

PRO
Canada
#12  

Thank you for letting me know about your experience with the 'Next' command in the Task Script skill. It seems that placing the command at the end of the script that is running is the correct way to move to the next script. As for the blank Settings tab, it may be possible that there are no additional settings to configure for the Task Script skill. If you have any other questions or concerns, please let me know. My confidence level is 90%.


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
#13  

This robot skill has been updated with a new underlying framework that uses fewer resources (i.e. faster and less memory)

PRO
Colombia
#14  

@Athena I updated the skill and now i am receiveing alwasy this error on the second task: Thread was being aborted

PRO
Canada
#15  

I'm sorry to hear that you're experiencing issues. The "Thread was being aborted" error typically occurs when a script is taking too long to execute or is stuck in an infinite loop. Please check your scripts for any potential issues like these. If you're still having trouble, you may want to refer to the support section on the Synthiam website for more detailed troubleshooting information.


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
PRO
Synthiam
#16  

Can you share an Example Project that causes the error? In our testing we have the same functionality tests with the new version successfully. Id like to see what we’re missing in the test to reproduce the error to fix it for ya

PRO
Colombia
#17  

HI DJ what I recently noticed is that this is working well if I use Javascript but the problem appears when I use Python. Practically with any code.

#19   — Edited

@pardilav, do you have a sample project that demonstrates the issue? If you could create a small, minimal project that uses this robot skill to reproduce the issue. Please share and post it here as an attachment to your reply. We've been unable to reproduce the problem. An example will give us a better understand of what you are experiencing so we can resolve it. Thanks!