Skip to content

Warning Flags

Replies from Zaber devices include a field called Warning Flags. This field indicates various conditions, warnings, or faults that may be present on the device. Some examples of these conditions may be if the temperature of the device is too high, if an axis has stalled, or if an axis has not yet been homed.

Conditions that relate to movements are checked by the library automatically during movement, and will result in an exception if detected. The presence of Warning Flags can also be queried directly using the library at any other time.

The @prop Warnings property is accessible from the @class Device or @class Axis classes, and it will return information about Warning Flags for that scope. The flags are returned as a set of strings. String constants are provided to check for particular conditions.

In this example, the Warning Flags of a device are queried and the result is checked for the "controller temperature high" condition.

// const { ascii: { WarningFlags } } = require('@zaber/motion');

const warningFlags = await device.warnings.getFlags();
if (warningFlags.has(WarningFlags.CONTROLLER_TEMPERATURE_HIGH)) {
  console.log('Device is overheating!');
}
# from zaber_motion.ascii import WarningFlags

warning_flags = device.warnings.get_flags()
if WarningFlags.CONTROLLER_TEMPERATURE_HIGH in warning_flags:
    print("Device is overheating!")
var warningFlags = device.Warnings.GetFlags();
if (warningFlags.Contains(WarningFlags.ControllerTemperatureHigh))
{
    Console.WriteLine("Device is overheating!");
}
// import java.util.Set;
// import zaber.motion.ascii.WarningFlags;

Set<String> warningFlags = device.getWarnings().getFlags();
if (warningFlags.contains(WarningFlags.CONTROLLER_TEMPERATURE_HIGH)) {
    System.out.println("Device is overheating!");
}
% import zaber.motion.ascii.WarningFlags;

warningFlags = device.getWarnings().getFlags();
if (warningFlags.contains(WarningFlags.CONTROLLER_TEMPERATURE_HIGH))
    fprintf('Device is overheating!');
end
std::unordered_set<std::string> warningFlags = device.getWarnings().getFlags();
if (warningFlags.count(WarningFlags::CONTROLLER_TEMPERATURE_HIGH)) {
    std::cout << "Device is overheating!" << std::endl;
}

While some Warning Flags persist until the condition that is causing them is remedied, others are purely informational and can be cleared. Use the @method ClearFlags method to clears these flags and retrieve all the flags present at the time of clearing.

For the full reference on Warning Flags, visit: