Programming Guide

This guide provides a comprehensive and beginner-friendly explanation of some of the most important programming concepts used throughout Synthiam ARC scripting, especially when working with JavaScript or Python inside ARC. Understanding how classes, methods, and case sensitivity work will help you write more reliable scripts, avoid common errors, and better interpret the examples in the ARC documentation.

What is a Class?

In both JavaScript and Python, a class is a reusable template or blueprint used to create objects. An object created from a class is known as an instance of that class. The class defines the structure and capabilities of those instances, including:

  • Properties (or attributes), which store information relevant to the object. For example, a servo might store its current position, speed, or minimum/maximum limits.
  • Methods, which are functions attached to the class that define what the object can do — such as move, read a sensor, or change configuration.

Classes allow you to organize code logically, create predictable behaviors, and reuse common functionality across many parts of your project. In Synthiam ARC, numerous features — such as servos, sensors, robot movement, and audio control — are exposed as classes, each containing various methods you can call to interact with your robot hardware.

What is a Method?

A method is a function that belongs to a class. It defines an action or behavior the class can perform. Methods often operate on the data stored within an instance of that class, which means they can read or update property values to change how the object behaves.

For example, a method in a camera class might capture an image, change a setting such as exposure, or start video tracking. A servo-related method might adjust angle, set a speed, release torque, or retrieve position data.

Methods are central to interacting with robot hardware in ARC. When you call a method, you’re sending a structured instruction to the ARC system telling it exactly what you want that component of your robot to do.

Class.Method() Notation

In the Synthiam ARC documentation and examples, you’ll frequently encounter expressions such as Servo.setServoPosition(). This format is known as dot notation. The dot (.) acts as a separator that tells the programming language, “This method belongs to this class.”

For example:

  • Servo is the class — it represents the entire concept of a servo motor within ARC.
  • setServoPosition is the method — it’s the specific action you want to perform.

When combined as Servo.setServoPosition(90), you are instructing ARC to execute the setServoPosition method on the Servo class and pass in a value of 90 as a parameter. In this example, the parameter represents the exact position you want the servo to rotate to.

This class–method relationship exists throughout all ARC scripting features. Any time you see class-style names followed by a dot and a function name, you are calling a method that belongs specifically to that class.

Case Sensitivity

Both JavaScript and Python, which are used in Synthiam ARC, treat uppercase and lowercase letters as completely different characters. This is known as case sensitivity.

This means that the following names are not interchangeable — they are considered entirely different identifiers:

  • servo
  • Servo
  • SERVO

If the ARC documentation specifies a class called Servo, then you must write it with that exact casing. Changing even a single letter — for example writing servo — will cause an error and prevent your script from running.

This same rule applies to:

  • class names
  • method names
  • variable names
  • arguments
  • built-in functions

Case sensitivity is one of the most frequent causes of issues for beginner programmers, so always double-check your capitalization when calling ARC classes and methods.

Example in JavaScript

class Servo {

// A method defined on the Servo class that sets the servo's position.
static setServoPosition(position) {

```
console.log(`Setting servo position to ${position}`);
```

}
}

// Correct way to call the method using proper capitalization
Servo.setServoPosition(90);

// Incorrect - case sensitivity matters!
// servo.setservoPosition(90); // This will cause an error because both the class and method names are wrong 

Example in Python

class Servo:

```
# A static method that takes a position and prints a message.
@staticmethod
def setServoPosition(position):
    print(f"Setting servo position to {position}")
```

# Correct way to call the method with exact case

Servo.setServoPosition(90)

# Incorrect - case sensitivity matters!

# Servo.setservoposition(90)  # This will fail because the method name does not match exactly

Whenever you are writing scripts in Synthiam ARC, always refer to the official documentation for the exact class and method names. Following correct capitalization ensures that your scripts run without errors and that ARC can properly communicate with the components of your robot.