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)Index
pProperties
mMethods
Properties
p
Methods
m
m
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
| Name | Type | Description |
|---|---|---|
| timeout | Double | Timeout in seconds. Specify 0 to attempt to enable the driver once. |
s
try await Moveable.fromAxis(axis, units = nil)Creates a Moveable instance for a given axis.
Arguments
| Name | Type | Description |
|---|---|---|
| axis | Axis | Axis to create a Moveable for. |
| units | DefaultMotionUnits? | Default units of measurement used for movement operations. |
Return Value
Moveable A Moveable instance for the specified axis.s
try await Moveable.fromDevice(device, units = nil)Creates a Moveable instance for a single-axis device.
Arguments
| Name | Type | Description |
|---|---|---|
| device | Device | Device to create a Moveable for. |
| units | DefaultMotionUnits? | Default units of measurement used for movement operations. |
Return Value
Moveable A Moveable instance for the specified device.s
try await Moveable.fromLockstep(lockstep, units = nil)Creates a Moveable instance for a given lockstep group.
Arguments
| Name | Type | Description |
|---|---|---|
| lockstep | Lockstep | Lockstep group to create a Moveable for. |
| units | DefaultMotionUnits? | Default units of measurement used for movement operations. |
Return Value
Moveable A Moveable instance for the specified lockstep group.m
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
try await moveable.getEncoderPosition(unit = nil)Returns the current encoder position of the moveable.
Arguments
| Name | Type | Description |
|---|---|---|
| unit | Units? | Units of position. If not specified, the default position unit is used. |
Return Value
Double Current encoder position.m
try await moveable.getLimitMax(unit = nil)Returns the maximum limit of the moveable.
Arguments
| Name | Type | Description |
|---|---|---|
| unit | Units? | Units of position. If not specified, the default position unit is used. |
Return Value
Double Maximum limit.m
try await moveable.getLimitMin(unit = nil)Returns the minimum limit of the moveable.
Arguments
| Name | Type | Description |
|---|---|---|
| unit | Units? | Units of position. If not specified, the default position unit is used. |
Return Value
Double Minimum limit.m
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
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
| Name | Type | Description |
|---|---|---|
| accelType | AccelType? | Which acceleration ramp to return. Defaults to AccelDecel. |
| unit | Units? | Units of acceleration. If not specified, the default acceleration unit is used. |
Return Value
Double Maximum acceleration.m
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
| Name | Type | Description |
|---|---|---|
| unit | Units? | Units of velocity. If not specified, the default velocity unit is used. |
Return Value
Double Maximum speed.m
try await moveable.getPosition(unit = nil)Returns the current position of the moveable.
Arguments
| Name | Type | Description |
|---|---|---|
| unit | Units? | Units of position. If not specified, the default position unit is used. |
Return Value
Double Current position.m
try await moveable.getVelocity(unit = nil)Returns the current velocity of the moveable.
Arguments
| Name | Type | Description |
|---|---|---|
| unit | Units? | Units of velocity. If not specified, the default velocity unit is used. |
Return Value
Double Current velocity.m
m
m
m
m
try await moveable.moveAbsolute(position, velocity = nil, acceleration = nil, waitUntilIdle = true, cyclicDirection = nil, extraCycles = nil)Moves to an absolute position.
Arguments
| Name | Type | Description |
|---|---|---|
| position | MeasurementOrValue | Absolute position to move to. |
| velocity | MeasurementOrValue? | Movement velocity. If not specified, the maximum velocity setting is used. |
| acceleration | MeasurementOrValue? | Movement acceleration. If not specified, the default acceleration setting is used. |
| waitUntilIdle | Bool | Determines whether function should return after the movement is finished or just started. |
| cyclicDirection | CyclicDirection? | Which direction a cyclic device should take to get to the target position. |
| extraCycles | Int? | Number of extra cycles to complete before stopping at the target. |
m
try await moveable.moveMax(velocity = nil, acceleration = nil, waitUntilIdle = true)Moves to the end of travel.
Arguments
| Name | Type | Description |
|---|---|---|
| velocity | MeasurementOrValue? | Movement velocity. If not specified, the maximum velocity setting is used. |
| acceleration | MeasurementOrValue? | Movement acceleration. If not specified, the default acceleration setting is used. |
| waitUntilIdle | Bool | Determines whether function should return after the movement is finished or just started. |
m
try await moveable.moveMin(velocity = nil, acceleration = nil, waitUntilIdle = true)Moves to the beginning of travel.
Arguments
| Name | Type | Description |
|---|---|---|
| velocity | MeasurementOrValue? | Movement velocity. If not specified, the maximum velocity setting is used. |
| acceleration | MeasurementOrValue? | Movement acceleration. If not specified, the default acceleration setting is used. |
| waitUntilIdle | Bool | Determines whether function should return after the movement is finished or just started. |
m
try await moveable.moveRelative(position, velocity = nil, acceleration = nil, waitUntilIdle = true)Moves by a relative amount from the current position.
Arguments
| Name | Type | Description |
|---|---|---|
| position | MeasurementOrValue | Relative displacement to move by. |
| velocity | MeasurementOrValue? | Movement velocity. If not specified, the maximum velocity setting is used. |
| acceleration | MeasurementOrValue? | Movement acceleration. If not specified, the default acceleration setting is used. |
| waitUntilIdle | Bool | Determines whether function should return after the movement is finished or just started. |
m
try await moveable.moveSin(amplitude, period, count = 0, waitUntilIdle = true)Moves the moveable in a sinusoidal trajectory.
Arguments
| Name | Type | Description |
|---|---|---|
| amplitude | MeasurementOrValue | Amplitude of the sinusoidal motion (half of the motion's peak-to-peak range). |
| period | MeasurementOrValue | Period of the sinusoidal motion. |
| count | Double | Number 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. |
| waitUntilIdle | Bool | Determines whether function should return after the movement is finished or just started. |
m
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
| Name | Type | Description |
|---|---|---|
| waitUntilIdle | Bool | Determines whether function should return after the movement is finished. |
m
try await moveable.moveVelocity(velocity, acceleration = nil, waitUntilIdle = true)Begins moving at a specified velocity.
Arguments
| Name | Type | Description |
|---|---|---|
| velocity | MeasurementOrValue | Velocity to move at. |
| acceleration | MeasurementOrValue? | Movement acceleration. If not specified, the default acceleration setting is used. |
| waitUntilIdle | Bool | Determines whether function should return after the movement is finished or just started. |
m
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
| Name | Type | Description |
|---|---|---|
| accel | MeasurementOrValue | Maximum acceleration to set. |
| accelType | AccelType? | Which acceleration ramp to set. Defaults to AccelDecel. |
m
try await moveable.setMaxSpeed(speed)Sets the maximum speed of the moveable. For a lockstep group, sets the value on all axes.
Arguments
| Name | Type | Description |
|---|---|---|
| speed | MeasurementOrValue | Maximum speed to set. |
m