API Reference v9.2.0
Axisclass
Module: ZaberMotionAscii
Represents an axis of motion associated with a device.
The following example illustrates how you can obtain an instance of this type:
import ZaberMotionAscii
let connection = try await Connection.openSerialPort(portName: "COM3")
let device = try connection.getDevice(deviceAddress: 1)
let axis = try device.getAxis(axisNumber: 1)Related Guides:
Index
pProperties
mMethods
Properties
p
p
try axis.axisTypeAxisType Determines the type of an axis and units it accepts.p
p
p
p
p
p
p
axis.storageAxisStorage Key-value storage of this axis. Requires at least Firmware 7.30.p
Methods
m
m
m
try await axis.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. |
m
try await axis.genericCommand(command, checkErrors = true, timeout = 0)Sends a generic ASCII command to this axis. For more information refer to: ASCII Protocol Manual.
Arguments
| Name | Type | Description |
|---|---|---|
| command | String | Command and its parameters. |
| checkErrors | Bool | Controls whether to throw an exception when the device rejects the command. |
| timeout | Int | The timeout, in milliseconds, for a device to respond to the command. Overrides the connection default request timeout. |
Return Value
Response A response to the command.m
try await axis.genericCommandMultiResponse(command, checkErrors = true, timeout = 0)Sends a generic ASCII command to this axis and expect multiple responses. Responses are returned in order of arrival. For more information refer to: ASCII Protocol Manual.
Arguments
| Name | Type | Description |
|---|---|---|
| command | String | Command and its parameters. |
| checkErrors | Bool | Controls whether to throw an exception when a device rejects the command. |
| timeout | Int | The timeout, in milliseconds, for a device to respond to the command. Overrides the connection default request timeout. |
Return Value
[Response] All responses to the command.m
try await axis.genericCommandNoResponse(command)Sends a generic ASCII command to this axis without expecting a response and without adding a message ID For more information refer to: ASCII Protocol Manual.
Arguments
| Name | Type | Description |
|---|---|---|
| command | String | Command and its parameters. |
m
try axis.getCommandUnitConversionDescriptors(commandTemplate)Retrieves unit conversion descriptors for a command, allowing unit conversion without a device. The descriptors can be used with the ConvertTo/FromNativeUnits methods of the UnitTable class. Parameters in the command template are denoted by a question mark. For more information refer to: ASCII Protocol Manual.
Arguments
| Name | Type | Description |
|---|---|---|
| commandTemplate | String | Template of the command. Parameters are denoted by question marks. |
Return Value
[UnitConversionDescriptor?] Unit conversion descriptor for each parameter in the command. Nil if a parameter does not have conversion.m
m
m
try await axis.getPosition(unit = Units.native)Returns current axis position.
Arguments
| Name | Type | Description |
|---|---|---|
| unit | Units | Units of position. |
Return Value
Double Axis position.m
m
m
m
m
m
try await axis.moveAbsolute(position, unit = Units.native, waitUntilIdle = true, velocity = 0, velocityUnit = Units.native, acceleration = 0, accelerationUnit = Units.native, cyclicDirection = nil, extraCycles = nil)Move axis to absolute position.
Arguments
| Name | Type | Description |
|---|---|---|
| position | Double | Absolute position. |
| unit | Units | Units of position. |
| waitUntilIdle | Bool | Determines whether function should return after the movement is finished or just started. |
| velocity | Double | Movement velocity. Default value of 0 indicates that the maxspeed setting is used instead. |
| velocityUnit | Units | Units of velocity. |
| acceleration | Double | Movement acceleration. Default value of 0 indicates that the accel setting is used instead. |
| accelerationUnit | Units | Units of acceleration. |
| 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 axis.moveIndex(index, waitUntilIdle = true, velocity = 0, velocityUnit = Units.native, acceleration = 0, accelerationUnit = Units.native)Moves the axis to index position.
Arguments
| Name | Type | Description |
|---|---|---|
| index | Int | Index position. Index positions are numbered from 1. |
| waitUntilIdle | Bool | Determines whether function should return after the movement is finished or just started. |
| velocity | Double | Movement velocity. Default value of 0 indicates that the maxspeed setting is used instead. |
| velocityUnit | Units | Units of velocity. |
| acceleration | Double | Movement acceleration. Default value of 0 indicates that the accel setting is used instead. |
| accelerationUnit | Units | Units of acceleration. |
m
try await axis.moveMax(waitUntilIdle = true, velocity = 0, velocityUnit = Units.native, acceleration = 0, accelerationUnit = Units.native)Moves the axis to the maximum position as specified by limit.max.
Arguments
| Name | Type | Description |
|---|---|---|
| waitUntilIdle | Bool | Determines whether function should return after the movement is finished or just started. |
| velocity | Double | Movement velocity. Default value of 0 indicates that the maxspeed setting is used instead. |
| velocityUnit | Units | Units of velocity. |
| acceleration | Double | Movement acceleration. Default value of 0 indicates that the accel setting is used instead. |
| accelerationUnit | Units | Units of acceleration. |
m
try await axis.moveMin(waitUntilIdle = true, velocity = 0, velocityUnit = Units.native, acceleration = 0, accelerationUnit = Units.native)Moves the axis to the minimum position as specified by limit.min.
Arguments
| Name | Type | Description |
|---|---|---|
| waitUntilIdle | Bool | Determines whether function should return after the movement is finished or just started. |
| velocity | Double | Movement velocity. Default value of 0 indicates that the maxspeed setting is used instead. |
| velocityUnit | Units | Units of velocity. |
| acceleration | Double | Movement acceleration. Default value of 0 indicates that the accel setting is used instead. |
| accelerationUnit | Units | Units of acceleration. |
m
try await axis.moveRelative(position, unit = Units.native, waitUntilIdle = true, velocity = 0, velocityUnit = Units.native, acceleration = 0, accelerationUnit = Units.native)Move axis to position relative to current position.
Arguments
| Name | Type | Description |
|---|---|---|
| position | Double | Relative position. |
| unit | Units | Units of position. |
| waitUntilIdle | Bool | Determines whether function should return after the movement is finished or just started. |
| velocity | Double | Movement velocity. Default value of 0 indicates that the maxspeed setting is used instead. |
| velocityUnit | Units | Units of velocity. |
| acceleration | Double | Movement acceleration. Default value of 0 indicates that the accel setting is used instead. |
| accelerationUnit | Units | Units of acceleration. |
m
try await axis.moveSin(amplitude, amplitudeUnits, period, periodUnits, count = 0, waitUntilIdle = true)Moves the axis in a sinusoidal trajectory.
Arguments
| Name | Type | Description |
|---|---|---|
| amplitude | Double | Amplitude of the sinusoidal motion (half of the motion's peak-to-peak range). |
| amplitudeUnits | Units | Units of position. |
| period | Double | Period of the sinusoidal motion in milliseconds. |
| periodUnits | Units | Units of time. |
| 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 axis will move indefinitely. |
| waitUntilIdle | Bool | Determines whether function should return after the movement is finished or just started. |
m
try await axis.moveSinStop(waitUntilIdle = true)Stops the axis 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 axis.moveVelocity(velocity, unit = Units.native, acceleration = 0, accelerationUnit = Units.native)Begins to move axis at specified speed.
Arguments
| Name | Type | Description |
|---|---|---|
| velocity | Double | Movement velocity. |
| unit | Units | Units of velocity. |
| acceleration | Double | Movement acceleration. Default value of 0 indicates that the accel setting is used instead. |
| accelerationUnit | Units | Units of acceleration. |
m
m
try axis.prepareCommand(commandTemplate, ...parameters)Formats parameters into a command and performs unit conversions. Parameters in the command template are denoted by a question mark. Command returned is only valid for this axis and this device. For more information refer to: ASCII Protocol Manual.
Arguments
| Name | Type | Description |
|---|---|---|
| commandTemplate | String | Template of a command to prepare. Parameters are denoted by question marks. |
| ...parameters | [Measurement] | Variable number of command parameters. |
Return Value
String Command with converted parameters.m
m
m
try await axis.setState(state)Applies a saved state to this axis.
Arguments
| Name | Type | Description |
|---|---|---|
| state | String | The state object to apply to this axis. |
Return Value
SetStateAxisResponse Reports of any issues that were handled, but caused the state to not be exactly restored.m
m