Index
Every group of JavaScript commands in ARCx at a glance: what each group is for, and every command in it. Click a group to open its page, or a command to jump straight to it. There are 306 commands in 24 groups.
Commands are written as the group, a dot and the command, such as Servo.setPosition(d0, 90). The commands in Built-in need no group name. The JavaScript page under Scripting explains the language, how the commands are written, and has examples to start from.
Where to find it: the same list is in the ARCx API view of the script editor
Groups
| Group | What it covers |
|---|---|
| Built-in | The commands every JavaScript script can use without naming a group, the port names, and the list of connected controllers. |
| ADC | Read the analog (ADC) ports of an EZB. |
| Audio | Make the robot speak and play sounds, set the volume, and wait for the person to say one of a list of phrases. |
| Browser | Open web pages, dashboards, video calls and kiosk screens in browser windows on the monitors of the computer ARCx runs on, and control them: move them between monitors, go full screen, run JavaScript inside the page, and pass messages between the page and your script. |
| Bus | Share data with the rest of the robot through the Robot Bus: publish messages on topics and read them back, call services that robot skills, ARCx and other programs provide, look up where one frame is from another, and record topics to play back later. |
| COM | Use the serial (COM) ports of the computer ARCx runs on, such as a USB to serial adapter or an Arduino plugged in by USB. |
| console | Write to the script console, in the style of a web browser's console, and measure how long things take. |
| Digital | Read and set the digital ports of an EZB. |
| EZB | Information about the EZB controllers: whether one is connected, its battery voltage and its processor temperature, and the levels at which it warns about them. |
| File | Read and write files on the computer ARCx runs on. |
| Gamepad | Read gamepads and joysticks plugged into the computer ARCx runs on: the sticks and triggers as axes, the buttons, the hat (d-pad), motion sensors and battery, and make them rumble. |
| I2C | Talk to I2C devices connected to an EZB, such as sensors, displays and expansion boards. |
| Kinematics | Move robot arms by where the end of the arm (the end effector) should go, rather than joint by joint. |
| Log | Write entries to the ARCx debug log (Side menu → Views → Debug Log), which keeps a record after the script console has been cleared. |
| Movement | Drive the robot through whichever movement panel robot skill the project has, such as a continuous rotation servo panel, an H-bridge panel or a robot's own driver. |
| Navigation | Feed the robot's position and sensor scans to ARCx's navigation system, which navigation robot skills use to build maps and plan routes, and set whether navigation is running, paused or cancelled. |
| Net | Talk to the network: download a web page or call a web service (HTTP GET), post data to one (HTTP POST), check whether the internet can be reached, and send UDP messages to other devices. |
| Ping | Read HC-SR04 style ultrasonic distance sensors connected to an EZB. |
| PWM | Set the pulse width modulation (PWM) of a digital port, from 0 to 100 percent. |
| Servo | Move servos and read them. |
| UART | Talk to serial devices connected to an EZB. |
| UI | Talk to the person at the browser and change what they see: show popup notices and messages, ask questions and wait for the answer, bring a robot skill or a workspace to the front, and show and navigate Custom UI screens. |
| Utility | Everything else: random numbers, converting a value from one range to another, working with bits, waiting until a time of day, running a program or opening a web page on the computer, loading a project, checking for an ARCx update, and shutting down or sleeping the computer. |
| Vision | Ask what a camera sees, one frame at a time: count and find colors, read the average color and the brightness. Plain numbers come back; a script never holds a camera image. |
Commands by group
Built-in
The commands every JavaScript script can use without naming a group, the port names, and the list of connected controllers.
print · printHex · sleep · sleepRandom · halt · getVar · setVar · setVarObject · varExists · deleteVar · controlCommand · showControl · showDesktop
ADC
Read the analog (ADC) ports of an EZB. An analog port measures a voltage, such as from a potentiometer, a light sensor or a battery divider, as a number from 0 (0 volts) to 255 (5 volts), or 0 to 4095 with the 12 bit commands. The wait commands pause the script until a reading crosses a value.
ADC.get · ADC.get12Bit · ADC.waitForBetween · ADC.waitForEquals · ADC.waitForHigher · ADC.waitForLower
Audio
Make the robot speak and play sounds, set the volume, and wait for the person to say one of a list of phrases. Speech and sound come out of whichever speaker the project plays audio through, the computer or an EZB, which is chosen on the EZB Connection robot skill. Speech uses the project's text to speech robot skill, and listening uses its speech to text robot skill.
Audio.getOutput · Audio.getVolume · Audio.isConnected · Audio.say · Audio.sayWait · Audio.setVolume · Audio.soundNote · Audio.stop · Audio.waitForAnySpeech · Audio.waitForSpeech · Audio.waitForSpeechRange
Browser
Open web pages, dashboards, video calls and kiosk screens in browser windows on the monitors of the computer ARCx runs on, and control them: move them between monitors, go full screen, run JavaScript inside the page, and pass messages between the page and your script. Each window has a name you choose, so a script can open several and control each one.
Browser.back · Browser.clearMessages · Browser.close · Browser.closeAll · Browser.evaluate · Browser.executeScript · Browser.focus · Browser.forward · Browser.getLastMessage · Browser.getMonitorCount · Browser.getMonitors · Browser.getStatus · Browser.getTitle · Browser.getUrl · Browser.getWindowNames · Browser.hide · Browser.home · Browser.isAvailable · Browser.isLoading · Browser.isOpen · Browser.moveToMonitor · Browser.navigate · Browser.open · Browser.openCustomUI · Browser.openFullscreen · Browser.openKiosk · Browser.openWithOptions · Browser.reload · Browser.saveScreenshot · Browser.sendMessage · Browser.setAlwaysOnTop · Browser.setBounds · Browser.setDisplayMode · Browser.setFullscreen · Browser.setMediaPermissions · Browser.setMuted · Browser.setZoom · Browser.show · Browser.showDevTools · Browser.stop · Browser.waitForLoad · Browser.waitForMessage
Bus
Share data with the rest of the robot through the Robot Bus: publish messages on topics and read them back, call services that robot skills, ARCx and other programs provide, look up where one frame is from another, and record topics to play back later. The same topics and services are open to robot skills, AI assistants and programs outside ARCx, such as Python programs and ROS nodes.
Bus.call · Bus.exists · Bus.getAge · Bus.getField · Bus.getFrames · Bus.getLatest · Bus.getRate · Bus.getServices · Bus.getTopics · Bus.lookupTransform · Bus.publish · Bus.setTransform · Bus.startPlayback · Bus.startRecording · Bus.stopPlayback · Bus.stopRecording · Bus.transformPoint · Bus.waitForMessage
COM
Use the serial (COM) ports of the computer ARCx runs on, such as a USB to serial adapter or an Arduino plugged in by USB. Open the port with its name and speed, write text or bytes, read what comes back, and close it when done. For the serial ports of an EZB, use the UART group instead.
COM.available · COM.availablePorts · COM.clearInputBuffer · COM.close · COM.isPortOpen · COM.open · COM.read · COM.readAllText · COM.readByte · COM.readLine · COM.write · COM.writeString · COM.writeStringNewLine
console
Write to the script console, in the style of a web browser's console, and measure how long things take. log, info, warn and error print a line; time and timeEnd time a piece of the script; count counts how many times a line runs.
console.count · console.error · console.info · console.log · console.logToARC · console.time · console.timeEnd · console.warn
Digital
Read and set the digital ports of an EZB. A digital port is either on (true, a voltage) or off (false). Set one to turn an LED or a relay on and off; read one to check a button or a switch. The wait command pauses the script until a port changes.
Digital.get · Digital.set · Digital.setRandom · Digital.toggle · Digital.wait
EZB
Information about the EZB controllers: whether one is connected, its battery voltage and its processor temperature, and the levels at which it warns about them. EZB 0 is the first controller in the project.
EZB.getCPUTemp · EZB.getVoltage · EZB.isConnected · EZB.setCPUTemp · EZB.setVoltage
File
Read and write files on the computer ARCx runs on. Writing adds to the end of a file and creates it if needed. Reading can take the whole file at once, or a line, a character or a byte at a time from a read position that moves forward as you read. Use full paths, such as C:\Robot\log.txt on Windows.
File.append · File.appendString · File.appendStringLine · File.delete · File.exists · File.getLength · File.getReadPosition · File.isFileOpenForReading · File.isReadEnd · File.readAllText · File.readByte · File.readChar · File.readClose · File.readLine · File.readRandomLine · File.readReset · File.setReadPosition
Gamepad
Read gamepads and joysticks plugged into the computer ARCx runs on: the sticks and triggers as axes, the buttons, the hat (d-pad), motion sensors and battery, and make them rumble. Controller 0 is the first one plugged in. Standard names such as "LeftX" or "A" work for gamepads; the raw commands read any joystick by number.
Gamepad.getAccelerometer · Gamepad.getAxis · Gamepad.getAxisNames · Gamepad.getBattery · Gamepad.getButton · Gamepad.getButtonNames · Gamepad.getControllerType · Gamepad.getCount · Gamepad.getGyro · Gamepad.getHat · Gamepad.getHatCount · Gamepad.getName · Gamepad.getNames · Gamepad.getRawAxis · Gamepad.getRawAxisCount · Gamepad.getRawButton · Gamepad.getRawButtonCount · Gamepad.isConnected · Gamepad.isGamepad · Gamepad.rumble · Gamepad.rumbleMotors · Gamepad.setLED · Gamepad.stopRumble · Gamepad.waitForButton
I2C
Talk to I2C devices connected to an EZB, such as sensors, displays and expansion boards. Each device has an address; write bytes or text to it and read bytes back. The clock speed sets how fast the I2C bus runs.
I2C.read · I2C.readByte · I2C.readString · I2C.setClockSpeed · I2C.write · I2C.writeString
Kinematics
Move robot arms by where the end of the arm (the end effector) should go, rather than joint by joint. Each arm is a kinematic chain, named in the project; positions are in millimetres from the arm's base (+X forward), and orientation is roll, pitch and yaw in degrees. ARCx works out the joint angles and moves the servos.
Kinematics.exists · Kinematics.getChains · Kinematics.getDescription · Kinematics.getJointAngles · Kinematics.getJointCount · Kinematics.getLastMessage · Kinematics.getPitch · Kinematics.getPose · Kinematics.getPosition · Kinematics.getProvider · Kinematics.getRoll · Kinematics.getX · Kinematics.getY · Kinematics.getYaw · Kinematics.getZ · Kinematics.isMoving · Kinematics.moveLinear · Kinematics.moveLinearAndWait · Kinematics.moveRelative · Kinematics.moveRelativeAndWait · Kinematics.moveTo · Kinematics.moveToAndWait · Kinematics.moveToPose · Kinematics.stop · Kinematics.stopAll · Kinematics.supportsOrientation · Kinematics.waitForMoveComplete · Kinematics.wasLastMoveReachable
Log
Write entries to the ARCx debug log (Side menu → Views → Debug Log), which keeps a record after the script console has been cleared.
Movement
Drive the robot through whichever movement panel robot skill the project has, such as a continuous rotation servo panel, an H-bridge panel or a robot's own driver. Movements keep going until another movement or a stop, so a script can start the robot driving and carry on. Speeds run from 0 (stopped) to 255 (full speed). The wait commands pause until something, such as a joystick or another script, moves the robot that way.
Movement.down · Movement.forward · Movement.fromString · Movement.getSpeed · Movement.getSpeedLeft · Movement.getSpeedRight · Movement.land · Movement.left · Movement.reverse · Movement.right · Movement.rollLeft · Movement.rollRight · Movement.setSpeed · Movement.setSpeedLeft · Movement.setSpeedRight · Movement.stop · Movement.takeoff · Movement.up · Movement.waitForDown · Movement.waitForForward · Movement.waitForLeft · Movement.waitForReverse · Movement.waitForRight · Movement.waitForStop · Movement.waitForUp
Navigation
Feed the robot's position and sensor scans to ARCx's navigation system, which navigation robot skills use to build maps and plan routes, and set whether navigation is running, paused or cancelled. Most projects let their sensor robot skills do this; these commands are for sensors and position sources a script reads itself.
Navigation.setNavigationStatusToNavigating · Navigation.setNavigationStatusToPause · Navigation.setNavigationStatusToStopCancel · Navigation.updatePose · Navigation.updateScan
Net
Talk to the network: download a web page or call a web service (HTTP GET), post data to one (HTTP POST), check whether the internet can be reached, and send UDP messages to other devices.
Net.HTTPGet · Net.HTTPPost · Net.isInternetAvailable · Net.sendUDP
Ping
Read HC-SR04 style ultrasonic distance sensors connected to an EZB. Each sensor uses two ports, trigger and echo. Distances are a number from 0 to 255, larger meaning farther. The wait commands pause the script until something comes closer or moves away.
Ping.get · Ping.waitForBetween · Ping.waitForEquals · Ping.waitForHigher · Ping.waitForLower
PWM
Set the pulse width modulation (PWM) of a digital port, from 0 to 100 percent. PWM switches a port on and off very quickly, so the share of time it is on sets an LED's brightness or a motor driver's speed.
PWM.get · PWM.set · PWM.setRandom
Servo
Move servos and read them. Positions normally run from 1 to 180, kept inside each servo's minimum and maximum limits. Velocity sets how fast a servo moves to its next position and acceleration how gently it starts; release lets a servo go limp. Servos on an EZB's d0 to d23 ports and virtual ports v0 and up (used by servo driver robot skills such as Dynamixel) are moved the same way.
Servo.decrement · Servo.getAcceleration · Servo.getFineTuneOffset · Servo.getPosition · Servo.getPositionRealtime · Servo.getVelocity · Servo.increment · Servo.isReleased · Servo.release · Servo.releaseAll · Servo.setAcceleration · Servo.setFineTuneOffset · Servo.setMaxPositionLimit · Servo.setMinPositionLimit · Servo.setPosition · Servo.setPositionRandom · Servo.setVelocity · Servo.waitForMove · Servo.waitForPositionEquals · Servo.waitForPositionHigher · Servo.waitForPositionLower
UART
Talk to serial devices connected to an EZB. The hardware UART commands open one of the EZB's serial ports at a speed, write to it and read what has arrived. The send serial commands send bytes or text out of any digital port as software serial, without needing a hardware UART. For the serial ports of the computer itself, use the COM group.
UART.hardwareUartAvailable · UART.hardwareUartRead · UART.hardwareUartReadAvailable · UART.hardwareUartReadString · UART.hardwareUartReadStringAvailable · UART.hardwareUartWrite · UART.hardwareUartWriteString · UART.initHardwareUart · UART.sendSerial · UART.sendSerialString
UI
Talk to the person at the browser and change what they see: show popup notices and messages, ask questions and wait for the answer, bring a robot skill or a workspace to the front, and show and navigate Custom UI screens.
UI.customUIBack · UI.customUIHome · UI.getCustomUIScreen · UI.getCustomUIScreens · UI.isWebClientConnected · UI.navigateTo · UI.promptForAnyNumber · UI.promptForChoices · UI.promptForNumberRange · UI.promptForUserInput · UI.showControl · UI.showCustomUI · UI.showDesktop · UI.showDialogMessage · UI.showPopupMessage · UI.showTextInputPrompt
Utility
Everything else: random numbers, converting a value from one range to another, working with bits, waiting until a time of day, running a program or opening a web page on the computer, loading a project, checking for an ARCx update, and shutting down or sleeping the computer.
Utility.browser · Utility.checkForUpdate · Utility.clearGlobalVariable · Utility.exec · Utility.getBit · Utility.getRandom · Utility.getRandomUnique · Utility.loadProject · Utility.map · Utility.setBits · Utility.shutdownPC · Utility.sleepPCHibernate · Utility.sleepPCSuspend · Utility.waitUntilTime
Vision
Ask what a camera sees, one frame at a time: count and find colors, read the average color and the brightness. Plain numbers come back; a script never holds a camera image.
Vision.averageColor · Vision.brightness · Vision.colorPercent · Vision.countColor · Vision.findColor · Vision.getSources