API Reference v9.2.0
Streamclass
Module: ZaberMotionAscii
A handle for a stream with this number on the device. Streams provide a way to execute or store a sequence of actions. Stream methods append actions to a queue which executes or stores actions in a first in, first out order.
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 streams = device.streams
let stream = try streams.getStream(streamId: 1)Related Guides:
Index
mMethods
Properties
p
try stream.axes[StreamAxisDefinition] An array of axes definitions the stream is set up to control.p
p
p
Methods
m
try await stream.arcAbsolute(rotationDirection, centerX, centerY, endX, endY)Queue an absolute arc movement on the first two axes of the stream. Absolute meaning that the home positions of the axes is treated as the origin.
Arguments
| Name | Type | Description |
|---|---|---|
| rotationDirection | RotationDirection | The direction of the rotation. |
| centerX | Measurement | The first dimension of the position of the center of the circle on which the arc exists. |
| centerY | Measurement | The second dimension of the position of the center of the circle on which the arc exists. |
| endX | Measurement | The first dimension of the end position of the arc. |
| endY | Measurement | The second dimension of the end position of the arc. |
m
try await stream.arcAbsoluteOn(targetAxesIndices, rotationDirection, centerX, centerY, endX, endY)Queue an absolute arc movement in the stream. The movement will only target the specified subset of axes in the stream.
Requires at least Firmware 7.11.
Arguments
| Name | Type | Description |
|---|---|---|
| targetAxesIndices | [Int] | Indices of the axes in the stream the movement targets. Refers to the axes provided during the stream setup or further execution. Indices are zero-based. |
| rotationDirection | RotationDirection | The direction of the rotation. |
| centerX | Measurement | The first dimension of the position of the center of the circle on which the arc exists. |
| centerY | Measurement | The second dimension of the position of the center of the circle on which the arc exists. |
| endX | Measurement | The first dimension of the end position of the arc. |
| endY | Measurement | The second dimension of the end position of the arc. |
m
try await stream.arcRelative(rotationDirection, centerX, centerY, endX, endY)Queue a relative arc movement on the first two axes of the stream. Relative meaning that the current position of the axes is treated as the origin.
Arguments
| Name | Type | Description |
|---|---|---|
| rotationDirection | RotationDirection | The direction of the rotation. |
| centerX | Measurement | The first dimension of the position of the center of the circle on which the arc exists. |
| centerY | Measurement | The second dimension of the position of the center of the circle on which the arc exists. |
| endX | Measurement | The first dimension of the end position of the arc. |
| endY | Measurement | The second dimension of the end position of the arc. |
m
try await stream.arcRelativeOn(targetAxesIndices, rotationDirection, centerX, centerY, endX, endY)Queue a relative arc movement in the stream. The movement will only target the specified subset of axes in the stream.
Requires at least Firmware 7.11.
Arguments
| Name | Type | Description |
|---|---|---|
| targetAxesIndices | [Int] | Indices of the axes in the stream the movement targets. Refers to the axes provided during the stream setup or further execution. Indices are zero-based. |
| rotationDirection | RotationDirection | The direction of the rotation. |
| centerX | Measurement | The first dimension of the position of the center of the circle on which the arc exists. |
| centerY | Measurement | The second dimension of the position of the center of the circle on which the arc exists. |
| endX | Measurement | The first dimension of the end position of the arc. |
| endY | Measurement | The second dimension of the end position of the arc. |
m
try await stream.call(streamBuffer)Append the actions in a stream buffer to the queue.
Arguments
| Name | Type | Description |
|---|---|---|
| streamBuffer | StreamBuffer | The stream buffer to call. |
m
m
try await stream.circleAbsolute(rotationDirection, centerX, centerY)Queue an absolute circle movement on the first two axes of the stream. Absolute meaning that the home positions of the axes are treated as the origin.
Arguments
| Name | Type | Description |
|---|---|---|
| rotationDirection | RotationDirection | The direction of the rotation. |
| centerX | Measurement | The first dimension of the position of the center of the circle. |
| centerY | Measurement | The second dimension of the position of the center of the circle. |
m
try await stream.circleAbsoluteOn(targetAxesIndices, rotationDirection, centerX, centerY)Queue an absolute circle movement in the stream. The movement will only target the specified subset of axes in the stream.
Requires at least Firmware 7.11.
Arguments
| Name | Type | Description |
|---|---|---|
| targetAxesIndices | [Int] | Indices of the axes in the stream the movement targets. Refers to the axes provided during the stream setup or further execution. Indices are zero-based. |
| rotationDirection | RotationDirection | The direction of the rotation. |
| centerX | Measurement | The first dimension of the position of the center of the circle. |
| centerY | Measurement | The second dimension of the position of the center of the circle. |
m
try await stream.circleRelative(rotationDirection, centerX, centerY)Queue a relative circle movement on the first two axes of the stream. Relative meaning that the current position of the axes is treated as the origin.
Arguments
| Name | Type | Description |
|---|---|---|
| rotationDirection | RotationDirection | The direction of the rotation. |
| centerX | Measurement | The first dimension of the position of the center of the circle. |
| centerY | Measurement | The second dimension of the position of the center of the circle. |
m
try await stream.circleRelativeOn(targetAxesIndices, rotationDirection, centerX, centerY)Queue a relative circle movement in the stream. The movement will only target the specified subset of axes in the stream.
Requires at least Firmware 7.11.
Arguments
| Name | Type | Description |
|---|---|---|
| targetAxesIndices | [Int] | Indices of the axes in the stream the movement targets. Refers to the axes provided during the stream setup or further execution. Indices are zero-based. |
| rotationDirection | RotationDirection | The direction of the rotation. |
| centerX | Measurement | The first dimension of the position of the center of the circle. |
| centerY | Measurement | The second dimension of the position of the center of the circle. |
m
try await stream.cork()Cork the front of the stream's action queue, blocking execution. Execution resumes upon uncorking the queue, or when the number of queued actions reaches its limit. Corking eliminates discontinuities in motion due to subsequent stream commands reaching the device late. You can only cork an idle live stream.
m
m
m
try await stream.genericCommandBatch(batch)Sends a batch of generic ASCII commands to the stream. Keeps resending command while the device rejects with AGAIN reason. The batch is atomic in terms of thread safety.
Arguments
| Name | Type | Description |
|---|---|---|
| batch | [String] | Array of commands. |
m
try await stream.getMaxCentripetalAcceleration(unit = Units.native)Gets the maximum centripetal acceleration of the live stream. Converts the units using the first axis of the stream.
Arguments
| Name | Type | Description |
|---|---|---|
| unit | Units | Units of acceleration. |
Return Value
Double The maximum centripetal acceleration of the live stream.m
try await stream.getMaxSpeed(unit = Units.native)Gets the maximum speed of the live stream. Converts the units using the first axis of the stream.
Arguments
| Name | Type | Description |
|---|---|---|
| unit | Units | Units of velocity. |
Return Value
Double The maximum speed of the stream.m
try await stream.getMaxTangentialAcceleration(unit = Units.native)Gets the maximum tangential acceleration of the live stream. Converts the units using the first axis of the stream.
Arguments
| Name | Type | Description |
|---|---|---|
| unit | Units | Units of acceleration. |
Return Value
Double The maximum tangential acceleration of the live stream.m
try await stream.helixAbsoluteOn(targetAxesIndices, rotationDirection, centerX, centerY, endX, endY, ...endpoint)Queue an absolute helix movement in the stream.
Requires at least Firmware 7.28.
Arguments
| Name | Type | Description |
|---|---|---|
| targetAxesIndices | [Int] | Indices of the axes in the stream the movement targets. Refers to the axes provided during the stream setup or further execution. Indices are zero-based. The first two axes refer to the helix's arc component, while the rest refers to the helix's line component. |
| rotationDirection | RotationDirection | The direction of the rotation. |
| centerX | Measurement | The first dimension of the position of the center of the circle on which the helix projects. |
| centerY | Measurement | The second dimension of the position of the center of the circle on which the helix projects. |
| endX | Measurement | The first dimension of the end position of the helix's arc component. |
| endY | Measurement | The second dimension of the end position of the helix's arc component. |
| ...endpoint | [Measurement] | Positions for the helix's line component axes, relative to their home positions. |
m
try await stream.helixRelativeOn(targetAxesIndices, rotationDirection, centerX, centerY, endX, endY, ...endpoint)Queue a relative helix movement in the stream.
Requires at least Firmware 7.28.
Arguments
| Name | Type | Description |
|---|---|---|
| targetAxesIndices | [Int] | Indices of the axes in the stream the movement targets. Refers to the axes provided during the stream setup or further execution. Indices are zero-based. The first two axes refer to the helix's arc component, while the rest refers to the helix's line component. |
| rotationDirection | RotationDirection | The direction of the rotation. |
| centerX | Measurement | The first dimension of the position of the center of the circle on which the helix projects. |
| centerY | Measurement | The second dimension of the position of the center of the circle on which the helix projects. |
| endX | Measurement | The first dimension of the end position of the helix's arc component. |
| endY | Measurement | The second dimension of the end position of the helix's arc component. |
| ...endpoint | [Measurement] | Positions for the helix's line component axes, relative to their positions before movement. |
m
m
m
try await stream.lineAbsolute(...endpoint)Queue an absolute line movement in the stream.
Arguments
| Name | Type | Description |
|---|---|---|
| ...endpoint | [Measurement] | Positions for the axes to move to, relative to their home positions. |
m
try await stream.lineAbsoluteOn(targetAxesIndices, endpoint)Queue an absolute line movement in the stream, targeting a subset of the stream axes.
Requires at least Firmware 7.11.
Arguments
| Name | Type | Description |
|---|---|---|
| targetAxesIndices | [Int] | Indices of the axes in the stream the movement targets. Refers to the axes provided during the stream setup or further execution. Indices are zero-based. |
| endpoint | [Measurement] | Positions for the axes to move to, relative to their home positions. |
m
try await stream.lineRelative(...endpoint)Queue a relative line movement in the stream.
Arguments
| Name | Type | Description |
|---|---|---|
| ...endpoint | [Measurement] | Positions for the axes to move to, relative to their positions before movement. |
m
try await stream.lineRelativeOn(targetAxesIndices, endpoint)Queue a relative line movement in the stream, targeting a subset of the stream axes.
Requires at least Firmware 7.11.
Arguments
| Name | Type | Description |
|---|---|---|
| targetAxesIndices | [Int] | Indices of the axes in the stream the movement targets. Refers to the axes provided during the stream setup or further execution. Indices are zero-based. |
| endpoint | [Measurement] | Positions for the axes to move to, relative to their positions before movement. |
m
m
try await stream.setMaxCentripetalAcceleration(maxCentripetalAcceleration, unit = Units.native)Sets the maximum centripetal acceleration of the live stream. Converts the units using the first axis of the stream.
Arguments
| Name | Type | Description |
|---|---|---|
| maxCentripetalAcceleration | Double | Maximum centripetal acceleration at which any stream action is executed. |
| unit | Units | Units of acceleration. |
m
try await stream.setMaxSpeed(maxSpeed, unit = Units.native)Sets the maximum speed of the live stream. Converts the units using the first axis of the stream.
Arguments
| Name | Type | Description |
|---|---|---|
| maxSpeed | Double | Maximum speed at which any stream action is executed. |
| unit | Units | Units of velocity. |
m
try await stream.setMaxTangentialAcceleration(maxTangentialAcceleration, unit = Units.native)Sets the maximum tangential acceleration of the live stream. Converts the units using the first axis of the stream.
Arguments
| Name | Type | Description |
|---|---|---|
| maxTangentialAcceleration | Double | Maximum tangential acceleration at which any stream action is executed. |
| unit | Units | Units of acceleration. |
m
m
try await stream.setupLiveComposite(...axes)Setup the stream to control the specified axes and to queue actions on the device. Allows use of lockstep axes in a stream.
Arguments
| Name | Type | Description |
|---|---|---|
| ...axes | [StreamAxisDefinition] | Definition of the stream axes. |
m
try await stream.setupStore(streamBuffer, ...axes)Setup the stream to control the specified axes and queue actions into a stream buffer.
Arguments
| Name | Type | Description |
|---|---|---|
| streamBuffer | StreamBuffer | The stream buffer to queue actions in. |
| ...axes | [Int] | The axis numbers of the physical axes to setup the stream on. |
m
try await stream.setupStoreArbitraryAxes(streamBuffer, axesCount)Setup the stream to use a specified number of axes, and to queue actions in a stream buffer. Afterwards, you may call the resulting stream buffer on arbitrary axes. This mode does not allow for unit conversions.
Arguments
| Name | Type | Description |
|---|---|---|
| streamBuffer | StreamBuffer | The stream buffer to queue actions in. |
| axesCount | Int | The number of axes in the stream. |
m
try await stream.setupStoreComposite(streamBuffer, ...axes)Setup the stream to control the specified axes and queue actions into a stream buffer. Allows use of lockstep axes in a stream.
Arguments
| Name | Type | Description |
|---|---|---|
| streamBuffer | StreamBuffer | The stream buffer to queue actions in. |
| ...axes | [StreamAxisDefinition] | Definition of the stream axes. |
m
m
m
m
try await stream.wait(time, unit = Units.native)Wait a specified time.
Arguments
| Name | Type | Description |
|---|---|---|
| time | Double | Amount of time to wait. |
| unit | Units | Units of time. |