15. Programming Introduction

Synthiam has developed the ARC software to scale between beginner and advanced users. Our mission is to make robot programming accessible and increase the likelihood of success. Within the configuration dialog of nearly all skill controls is the ability to edit scripts to define specific programmatic behaviors, such as when to start tracking using the camera. The script editors are input fields with a pencil icon to the right. In this example, we are displaying the configuration dialog for the WiiMote.


Editor Dialog

The editor dialog consists of an input section on the left and reference assistance on the right. The window can be resized or maximized; remember the last size for future use.


Program in Multiple Languages

The programming language tab will be selected if there is existing code in the editor when it loads. Alternatively, if you are editing a blank script, there will not be any code, and you can select the tab for the programming language you wish to use. If there is existing code, changing the programming language will present a confirmation that you want to erase the current code and start over.


Introducing the Control Command

Programming in ARC is straightforward because you will leverage robot skills' functionality. Whichever programming language you choose below, most of your programming will link robot skills together using the ControlCommand.

You are familiar with Robot Skills by reaching this far in the Getting Started guide. There are plenty of windows within the ARC project desktop, and each window is a robot skill control. A robot skill control is a little program that runs within ARC created by one of our many partners. For example, hundreds of robot skill controls are available in the Robot Skill Store, such as gpt-3, vision detection (face, emotion, color, glyph, etc.), servo gait/animation, speech recognition, etc. Each robot skill control is a behavior that gives your robot more ability. These robot skill controls are separate programs that do something specific, such as processing video image data from the camera or moving servos in animations. Because each robot skill control is a particular program, ARC provides a mechanism for robot skills to talk to each other. This mechanism is called the ControlCommand().

Using control commands, an event of one robot skill can instruct another robot skill to do something. For example, if the Speech Recognition control detects the phrase "Follow My Face," the respective code may be instructed to inform the Camera control to enable Face Tracking.

Capture.PNG

This detailed example detects speech recognition text and uses cognitive services for more extensive messages. The manuals for each robot skill will be essential to review when creating projects.

For further reading about the ControlCommand and how it works, we recommend reading its dedicated manual page here.


Choose Programming Environment

We have provided access to various programming methods to accommodate all users. Once you are ready to begin programming a robot, select a programming skill level.


Roboscratch

(Very easy)

Designed for learning the basics of programming, RoboScratch introduces a programming interface exclusive to ARC. With RoboScratch, function blocks are added to the workspace to create a sketch. Some blocks include waiting for the camera to see an object, waiting for speech, or executing a movement action. Link blocks to instruct robots to perform behaviors and complete tasks.

Learn More

Blockly

(Easy)

Blockly programming provides the user with graphical blocks representing programming functions or subroutines. This allows users to access advanced technologies creatively without knowing the programming syntax by typing with a keyboard.

Learn More

Scripting

(Intermediate)

Syntax programming is available in three scripting languages JavaScript, EZ-Script, and Python. All robot skills support scripting languages interacting with each other for custom behaviors. Using the powerful ControlCommand messaging system, have events from robot skills send triggers to other robot skills within the project.

Javascript

EZ-Script

Python

Programming

(Advanced)

Compile programs and libraries which interface with the ARC API. Make robot skills to distribute in the robot skill store or use the existing framework to accelerate robot development. Access existing robot skills or the ARC API framework with C++, C, C#, VB, and more.

Learn More


Scripting Robot Skills

Nearly all robot skills have the option to execute a script. However, there are robot skills specific to scripting. These scripting robot skills allow you to run programs or customize features, such as creating a custom movement panel.

This skill gives you a console directly to the EZ-Script engine. You can execute commands in real-time. A history of your commands is saved and can be recalled using the UP and DOWN arrow keys. Main Window 1. Clear Button This button clears the console display. 2. Console Display Displays the scripts added to the console text field. 3. Console Text Field This is a text field to enter scripts into, a single line at a time, in real-time. Hit enter to execute the script. How to use Script...


This skill adds a new ez-script function GetLineContainingFromArray() that will return an item from the array that contains the specified text.  Main Window 1. Start Button Once the Get Line Containing From Array Skill is loaded you will need a Script skill to access its features. Once Get Line Containing From Array code is loaded into the Script skill use the Start button to activate it.  How to Use Get Line Containing From Array 1) Add the Get Line Containing From Array Skill (Project - Add...


This skill allows you to trigger scripts based on the robots movement. It is best to understand what a movement panel is by reading this support document first. For example, all Movements are global. So if you use a Movement Panel of any kind, this skill will execute the script for the movement direction that was activated, such as if you have a Modified Servo Movement Panel and press FORWARD, the respective Forward Script in the settings of this skill will execute. You can assign a...


This skill will execute a script when a variable has changed. Add the variable to watch, and a respective script. When the variable has changed, the script will run. Main Window 1. Status Display Displays variable changes. Configuration 1. Variable Name Field Enter in a variable name. 2. Script Field Enter in a script that you would like to execute when the variable changes. 3. Row Manipulation Buttons Move, Delete, Insert, or Append the rows that you have entered. How to Use On Variable...


This control uses a random-like algorithm to add a unique personality to your robot. By adding script commands to the Config section, the commands will be executed within the specified High/Low timeframe (in seconds). This control can run in the background while your robot operates. The control will add unique actions that you create. For example, add script commands such as: - left(1000) - right(1000) - SetServo(d1, 20) - ServoRandom(d1, 1, 30) - ControlCommand(ScriptStart, Flash Eyes) -...


This skill is a mimic tool. You perform specific actions while the skill records communication between the EZB and your PC (movement, servo positions, digital set, etc.). It then allows you to play those actions back on demand. You can save many recordings and trigger them from scripts. To create multiple recordings, add, and rename several instances of the Recorder skill. *Note: This skill isnt a macro recorder. It doesnt record your actions across the windows on your PC. It doesnt record...


The script skill is very versatile; it can interact with most ARC skills. It is also very intuitive, as it contains multiple detailed manuals for assistance with programming in its settings menu. The Script skill currently includes the following languages to program in: Blockly Javascript EZ-Script Python Main Window 1. Start/Stop Button Executes the script that is written in this skill. 2. Status Display Displays the status according to the script written in this skill. Settings -...


Execute a JavaScript or Python script to automate a process and control other robot skills.


This control holds many scripts. Rather than having one control per script, this contains many. Like the regular Script control, you can execute scripts within the Script Manager using the ControlCommand(). Here is an example that will execute a script within the Script Manager named MyScript. ControlCommand(Script Manager, ScriptStart, MyScript) To view all available ControlCommand()s, use the Control Details tab when editing the script. This will show all ControlCommands() for all controls...


This is a diagnosing tool to identify scripts that are running. Many skills have script events that are triggered based on activity. For example, a Wii Skill will execute a script when a button is pressed. Because these scripts are executed in the background, this skill lets you monitor the activity. If your script has a loop, it may run extra long. Using this monitor; you can see which scripts continue to run. Main Window 1. Script Labels These labels are the titles of each script skill you...


Bind a script to servo position movements. This allows you to create scripts that run each time a servo is moved. A good use case for this is to control a smart serial-style servo as a real servo by binding to a specific servo port. If you had a servo that worked via Serial UART and wanted it to operate as a regular ARC servo, you could write code here to bind to it.  The alternative method would be creating your behavior control that binds to the servo movement event. This is covered in the...


There are so many ways to present visual feedback with this skill. The Sketch Pad allows you to draw with controlCommand() from a script. You can create scripts that draw object locations in a room or display information from the path the robot has driven. You can also display custom face emotions using simple graphic shapes of circles, squares, and rectangles. Use your creativity to visualize robot data! *Note: For usage information, reference ARCs example folder for a SketchPad project. Main...


This skill operates similarly to the Servo Slide controls but adjusts the specified variable with a slider. You can also specify a script to execute when the slider value has been reached. Main Window 1. Slider Press and hold the left mouse button in this area to adjust the slider value. The slider value will be displayed here, and it will be between the minimum and maximum values set up in the skill settings. 2. Bonus Button This button is only available when a script is added to the Button...


This is a smarter variable watcher that replaces the standard built-in version. This version uses less CPU for large projects. When large arrays are defined, it may take a long time for the grid to render the data. However, once rendered, the data will update much faster than the ARC built-in variable watcher.  1) The name of the variable. The variables in [ brackets ] are internal values and are not variables. For example, the volume or speed are set with functions. They are displayed here for...


This has been replaced with the Sound Script robot skill: https://synthiam.com/Support/Skills/Audio/Speech-Script?id=20204


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


Add custom ez-script functions in c# using this example. The source code is available here: UserDefinedFunctionExample.zip Additional tutorial information can be found here: https://synthiam.com/Support/Create-Robot-Skill/Examples/Example-Custom-EZ-Script-Function Optionally, you can create custom JavaScript functions with these instructions: https://synthiam.com/Support/Create-Robot-Skill/Examples/custom-javascript-extension There is also an example code below the video.


The Variable State Server skill allows a robot to retain important variable data between sessions, enhancing its ability to remember past interactions or states, thus providing users with a more consistent and personalized experience. By enabling automatic or manual saving and loading of variable states, this skill ensures that a robot can quickly restore its operational context upon startup, making it more efficient and adaptable to ongoing tasks and user preferences. If you have some variables...


This skill views the known script variables and their respective values. Variable Watch automatically refreshes to show variable values. This is a great skill for debugging your programs and viewing the variable data. *Note: It is advised to run the Smart Variable Watcher robot skill instead of this. This skill may cause performance challenges with your program. Only use this skill for debugging purposes. Main Window 1. Variable Display This area displays the variable name, its type, its...