Settings

Zaber devices have a number of settings that control or indicate various properties of the device. The library offers a way to read and write these settings.

Settings have two scopes, axis scope settings and device scope settings. Axis scope settings relate to properties specific to the axis, such as the current position of the axis or the acceleration rate of the axis, and are available under the settings property of an Axis class instance. Device scope settings relate to general properties of the device, such as the serial number or the voltage of the power supply, and are available under the settings property of a Device class instance.

Additionally, each setting may either be writable and readable, or only readable. For example, the setting for the maximum speed is readable and writable, while the setting indicating the current temperature of the driver is only readable.

There are settings that are non-volatile, such as the maximum motor current, and will persist if the device is power cycled. There are also volatile settings, such as the encoder count, that will be reset after a power cycle.

Axis settings

This example reads the temperature of the driver.

Python
C#
C++
JavaScript
MATLAB
Java
MATLAB (legacy)
const temperature = await axis.settings.get('driver.temperature');

console.log('Driver temperature [°C]:', temperature);
temperature = axis.settings.get("driver.temperature")

print("Driver temperature [°C]:", temperature)
var temperature = axis.Settings.Get("driver.temperature");

Console.WriteLine("Driver temperature [°C]: {0}", temperature);
double temperature = axis.getSettings().get("driver.temperature");

System.out.println("Driver temperature [°C]: " + temperature);
temperature = axis.getSettings().get('driver.temperature');

fprintf('Driver temperature [°C]: %d.\n', temperature);
temperature = axis.Settings.get('driver.temperature');

fprintf('Driver temperature [°C]: %d.\n', temperature);
double temperature = axis.getSettings().get("driver.temperature");

std::cout << "Driver temperature [°C]: " << temperature << std::endl;

This example reads and writes the maximum speed of an axis. It retrieves the maximum speed and sets it back to half of the original value. Do not run this example unless you intend to change the maximum speed.

Python
C#
C++
JavaScript
MATLAB
Java
MATLAB (legacy)
const speed = await axis.settings.get('maxspeed', Velocity.MILLIMETRES_PER_SECOND);

console.log('Maximum speed [mm/s]:', speed);

await axis.settings.set('maxspeed', speed / 2.0, Velocity.MILLIMETRES_PER_SECOND);
speed = axis.settings.get("maxspeed", Units.VELOCITY_MILLIMETRES_PER_SECOND)

print("Maximum speed [mm/s]:", speed)

axis.settings.set("maxspeed", speed / 2.0, Units.VELOCITY_MILLIMETRES_PER_SECOND)
var speed = axis.Settings.Get("maxspeed", Units.Velocity_MillimetresPerSecond);

Console.WriteLine("Maximum speed [mm/s]: {0}", speed);

axis.Settings.Set("maxspeed", speed / 2.0, Units.Velocity_MillimetresPerSecond);
double speed = axis.getSettings().get("maxspeed", Units.VELOCITY_MILLIMETRES_PER_SECOND);

System.out.println("Maximum speed [mm/s]: " + speed);

axis.getSettings().set("maxspeed", speed / 2.0, Units.VELOCITY_MILLIMETRES_PER_SECOND);
speed = axis.getSettings().get('maxspeed', Units.VELOCITY_MILLIMETRES_PER_SECOND);

fprintf('Maximum speed [mm/s]: %d.\n', speed);

axis.getSettings().set('maxspeed', speed / 2.0, Units.VELOCITY_MILLIMETRES_PER_SECOND);
speed = axis.Settings.get('maxspeed', Units.Velocity("mm/s"));

fprintf('Maximum speed [mm/s]: %d.\n', speed);

axis.Settings.set('maxspeed', speed / 2.0, Units.Velocity("mm/s"));
double speed = axis.getSettings().get("maxspeed", Units::VELOCITY_MILLIMETRES_PER_SECOND);

std::cout << "Maximum speed [mm/s]: " << speed << std::endl;

axis.getSettings().set("maxspeed", speed / 2.0, Units::VELOCITY_MILLIMETRES_PER_SECOND);

Device settings

This example writes a device scope setting. It disables the indicator LEDs on a device.

Python
C#
C++
JavaScript
MATLAB
Java
MATLAB (legacy)
await device.settings.set('system.led.enable', 0);
device.settings.set('system.led.enable', 0)
device.Settings.Set("system.led.enable", 0);
device.getSettings().set("system.led.enable", 0);
device.getSettings().set('system.led.enable', 0);
device.Settings.set('system.led.enable', 0);
device.getSettings().set("system.led.enable", 0);

Note that setting an axis specific setting using the device settings property will apply that setting to all axes of a device.

String settings

Some settings are not returned as a number but as a string instead. For those settings use get_string method.

Python
C#
C++
JavaScript
MATLAB
Java
MATLAB (legacy)
const address = await device.settings.getString('comm.en.ipv4.address');

console.log('IPv4 address:', address);
address = device.settings.get_string("comm.en.ipv4.address")

print("IPv4 address:", address)
var address = device.Settings.GetString("comm.en.ipv4.address");

Console.WriteLine("IPv4 address: {0}", address);
String address = device.getSettings().getString("comm.en.ipv4.address");

System.out.println("IPv4 address: " + address);
address = device.getSettings().getString('comm.en.ipv4.address');

fprintf('IPv4 address: %s.\n', address);
address = device.Settings.getString('comm.en.ipv4.address');

fprintf('IPv4 address: %s.\n', address);
std::string address = device.getSettings().getString("comm.en.ipv4.address");

std::cout << "IPv4 address: " << address << std::endl;

Integer and Boolean settings

When a specific data type is expected from a setting (e.g., integer or boolean), the corresponding typed getter method such as get_int or get_bool can be used.

Python
C#
C++
JavaScript
MATLAB
Java
MATLAB (legacy)
const numAxes = await device.settings.getInt('system.axiscount');
const ledEnabled = await device.settings.getBool('system.led.enable');

if (numAxes < 3) {
  console.log("There are less than 3 Axes.")
}

if (ledEnabled) {
  console.log("System LED Enabled");
} else {
  console.log("System LED Disabled");
}

num_axes = device.settings.get_int("system.axiscount")
led_enabled = device.settings.get_bool("system.led.enable")

if (num_axes < 3):
  print("There are less than 3 Axes.")

if (led_enabled):
  print("Sytem LED Enabled")
else:
  print("System LED Disabled")
long numAxes = await device.Settings.GetInt("system.axiscount");
bool ledEnabled = await device.Settings.GetBool("system.led.enable");

if (numAxes < 3)
{
  Console.WriteLine("There are less than 3 Axes.")
}

if (ledEnabled)
{
  Console.WriteLine("System LED Enabled");
}
else
{
  Console.WriteLine("System LED Disabled");
}
long numAxes = device.getSettings().getInt("system.axiscount");
boolean ledEnabled = device.getSettings().getBool("system.led.enable");

if (numAxes < 3) {
  System.out.println("There are less than 3 Axes.");
}

if (ledEnabled) {
  System.out.println("System LED Enabled");
} else {
  System.out.println("System LED Disabled");
}
numAxes = device.getSettings().getInt('system.axiscount');
ledEnabled = device.getSettings().getBool('system.led.enable');

if numAxes < 3
    fprintf('There are less than 3 Axes.\n');
end

if ledEnabled
    fprintf('System LED Enabled\n');
else
    fprintf('System LED Disabled\n');
end
numAxes = device.Settings.getInt('system.axiscount');
ledEnabled = device.Settings.getBool('system.led.enable');

if numAxes < 3
    fprintf('There are less than 3 Axes.\n');
end

if ledEnabled
    fprintf('System LED Enabled\n');
else
    fprintf('System LED Disabled\n');
end
int64_t numAxes = device.getSettings().getInt("system.axiscount");
bool ledEnabled = device.getSettings().getBool("system.led.enable");

if (numAxes < 3) {
    std::cout << "There are less than 3 Axes." << std::endl;
}

if (ledEnabled) {
    std::cout << "System LED Enabled" << std::endl;
} else {
    std::cout << "System LED Disabled" << std::endl;
}

Getting Many Settings at once

In some cases, it may be desirable to read many settings at once. In Zaber Motion Library 4.6.0 or later, this is possible with two methods: Get Synchronized and Get Many

Get Synchronized

This method will try to read all of the settings you request in a single read, guaranteeing that all values were taken at the same time. If it is important that setting value reads happen simultaneously, this is the method you should use. As an example, to get system.uptime and at the same time read pos on axis 1 and 3 of a device in millimetres, you could run the following:

Python
C#
C++
JavaScript
MATLAB
Java
MATLAB (legacy)
const response = await device.settings.getSynchronized({ setting: 'system.uptime' }, { setting: 'pos', axes: [1, 3], unit: Length.mm });

console.log(`Uptime: ${response[0].values[0]}`);
console.log(`Axis 1 pos: ${response[1].value[0]}mm`);
console.log(`Axis 3 pos: ${response[1].value[1]}mm`);
response = device.settings.get_synchronized(GetSetting('system.uptime'), GetSetting('pos', [1, 3], Units.LENGTH_MILLIMETRES))

print(f"uptime: {response[0].values[0]}")
print(f"axis 1 pos {response[1].values[0]}mm")
print(f"axis 3 pos {response[1].values[1]}mm")
var response = device.Settings.GetSynchronized(
  new GetSetting{ Setting = "system.uptime" },
  new GetSetting { Setting = "pos", Axes = new int[]{1, 3}, Unit = Units.Length_Millimetres }
);

Console.WriteLine($"uptime: {response[0].Values[0]}");
Console.WriteLine($"axis 1 pos {response[1].Values[0]}mm");
Console.WriteLine($"axis 3 pos {response[1].Values[1]}mm");
GetSettingResult[] responses = device.getSettings().getSynchronized(
    new GetSetting("system.uptime"),
    new GetSetting("pos", new int[]{1, 3}, Units.LENGTH_MILLIMETRES)
);

System.out.println("uptime: " + responses[0].getValues()[0]);
System.out.println("Axis 1 pos: " + responses[1].getValues()[0] + "mm");
System.out.println("Axis 3 pos: " + responses[1].getValues()[1] + "mm");
responses = device.getSettings().getSynchronized(
    GetSetting("system.uptime"),
    GetSetting("pos", [1, 3], Units.LENGTH_MILLIMETRES)
);

fprintf('uptime: %fmm\n', responses(1).getValues()(1));
fprintf('Axis 1 pos: %fmm\n', responses(2).getValues()(1));
fprintf('Axis 3 pos: %fmm\n', responses(2).getValues()(2));
responses = device.Settings.getSynchronized(
    GetSetting("system.uptime"),
    GetSetting("pos", [1, 3], Units.LengthMillimetres)
);

fprintf('uptime: %fmm\n', responses(1).Values(1));
fprintf('Axis 1 pos: %fmm\n', responses(2).Values(1));
fprintf('Axis 3 pos: %fmm\n', responses(2).Values(2));
auto response = device.getSettings().getSynchronized(
  GetSetting("system.uptime"),
  GetSetting("pos", {1, 3}, Units::LENGTH_MILLIMETRES)
);

std::cout << "Uptime " << response[0].getValues()[0] << std::endl;
std::cout << "Axis 1 pos " << response[1].getValues()[0] << std::endl;
std::cout << "Axis 3 pos " << response[1].getValues()[1] << std::endl;

Get Many

This function is called in the same way as GetSynchronized, but it does not guarantee that the settings will be read in the same moment. Use this function if you want to read many settings as quickly as possible on a given device, but do not require them to all be read at once.

This function will work on devices running older firmware by reading each setting one after the next.

Reference

A list of all available settings is available here:

API Reference: