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);
doubletemperature= 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.
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");
}
longnumAxes= device.getSettings().getInt("system.axiscount");
booleanledEnabled= 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');
endif 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');
endif 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:
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: