Moveables

The Moveables API makes moving your axes and locksteps more convenient by providing a cohesive set of functions across both and letting users specify default units for movements to use.

Set up

There are three functions you can use to get a moveable. First, to create from an axis, use From Axis:

Python
C#
C++
JavaScript
MATLAB
Java
device = connection.get_device(1)
moveable = Moveable.from_axis(device.get_axis(1))
const device = connection.getDevice(1);
const moveable = await Moveable.fromAxis(device.getAxis(1));
var device = connection.GetDevice(1);
var moveable = Moveable.FromAxis(device.GetAxis(1));
Device device = connection.getDevice(1);
Moveable moveable = Moveable.fromAxis(device.getAxis(1));
device = connection.getDevice(1);
moveable = zaber.motion.movement.Moveable.fromAxis(device.getAxis(1));
Device device = connection.getDevice(1);
Moveable moveable = Moveable::fromAxis(device.getAxis(1));

Next, if your device is lockstep, you can use From Lockstep:

Python
C#
C++
JavaScript
MATLAB
Java
device = connection.get_device(1)
moveable = Moveable.from_lockstep(device.get_lockstep(1))
const device = connection.getDevice(1);
const moveable = await Moveable.fromLockstep(device.getLockstep(1));
var device = connection.GetDevice(1);
var moveable = Moveable.FromLockstep(device.GetLockstep(1));
Device device = connection.getDevice(1);
Moveable moveable = Moveable.fromLockstep(device.getLockstep(1));
device = connection.getDevice(1);
moveable = zaber.motion.movement.Moveable.fromLockstep(device.getLockstep(1));
Device device = connection.getDevice(1);
Moveable moveable = Moveable::fromLockstep(device.getLockstep(1));

Finally, there is the From Device function that you can use for single-axis devices:

Python
C#
C++
JavaScript
MATLAB
Java
device = connection.get_device(1)
moveable = Moveable.from_device(device)
const device = connection.getDevice(1);
const moveable = await Moveable.fromDevice(device);
var device = connection.GetDevice(1);
var moveable = Moveable.FromDevice(device);
Device device = connection.getDevice(1);
Moveable moveable = Moveable.fromDevice(device);
device = connection.getDevice(1);
moveable = zaber.motion.movement.Moveable.fromDevice(device);
Device device = connection.getDevice(1);
Moveable moveable = Moveable::fromDevice(device);

These all result in moveable being an instance of type Moveable with identical functionality. Moveables have all of the movement methods from axis and lockstep so:

Python
C#
C++
JavaScript
MATLAB
Java
moveable.move_absolute(100)
await moveable.moveAbsolute(100);
moveable.MoveAbsolute(100);
moveable.moveAbsolute(100);
moveable.moveAbsolute(100);
moveable.moveAbsolute(100);

Will have the same effect as:

Python
C#
C++
JavaScript
MATLAB
Java
axis = device.get_axis(1)
axis.move_absolute(100)
const axis = device.getAxis(1);
await axis.moveAbsolute(100);
var axis = device.GetAxis(1);
axis.MoveAbsolute(100);
Axis axis = device.getAxis(1);
axis.moveAbsolute(100);
axis = device.getAxis(1);
axis.moveAbsolute(100);
Axis axis = device.getAxis(1);
axis.moveAbsolute(100);

Default Units

Often, you'll want to always use the same units without having to specify them on each call. For example, to create a Moveable that will always use units of millimeters, you can create a moveable like:

Python
C#
C++
JavaScript
MATLAB
Java
mm_moveable = Moveable.from_axis(device.get_axis(1), DefaultMotionUnits(position=Units.LENGTH_MILLIMETRES))
const mmMoveable = await Moveable.fromAxis(device.getAxis(1), { position: Length.MILLIMETRES });
var mmMoveable = Moveable.FromAxis(device.GetAxis(1), new DefaultMotionUnits { Position = Units.Length_Millimetres });
Moveable mmMoveable = Moveable.fromAxis(device.getAxis(1), new DefaultMotionUnits(Units.LENGTH_MILLIMETRES));
mmMoveable = zaber.motion.movement.Moveable.fromAxis(device.getAxis(1), units=zaber.motion.movement.DefaultMotionUnits(zaber.motion.Units.LengthMillimetres));
DefaultMotionUnits units;
units.setPosition(Units::LENGTH_MILLIMETRES);
Moveable mmMoveable = Moveable::fromAxis(device.getAxis(1), units);

Then, to move your device by 10 mm, instead of writing:

Python
C#
C++
JavaScript
MATLAB
Java
axis.move_relative(10, Units.LENGTH_MILLIMETRES)
await axis.moveRelative(10, Length.MILLIMETRES);
axis.MoveRelative(10, Units.Length_Millimetres);
axis.moveRelative(10, Units.LENGTH_MILLIMETRES);
axis.moveRelative(10, Units.Length("mm"));
axis.moveRelative(10, Units::LENGTH_MILLIMETRES);

You can just write:

Python
C#
C++
JavaScript
MATLAB
Java
mm_moveable.move_relative(10)
await mmMoveable.moveRelative(10);
mmMoveable.MoveRelative(10);
mmMoveable.moveRelative(10);
mmMoveable.moveRelative(10);
mmMoveable.moveRelative(10);

If you need to use another unit, you can always still specify it by passing in a Measurement:

Python
C#
C++
JavaScript
MATLAB
Java
mm_moveable.move_relative(Measurement(value=2, unit=Units.LENGTH_INCHES))
await mmMoveable.moveRelative({ value: 2, unit: Length.INCHES });
mmMoveable.MoveRelative(new Measurement { Value = 2, Unit = Units.Length_Inches });
mmMoveable.moveRelative(new Measurement(2, Units.LENGTH_INCHES));
mmMoveable.moveRelative(zaber.motion.Measurement(2, zaber.motion.Units.LengthInches));
mmMoveable.moveRelative(Measurement(2, Units::LENGTH_INCHES));

DefaultMotionUnits supports setting default units for Position (which also covers lengths and distances), Speed, Acceleration, and Time.

Lockstep

All the methods that exist on axis exist on lockstep, but will sometimes get information from the whole lockstep to provide you with more correct info. So for example, if you have a lockstep of two devices, one with a travel of 10 mm, and one with a travel of 5 mm, and call Get Limit Max, it will return 5 mm since that is the furthest the combination of devices can travel, and if you call Is Homed it will check that all of the axes are homed.

The following methods will act on all axes in a lockstep when called:

  • Get Limit Max
  • Get Limit Min
  • Get Max Speed
  • Set Max Speed
  • Get Max Acceleration
  • Set Max Acceleration
  • Is Homed
  • Is Parked