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:

from zaber_motion import Units
// No additional includes needed
const { Length } = require('@zaber/motion');
import zaber.motion.Units;
import zaber.motion.Units;
LENGTH_MILLIMETRES = java_get("zaber.motion.Units", "LENGTH_MILLIMETRES");
// No additional includes needed

Then, add the following code to the end of the program:

# indent this code under the "with" statement
# Move to the 10mm position
axis.move_absolute(10, Units.LENGTH_MILLIMETRES)
# Move by an additional 5mm
axis.move_relative(5, Units.LENGTH_MILLIMETRES)
// Move to the 10mm position
axis.MoveAbsolute(10, Units.Length_Millimetres);
// Move by an additional 5mm
axis.MoveRelative(5, Units.Length_Millimetres);
// Move to the 10mm position
await axis.moveAbsolute(10, Length.mm);
// Move by an additional 5mm
await axis.moveRelative(5, Length.mm);
// Move to the 10mm position
axis.moveAbsolute(10, Units.LENGTH_MILLIMETRES);
// Move by an additional 5mm
axis.moveRelative(5, Units.LENGTH_MILLIMETRES);
% Move to the 10mm position
axis.moveAbsolute(10, Units.LENGTH_MILLIMETRES);
% Move by an additional 5mm
axis.moveRelative(5, Units.LENGTH_MILLIMETRES);
% Move to the 10mm position
axis.moveAbsolute(10, LENGTH_MILLIMETRES);
% Move by an additional 5mm
axis.moveRelative(5, LENGTH_MILLIMETRES);
// Move to the 10mm position
axis.moveAbsolute(10, Units::LENGTH_MILLIMETRES);
// Move by an additional 5mm
axis.moveRelative(5, Units::LENGTH_MILLIMETRES);

Run the program to make your device move. The axis object here is the one created in the home device section.

At a low level, the devices operate in native units related to their drive type, such as microsteps for a stepper driver or encoder counts for a direct drive device. The library allows you to specify real-world units like millimetres, and handles the conversion to the specific native units. Use native units directly by omitting the second argument in the move methods, or by specifying the units to be native. To read more about native units refer, to the ASCII Protocol manual.

The above movements will execute one after the other, with the program waiting for the movement to finish before continuing. This behaviour can be controlled by including a third argument in the move method, with a boolean false indicating that the method should not wait.

Note: If you have a rotary device use Units.ANGLE_DEGREES in the code above.

Note: If you have a rotary device use Units.Angle_Degrees in the code above.

Note: If you have a rotary device use Angle.DEGREES in the code above.

Note: If you have a rotary device use Units.ANGLE_DEGREES in the code above.

Note: If you have a rotary device use Units.ANGLE_DEGREES in the code above.

Note: If you have a rotary device use Units::ANGLE_DEGREES in the code above.

The Getting Started guide concludes with the further steps section.