Skip to content

Zaber Launcher

This article describes how Zaber Motion Library (ZML) interacts with Zaber Launcher.

Serial port sharing

Multiple programs can share access to a single serial port and daisy chain when using Zaber Motion Library (ZML) in conjunction with Zaber Launcher.

Traditionally only one program can access a serial port. The first program to open a serial port locks the port, and other programs can only access the port after the first program closes the port.

However, if you add the serial port to Zaber Launcher, it shares that port with any scripts or programs written using Zaber Motion Library. Zaber Launcher uses an intermediate process called zaber_message_router to control access to serial ports. When a program instructs ZML to open a serial port, ZML first checks for the message router and, if present, opens the port using the message router. The message router will route replies back to the program that sent the command. For example, you can have a script running that controls the stages while using Zaber Launcher to monitor their current positions.

Zaber Launcher must be running for sharing to work. Closing Zaber Launcher will result in Zaber Motion Library losing the connection to the port and throwing an exception. If Zaber Launcher is not running, Zaber Motion Library opens the port directly and assumes exclusive ownership.

If you want to bypass the message router, use the @method OpenSerialPortDirectly method when opening the serial port.

Network Sharing

Zaber Motion Library can connect to a remote Zaber Launcher that has Network Sharing enabled. Using this functionality your program can control devices connected to a serial port of another computer in your Local Area Network.

In order to connect you need to specify the Hostname of the remote computer and the TCP/IP port. Both values are displayed on Network Sharing tab in Zaber Launcher. Additionally, specify which serial port you'd like to connect to. You can only connect to serial ports that are added to Zaber Launcher's connections.

In the following example Hostname is LAB_PC10, TCP/IP port is 11421, and serial port is COM3.

with Connection.open_network_share("LAB_PC10", 11421, "COM3") as connection:
    device_list = connection.detect_devices()
    print("Found {} devices".format(len(device_list)))

    # The rest of your program goes here (indented)
using (var connection = Connection.OpenNetworkShare("LAB_PC10", 11421, "COM3")) {
    var deviceList = connection.DetectDevices();
    Console.WriteLine($"Found {deviceList.Length} devices.");

    // The rest of your program goes here
}
const connection = await Connection.openNetworkShare('LAB_PC10', 11421, 'COM3');
try {
    const deviceList = await connection.detectDevices();
    console.log(`Found ${deviceList.length} devices.`);

    // The rest of your program goes here
} finally {
    // Close the port to allow Node.js to exit
    await connection.close();
}
try (Connection connection = Connection.openNetworkShare("LAB_PC10", 11421, "COM3")) {
    Device[] deviceList = connection.detectDevices();
    System.out.println(String.format("Found %d devices.", deviceList.length));

    // The rest of your program goes here
}
connection = Connection.openNetworkShare('LAB_PC10', 11421, 'COM3');
try
    deviceList = connection.detectDevices();
    fprintf('Found %d devices.\n', deviceList.length);

    % The rest of your program goes here

    connection.close();
catch exception
    connection.close();
    rethrow(exception);
end
Connection connection = Connection::openNetworkShare("LAB_PC10", 11421, "COM3");

std::vector<Device> deviceList = connection.detectDevices();
std::cout << "Found " << deviceList.size() << " devices." << std::endl;

// The rest of your program goes here

In case of an error make sure that the remote computer is reachable from your computer and Network Sharing in Zaber Launcher is enabled. Contact your IT department to help you diagnose network issues.