API Reference v9.3.2

Moveableclass

Module: ZaberMotionMovement

Represents something that moves: either an axis of a device, or a lockstep group.

The following examples illustrate how you can obtain an instance of this type:

Example 1
Example 2
Example 3
import ZaberMotionAscii
import ZaberMotionMovement

let connection = try await Connection.openSerialPort(portName: "COM3")
let device = try connection.getDevice(deviceAddress: 1)
let axis = try device.getAxis(axisNumber: 1)
let moveable = try await Moveable.fromAxis(axis: axis)
import ZaberMotionAscii
import ZaberMotionMovement

let connection = try await Connection.openSerialPort(portName: "COM3")
let device = try connection.getDevice(deviceAddress: 1)
let lockstep = try device.getLockstep(lockstepGroupId: 1)
let moveable = try await Moveable.fromLockstep(lockstep: lockstep)
import ZaberMotionAscii
import ZaberMotionMovement

let connection = try await Connection.openSerialPort(portName: "COM3")
let device = try connection.getDevice(deviceAddress: 1)
let moveable = try await Moveable.fromDevice(device: device)

Properties

p

device

readonly
moveable.device
Device The device this moveable is on.
p

moveableId

readonly
moveable.moveableId
Int The identifier for the moveable instance.

Methods

m

driverDisable()

asyncthrows
try await moveable.driverDisable()
Disables the driver, which prevents current from being sent to the motor or load. If the driver is already disabled, the driver remains disabled.
m

driverEnable()

asyncthrows
try await moveable.driverEnable(timeout = 10)
Attempts to enable the driver repeatedly for the specified timeout. If the driver is already enabled, the driver remains enabled.
Arguments
NameTypeDescription
timeoutDoubleTimeout in seconds. Specify 0 to attempt to enable the driver once.
s

fromAxis()

asyncthrows
try await Moveable.fromAxis(axis, units = nil)
Creates a Moveable instance for a given axis.
Arguments
NameTypeDescription
axisAxisAxis to create a Moveable for.
unitsDefaultMotionUnits?Default units of measurement used for movement operations.
Return Value
Moveable A Moveable instance for the specified axis.
s

fromDevice()

asyncthrows
try await Moveable.fromDevice(device, units = nil)
Creates a Moveable instance for a single-axis device.
Arguments
NameTypeDescription
deviceDeviceDevice to create a Moveable for.
unitsDefaultMotionUnits?Default units of measurement used for movement operations.
Return Value
Moveable A Moveable instance for the specified device.
s

fromLockstep()

asyncthrows
try await Moveable.fromLockstep(lockstep, units = nil)
Creates a Moveable instance for a given lockstep group.
Arguments
NameTypeDescription
lockstepLockstepLockstep group to create a Moveable for.
unitsDefaultMotionUnits?Default units of measurement used for movement operations.
Return Value
Moveable A Moveable instance for the specified lockstep group.
m

getAxis()

asyncthrows
try await moveable.getAxis()
Returns the axis this moveable represents. For a lockstep moveable, returns the primary axis of the lockstep group.
Return Value
Axis Axis this moveable is based on.
m

getEncoderPosition()

asyncthrows
try await moveable.getEncoderPosition(unit = nil)
Returns the current encoder position of the moveable.
Arguments
NameTypeDescription
unitUnits?Units of position. If not specified, the default position unit is used.
Return Value
Double Current encoder position.
m

getLimitMax()

asyncthrows
try await moveable.getLimitMax(unit = nil)
Returns the maximum limit of the moveable.
Arguments
NameTypeDescription
unitUnits?Units of position. If not specified, the default position unit is used.
Return Value
Double Maximum limit.
m

getLimitMin()

asyncthrows
try await moveable.getLimitMin(unit = nil)
Returns the minimum limit of the moveable.
Arguments
NameTypeDescription
unitUnits?Units of position. If not specified, the default position unit is used.
Return Value
Double Minimum limit.
m

getLockstep()

asyncthrows
try await moveable.getLockstep()
Returns the lockstep group this moveable represents, or null if it is not a lockstep moveable.
Return Value
Lockstep? Lockstep instance, or null if this is not a lockstep moveable.
m

getMaxAcceleration()

asyncthrows
try await moveable.getMaxAcceleration(accelType = nil, unit = nil)
Returns the maximum acceleration of the moveable. For a lockstep group, returns the lowest value across all axes.
Arguments
NameTypeDescription
accelTypeAccelType?Which acceleration ramp to return. Defaults to AccelDecel.
unitUnits?Units of acceleration. If not specified, the default acceleration unit is used.
Return Value
Double Maximum acceleration.
m

getMaxSpeed()

asyncthrows
try await moveable.getMaxSpeed(unit = nil)
Returns the maximum speed that this moveable will execute moves at by default. If a different velocity is specified on a move command, that will override this value for that command only.
Arguments
NameTypeDescription
unitUnits?Units of velocity. If not specified, the default velocity unit is used.
Return Value
Double Maximum speed.
m

getPosition()

asyncthrows
try await moveable.getPosition(unit = nil)
Returns the current position of the moveable.
Arguments
NameTypeDescription
unitUnits?Units of position. If not specified, the default position unit is used.
Return Value
Double Current position.
m

getVelocity()

asyncthrows
try await moveable.getVelocity(unit = nil)
Returns the current velocity of the moveable.
Arguments
NameTypeDescription
unitUnits?Units of velocity. If not specified, the default velocity unit is used.
Return Value
Double Current velocity.
m

home()

asyncthrows
try await moveable.home(waitUntilIdle = true)
Moves the moveable to the home position.
Arguments
NameTypeDescription
waitUntilIdleBoolDetermines whether function should return after the movement is finished or just started.
m

isBusy()

asyncthrows
try await moveable.isBusy()
Returns bool indicating whether the moveable is executing a motion command.
Return Value
Bool True if the moveable is currently executing a motion command.
m

isHomed()

asyncthrows
try await moveable.isHomed()
Returns bool indicating whether the moveable has position reference and was homed.
Return Value
Bool True if the moveable has position reference and was homed.
m

isParked()

asyncthrows
try await moveable.isParked()
Returns bool indicating whether the moveable is parked.
Return Value
Bool True if the moveable is parked.
m

moveAbsolute()

asyncthrows
try await moveable.moveAbsolute(position, velocity = nil, acceleration = nil, waitUntilIdle = true, cyclicDirection = nil, extraCycles = nil)
Moves to an absolute position.
Arguments
NameTypeDescription
positionMeasurementOrValueAbsolute position to move to.
velocityMeasurementOrValue?Movement velocity. If not specified, the maximum velocity setting is used.
accelerationMeasurementOrValue?Movement acceleration. If not specified, the default acceleration setting is used.
waitUntilIdleBoolDetermines whether function should return after the movement is finished or just started.
cyclicDirectionCyclicDirection?Which direction a cyclic device should take to get to the target position.
extraCyclesInt?Number of extra cycles to complete before stopping at the target.
m

moveMax()

asyncthrows
try await moveable.moveMax(velocity = nil, acceleration = nil, waitUntilIdle = true)
Moves to the end of travel.
Arguments
NameTypeDescription
velocityMeasurementOrValue?Movement velocity. If not specified, the maximum velocity setting is used.
accelerationMeasurementOrValue?Movement acceleration. If not specified, the default acceleration setting is used.
waitUntilIdleBoolDetermines whether function should return after the movement is finished or just started.
m

moveMin()

asyncthrows
try await moveable.moveMin(velocity = nil, acceleration = nil, waitUntilIdle = true)
Moves to the beginning of travel.
Arguments
NameTypeDescription
velocityMeasurementOrValue?Movement velocity. If not specified, the maximum velocity setting is used.
accelerationMeasurementOrValue?Movement acceleration. If not specified, the default acceleration setting is used.
waitUntilIdleBoolDetermines whether function should return after the movement is finished or just started.
m

moveRelative()

asyncthrows
try await moveable.moveRelative(position, velocity = nil, acceleration = nil, waitUntilIdle = true)
Moves by a relative amount from the current position.
Arguments
NameTypeDescription
positionMeasurementOrValueRelative displacement to move by.
velocityMeasurementOrValue?Movement velocity. If not specified, the maximum velocity setting is used.
accelerationMeasurementOrValue?Movement acceleration. If not specified, the default acceleration setting is used.
waitUntilIdleBoolDetermines whether function should return after the movement is finished or just started.
m

moveSin()

asyncthrows
try await moveable.moveSin(amplitude, period, count = 0, waitUntilIdle = true)
Moves the moveable in a sinusoidal trajectory.
Arguments
NameTypeDescription
amplitudeMeasurementOrValueAmplitude of the sinusoidal motion (half of the motion's peak-to-peak range).
periodMeasurementOrValuePeriod of the sinusoidal motion.
countDoubleNumber of sinusoidal cycles to complete. Must be a multiple of 0.5. If count is not specified or set to 0, the moveable will move indefinitely.
waitUntilIdleBoolDetermines whether function should return after the movement is finished or just started.
m

moveSinStop()

asyncthrows
try await moveable.moveSinStop(waitUntilIdle = true)
Stops the moveable at the end of the sinusoidal trajectory. If the sinusoidal motion was started with an integer-plus-half cycle count, the motion ends at the half-way point of the sinusoidal trajectory.
Arguments
NameTypeDescription
waitUntilIdleBoolDetermines whether function should return after the movement is finished.
m

moveVelocity()

asyncthrows
try await moveable.moveVelocity(velocity, acceleration = nil, waitUntilIdle = true)
Begins moving at a specified velocity.
Arguments
NameTypeDescription
velocityMeasurementOrValueVelocity to move at.
accelerationMeasurementOrValue?Movement acceleration. If not specified, the default acceleration setting is used.
waitUntilIdleBoolDetermines whether function should return after the movement is finished or just started.
m

park()

asyncthrows
try await moveable.park()
Parks the moveable.
m

setMaxAcceleration()

asyncthrows
try await moveable.setMaxAcceleration(accel, accelType = nil)
Sets the maximum acceleration of the moveable. For a lockstep group, sets the value on all axes.
Arguments
NameTypeDescription
accelMeasurementOrValueMaximum acceleration to set.
accelTypeAccelType?Which acceleration ramp to set. Defaults to AccelDecel.
m

setMaxSpeed()

asyncthrows
try await moveable.setMaxSpeed(speed)
Sets the maximum speed of the moveable. For a lockstep group, sets the value on all axes.
Arguments
NameTypeDescription
speedMeasurementOrValueMaximum speed to set.
m

stop()

asyncthrows
try await moveable.stop(waitUntilIdle = true)
Stops ongoing movement of the moveable.
Arguments
NameTypeDescription
waitUntilIdleBoolDetermines whether function should return after the movement is finished or just started.
m

unpark()

asyncthrows
try await moveable.unpark()
Unparks the moveable.
m

waitUntilIdle()

asyncthrows
try await moveable.waitUntilIdle(throwErrorOnFault = true)
Waits until the moveable stops moving.
Arguments
NameTypeDescription
throwErrorOnFaultBoolDetermines whether to throw error when fault is observed.