Zaber Launcher Tutorials
Zaber Motion Library
Sample Projects
Virtual DeviceDropdown icon
About3D Viewer
AccountDropdown icon
Sign InSign Up
Zaber Motion LibraryGetting StartedHow-to GuidesAPI ReferenceSupport
Binary Protocol (Legacy)
Introduction
Getting Started
InitializeOpen a serial portHome deviceMove deviceFurther steps
How-to Guides
Sending arbitrary commands
© 2026 Zaber Technologies Inc.

Move device

Now that the device has a position reference after homing it, you can start moving it.

First, add the following lines to the imports at the top of the code:

Python
C#
C++
JavaScript
MATLAB
Java
Octave
MATLAB (legacy)
from zaber_motion import Units
// No additional includes needed
const { Length } = require('@zaber/motion');
import zaber.motion.Units;
import zaber.motion.Units;
import zaber.motion.Units;
LENGTH_MILLIMETRES = java_get("zaber.motion.Units", "LENGTH_MILLIMETRES");
// No additional includes needed

Then, use the absolute and/or relative movement methods to move the device. The following example demonstrates their usage:

Python
C#
C++
JavaScript
MATLAB
Java
Octave
MATLAB (legacy)
# indent this code under the "with" statement
# Move to 10mm
device.move_absolute(10, Units.LENGTH_MILLIMETRES)
# Move by an additional 5mm
device.move_relative(5, Units.LENGTH_MILLIMETRES)
// Move to 10mm
device.MoveAbsolute(10, Units.Length_Millimetres);
// Move by an additional 5mm
device.MoveRelative(5, Units.Length_Millimetres);
// Move to 10mm
await device.moveAbsolute(10, Length.mm);
// Move by an additional 5mm
await device.moveRelative(5, Length.mm);
// Move to 10mm
device.moveAbsolute(10, Units.LENGTH_MILLIMETRES);
// Move by an additional 5mm
device.moveRelative(5, Units.LENGTH_MILLIMETRES);
% Move to 10mm
device.moveAbsolute(10, Units.LENGTH_MILLIMETRES);
% Move by an additional 5mm
device.moveRelative(5, Units.LENGTH_MILLIMETRES);
% Move to 10mm
device.moveAbsolute(10, Units.Length("mm"));
% Move by an additional 5mm
device.moveRelative(5, Units.Length("mm"));
% Move to 10mm
device.moveAbsolute(10, LENGTH_MILLIMETRES);
% Move by an additional 5mm
device.moveRelative(5, LENGTH_MILLIMETRES);
// Move to 10mm
device.moveAbsolute(10, Units::LENGTH_MILLIMETRES);
// Move by an additional 5mm
device.moveRelative(5, Units::LENGTH_MILLIMETRES);

The Getting Started guide concludes with the further steps section.

API Reference

  • Device