Conversational Menu icon Conversational Menu Voice menu tree to navigate options and run scripts on ARC robots. Multi-level, customizable prompts, speech I/O, timeout and repeat/back. Try it →
Asked
Resolved Resolved by Synthiam Support!

AI Scripting In ARC?

I know I can ask for JavaScript writing help here on the forum from Athena. I thought I read a while ago that this feature is also available directly in ARC (so you don't have to come to the forum) when writing a script. I have looked through ARC's scripting Robot Skills and the Script Editor, and I have searched forum topics, but I can't find any information on doing this.

If AI-assisted scripting is available directly in ARC, could you please show me how to access it (for JavaScript or Python scripts)? Also, please provide a link to the Synthiam Help documentation that explains how to use that feature. Thanks.



Related Hardware (view all EZB hardware)
EZ-B V4 by EZ-Robot
EZ-B v4/2 robot controller: dual Cortex ARM, Wi-Fi, audio/video, 24 servo/digital ports, I2C/UART, camera and Synthiam ARC control for custom robots
Wi-Fi / USB
Servos 24
Camera
Audio
UART 3
I2C
ADC 8
Digital 24

Related Robot Skills (view all robot skills)
Script by Synthiam
Multi-language ARC Script: build, run and debug Blockly, JavaScript, EZ-Script or Python with Intellisense, run/save/load and Roboscratch support
ChatGPT conversational AI for ARC robots-configurable personality, memory, image description, script execution, speech and API integration.

ARC Pro

Upgrade to ARC Pro

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.

#9  

Wow, that's simply mind blowing. I knew that there is an area in the scripting skills that lets you describe what your script does. I didn't know about being able to describe global variables. I need to look closer at all this and see how I can add these descriptions. I have so many script and global variables that I use (a lot of them are loaded on start up) that I sometimes have trouble remembering myself what they do. LOL.

@Athena, can you let me know how I can add a description of a global variables so ARC (and me) can keep track of what it does?

Author Avatar
PRO
Canada
Twitter YouTube GitHub
#10  

Absolutely - adding descriptions to global variables in ARC is a great way to keep your projects organized, and it also helps ARC’s AI tools understand your project better.

How to add a description to a global variable

In JavaScript or Python, you add a description as the 3rd parameter when creating or updating a global variable:

setVar("$BatteryLevel", 87, "Current battery percentage reported by the robot");
setVar("$LastUserName", "Dave", "Most recently recognized user");
setVarObject("$LastDetection", detectionObject, "Most recent camera detection object");

What this does

  • "$BatteryLevel" is the global variable name
  • 87 is the value
  • "Current battery percentage reported by the robot" is the description ARC stores with that variable

That description will then show up in ARC’s variable tools and help keep things clear later.

If the variable already exists

You can update the description by calling setVar() again with a new non-empty description:

setVar("$BatteryLevel", 90, "Battery percentage read from the charger monitor");

If you pass an empty string as the description, ARC keeps the existing description.

Important note

This works for:

  • setVar()
  • setVarObject()

For global arrays, you can still create them with setVar(), and if needed, you can describe what the array is for in that same call.

Where this helps in ARC

Descriptions are useful in:

  • the Variable Picker
  • the Variable Watcher
  • project maintainability
  • future AI-assisted scripting and analysis

Helpful docs

Best practice

If you have a lot of startup variables, I’d recommend creating a simple naming convention like:

  • $BatteryLevel
  • $ServoHomePositions
  • $IsDocked
  • $CurrentMode

and giving each one a short description.

If you want, I can also show you how to list your existing variables and add descriptions in a startup script so you can clean up a whole project quickly.


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  

@Athena, this is exactly what I needed to know.

You offered so please: Show me the best way as to how to list my existing variables and add descriptions in a startup script so I can clean up a whole project quickly, For reference here is a list of the global Variables I currently have in my Int script that loads at start up.

Thanks.

setVar( "$Personality", 0); //Sets Global Variable so next button push will turn Personalilty Off
setVar( "$adcSoilSpecified", 200 ); //Global Variabl Value for Soil Sampler ACD Port
setVar( "$adcpersonalitySpecified", 200 );//Global Variabl Value for Gamma 101 Chest Button ADC Portr
setVar( "$adcVoiceSpecified", 230 ); //Global Variabl Value for 202 Phase Chest Button ADC Port
setVar( "$Speech", 0 ); //Sets Speech Global Variable to show unpaused (Runnung)
setVar( "$Rt_ARS_Extended", 0 ); //Sets Rt ArS Carrage in or out Global Variable 0=in, 1=out
setVar( "$Lft_ARS_Extended", 0 ); //Sets Left ARS Carrage in or out Global Variable 0=in, 1=out
setVar( "$ADC_Lft_Elbow", 0 ); //Sets Clobal ADC variable reading left Elbow opto switch to "not centered so script will run"
setVar( "$ADC_Rt_Elbow", 0 ); //Set Global var reading Rt Elbow opto switch to "not centered so script will run"
setVar( "$Both_ARS_Extended", 0 ); //Set Global var
setVar( "$single_smith", 0 ); //Set Global var for single impression
setVar( "$single_will", 0 ); //Set Global var for single impression
setVar( "$single_tufeld", 0 ); //Set Global var for single impression
setVar( "$single_john", 0 ); //Set Global var for single impression
setVar( "$single_Maureen", 0 ); //Set Global var for single impression
setVar( "$single_don", 0 ); //Set Global var for single impression
setVar( "$single_judy", 0 ); //Set Global var for single impression
setVar( "$single_penny", 0 ); //Set Global var for single impression
setVar( "$single_r2d2", 0 ); //Set Global var for single impression
setVar( "$single_wall_e", 0 ); //Set Global var for single impression
setVar( "$single_hal9000", 0 ); //Set Global var for single impression
setVar( "$single_bender", 0 ); //Set Global var for single impression
setVar( "$single_robbie", 0 ); //Set Global var for single impression
setVar( "$single_Thadious", 0 ); //Set Global var for single impression
setVar( "$Lft_Elbow_Adjusting", 0); //Sets global variable telling elbow is not adjusting to center
setVar( "$lft_Elbow_Stop_Position", 2460); //Sets global variable of elbow center stopping position 
setVar( "$Rt_Elbow_Stop_Position", 2460); //Sets global variable of elbow center stopping position 
Author Avatar
PRO
Canada
Twitter YouTube GitHub
#12  

Yes - the best way is to centralize all of your startup globals in one script, and give each variable a clear description right in the setVar() call. That way, you can read it later, and ARC can use the metadata too.

Use this format:

setVar("$VariableName", value, "Short description of what this variable means");

If a variable already exists, calling setVar() again with the description updates it.


Your list cleaned up with descriptions

Here’s your startup list rewritten in a clearer way:

setVar("$Personality", 0, "Personality mode toggle. 0 = off, 1 = on.");

setVar("$adcSoilSpecified", 200, "ADC threshold for the soil sampler button/input.");
setVar("$adcpersonalitySpecified", 200, "ADC threshold for the Gamma 101 chest button input.");
setVar("$adcVoiceSpecified", 230, "ADC threshold for the 202 Phase chest button input.");

setVar("$Speech", 0, "Speech state. 0 = running/unpaused.");

setVar("$Rt_ARS_Extended", 0, "Right ARS carriage position. 0 = in, 1 = out.");
setVar("$Lft_ARS_Extended", 0, "Left ARS carriage position. 0 = in, 1 = out.");
setVar("$Both_ARS_Extended", 0, "Both ARS carriages state.");

setVar("$ADC_Lft_Elbow", 0, "Left elbow opto switch ADC state. Used to detect not-centered position.");
setVar("$ADC_Rt_Elbow", 0, "Right elbow opto switch ADC state. Used to detect not-centered position.");

setVar("$single_smith", 0, "Single-impression flag for Smith.");
setVar("$single_will", 0, "Single-impression flag for Will.");
setVar("$single_tufeld", 0, "Single-impression flag for Tufeld.");
setVar("$single_john", 0, "Single-impression flag for John.");
setVar("$single_Maureen", 0, "Single-impression flag for Maureen.");
setVar("$single_don", 0, "Single-impression flag for Don.");
setVar("$single_judy", 0, "Single-impression flag for Judy.");
setVar("$single_penny", 0, "Single-impression flag for Penny.");
setVar("$single_r2d2", 0, "Single-impression flag for R2D2.");
setVar("$single_wall_e", 0, "Single-impression flag for WALL-E.");
setVar("$single_hal9000", 0, "Single-impression flag for HAL 9000.");
setVar("$single_bender", 0, "Single-impression flag for Bender.");
setVar("$single_robbie", 0, "Single-impression flag for Robbie.");
setVar("$single_Thadious", 0, "Single-impression flag for Thadious.");

setVar("$Lft_Elbow_Adjusting", 0, "Left elbow adjusting state. 0 = not adjusting, 1 = adjusting.");
setVar("$lft_Elbow_Stop_Position", 2460, "Left elbow center stop position.");
setVar("$Rt_Elbow_Stop_Position", 2460, "Right elbow center stop position.");

Best practice for cleanup

Since you have a lot of startup variables, I recommend this approach:

1. Put all startup globals in one script

Call it something like:

  • InitGlobals
  • StartupVariables
  • ProjectSetup

2. Group them by purpose

For example:

  • Personality / speech
  • ADC thresholds
  • ARS carriage states
  • Elbow calibration
  • Single-impression flags

3. Add comments only as a supplement

Your comments are good, but the description field inside setVar() is what ARC can understand better.


Even better: use section labels

You can make the script easier to read like this:

// ============================
// Personality / Speech
// ============================
setVar("$Personality", 0, "Personality mode toggle. 0 = off, 1 = on.");
setVar("$Speech", 0, "Speech state. 0 = running/unpaused.");

// ============================
// ADC thresholds
// ============================
setVar("$adcSoilSpecified", 200, "ADC threshold for the soil sampler button/input.");
setVar("$adcpersonalitySpecified", 200, "ADC threshold for the Gamma 101 chest button input.");
setVar("$adcVoiceSpecified", 230, "ADC threshold for the 202 Phase chest button input.");

That makes it much easier to maintain.


Important note about your current variable names

A few of your names could be made more consistent, for example:

  • $adcpersonalitySpecified maybe $adcPersonalitySpecified
  • $single_Maureen mixed capitalization compared to the others
  • $Lft_Elbow_Adjusting and $lft_Elbow_Stop_Position should probably match case more consistently

ARC will still use them, but consistency helps a lot when your project gets big.


If you want to add descriptions to already-existing variables

Just call setVar() again during startup with the same value and a description:

setVar("$Personality", 0, "Personality mode toggle. 0 = off, 1 = on.");

That’s enough to store the description going forward.


Optional improvement: use arrays for the "single_" flags

If those flags are all doing the same thing, you may eventually want to convert them into an array or object instead of many separate variables. That makes the project easier to scale.

If you want, I can help you do that later in JavaScript, which would be cleaner than keeping 15+ individual flags.


Helpful docs


If you want, I can take your full startup variable list and rewrite it into a polished ARC JavaScript initialization script with cleaner naming and grouped sections.


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  

Ya! I updated ARC with the latest version that included the new AI scripting tool. This tool is so seamless in ARC. I then bought $20 in AI credits and it gave me 100 credits. I then asked for a simple javascript. It worked like magic. What fun!

After this one simple script I still have 99 credits left. I'm looking forward to playing around with this and learning the best way to use it.

Thanks for this amazing update. I know there was a lot of work put into this by the Synthiam team.

📚 This thread has been preserved as a helpful resource!

While new comments are no longer being accepted, the information here remains available for learning and reference. Check the most recent comment for additional details.