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:

Properties

p

axes

readonlythrows
try stream.axes
[StreamAxisDefinition] An array of axes definitions the stream is set up to control.
p

device

readonly
stream.device
Device Device that controls this stream.
p

io

readonly
stream.io
StreamIo Gets an object that provides access to I/O for this stream.
p

mode

readonlythrows
try stream.mode
StreamMode Current mode of the stream.
p

streamId

readonly
stream.streamId
Int The number that identifies the stream on the device.

Methods

m

arcAbsolute()

asyncthrows
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
NameTypeDescription
rotationDirectionRotationDirectionThe direction of the rotation.
centerXMeasurementThe first dimension of the position of the center of the circle on which the arc exists.
centerYMeasurementThe second dimension of the position of the center of the circle on which the arc exists.
endXMeasurementThe first dimension of the end position of the arc.
endYMeasurementThe second dimension of the end position of the arc.
m

arcAbsoluteOn()

asyncthrows
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
NameTypeDescription
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.
rotationDirectionRotationDirectionThe direction of the rotation.
centerXMeasurementThe first dimension of the position of the center of the circle on which the arc exists.
centerYMeasurementThe second dimension of the position of the center of the circle on which the arc exists.
endXMeasurementThe first dimension of the end position of the arc.
endYMeasurementThe second dimension of the end position of the arc.
m

arcRelative()

asyncthrows
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
NameTypeDescription
rotationDirectionRotationDirectionThe direction of the rotation.
centerXMeasurementThe first dimension of the position of the center of the circle on which the arc exists.
centerYMeasurementThe second dimension of the position of the center of the circle on which the arc exists.
endXMeasurementThe first dimension of the end position of the arc.
endYMeasurementThe second dimension of the end position of the arc.
m

arcRelativeOn()

asyncthrows
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
NameTypeDescription
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.
rotationDirectionRotationDirectionThe direction of the rotation.
centerXMeasurementThe first dimension of the position of the center of the circle on which the arc exists.
centerYMeasurementThe second dimension of the position of the center of the circle on which the arc exists.
endXMeasurementThe first dimension of the end position of the arc.
endYMeasurementThe second dimension of the end position of the arc.
m

call()

asyncthrows
try await stream.call(streamBuffer)
Append the actions in a stream buffer to the queue.
Arguments
NameTypeDescription
streamBufferStreamBufferThe stream buffer to call.
m

checkDisabled()

asyncthrows
try await stream.checkDisabled()
Queries the stream status from the device and returns boolean indicating whether the stream is disabled. Useful to determine if streaming was interrupted by other movements.
Return Value
Bool True if the stream is disabled.
m

circleAbsolute()

asyncthrows
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
NameTypeDescription
rotationDirectionRotationDirectionThe direction of the rotation.
centerXMeasurementThe first dimension of the position of the center of the circle.
centerYMeasurementThe second dimension of the position of the center of the circle.
m

circleAbsoluteOn()

asyncthrows
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
NameTypeDescription
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.
rotationDirectionRotationDirectionThe direction of the rotation.
centerXMeasurementThe first dimension of the position of the center of the circle.
centerYMeasurementThe second dimension of the position of the center of the circle.
m

circleRelative()

asyncthrows
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
NameTypeDescription
rotationDirectionRotationDirectionThe direction of the rotation.
centerXMeasurementThe first dimension of the position of the center of the circle.
centerYMeasurementThe second dimension of the position of the center of the circle.
m

circleRelativeOn()

asyncthrows
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
NameTypeDescription
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.
rotationDirectionRotationDirectionThe direction of the rotation.
centerXMeasurementThe first dimension of the position of the center of the circle.
centerYMeasurementThe second dimension of the position of the center of the circle.
m

cork()

asyncthrows
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

disable()

asyncthrows
try await stream.disable()
Disables the stream. If the stream is not setup, this command does nothing. Once disabled, the stream will no longer accept stream commands. The stream will process the rest of the commands in the queue until it is empty.
m

genericCommand()

asyncthrows
try await stream.genericCommand(command)
Sends a generic ASCII command to the stream. Keeps resending the command while the device rejects with AGAIN reason.
Arguments
NameTypeDescription
commandStringCommand and its parameters.
m

genericCommandBatch()

asyncthrows
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
NameTypeDescription
batch[String]Array of commands.
m

getMaxCentripetalAcceleration()

asyncthrows
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
NameTypeDescription
unitUnitsUnits of acceleration.
Return Value
Double The maximum centripetal acceleration of the live stream.
m

getMaxSpeed()

asyncthrows
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
NameTypeDescription
unitUnitsUnits of velocity.
Return Value
Double The maximum speed of the stream.
m

getMaxTangentialAcceleration()

asyncthrows
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
NameTypeDescription
unitUnitsUnits of acceleration.
Return Value
Double The maximum tangential acceleration of the live stream.
m

helixAbsoluteOn()

asyncthrows
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
NameTypeDescription
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.
rotationDirectionRotationDirectionThe direction of the rotation.
centerXMeasurementThe first dimension of the position of the center of the circle on which the helix projects.
centerYMeasurementThe second dimension of the position of the center of the circle on which the helix projects.
endXMeasurementThe first dimension of the end position of the helix's arc component.
endYMeasurementThe 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

helixRelativeOn()

asyncthrows
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
NameTypeDescription
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.
rotationDirectionRotationDirectionThe direction of the rotation.
centerXMeasurementThe first dimension of the position of the center of the circle on which the helix projects.
centerYMeasurementThe second dimension of the position of the center of the circle on which the helix projects.
endXMeasurementThe first dimension of the end position of the helix's arc component.
endYMeasurementThe 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

ignoreCurrentDiscontinuity()

throws
try stream.ignoreCurrentDiscontinuity()
Prevents StreamDiscontinuityException as a result of expected discontinuity when resuming streaming.
m

isBusy()

asyncthrows
try await stream.isBusy()
Returns a boolean value indicating whether the live stream is executing a queued action.
Return Value
Bool True if the stream is executing a queued action.
m

lineAbsolute()

asyncthrows
try await stream.lineAbsolute(...endpoint)
Queue an absolute line movement in the stream.
Arguments
NameTypeDescription
...endpoint[Measurement]Positions for the axes to move to, relative to their home positions.
m

lineAbsoluteOn()

asyncthrows
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
NameTypeDescription
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

lineRelative()

asyncthrows
try await stream.lineRelative(...endpoint)
Queue a relative line movement in the stream.
Arguments
NameTypeDescription
...endpoint[Measurement]Positions for the axes to move to, relative to their positions before movement.
m

lineRelativeOn()

asyncthrows
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
NameTypeDescription
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

setHold()

asyncthrows
try await stream.setHold(hold)
Pauses or resumes execution of the stream in live mode. The hold only takes effect during execution of motion segments.
Arguments
NameTypeDescription
holdBoolTrue to pause execution, false to resume.
m

setMaxCentripetalAcceleration()

asyncthrows
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
NameTypeDescription
maxCentripetalAccelerationDoubleMaximum centripetal acceleration at which any stream action is executed.
unitUnitsUnits of acceleration.
m

setMaxSpeed()

asyncthrows
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
NameTypeDescription
maxSpeedDoubleMaximum speed at which any stream action is executed.
unitUnitsUnits of velocity.
m

setMaxTangentialAcceleration()

asyncthrows
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
NameTypeDescription
maxTangentialAccelerationDoubleMaximum tangential acceleration at which any stream action is executed.
unitUnitsUnits of acceleration.
m

setupLive()

asyncthrows
try await stream.setupLive(...axes)
Setup the stream to control the specified axes and to queue actions on the device.
Arguments
NameTypeDescription
...axes[Int]Numbers of physical axes to setup the stream on.
m

setupLiveComposite()

asyncthrows
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
NameTypeDescription
...axes[StreamAxisDefinition]Definition of the stream axes.
m

setupStore()

asyncthrows
try await stream.setupStore(streamBuffer, ...axes)
Setup the stream to control the specified axes and queue actions into a stream buffer.
Arguments
NameTypeDescription
streamBufferStreamBufferThe stream buffer to queue actions in.
...axes[Int]The axis numbers of the physical axes to setup the stream on.
m

setupStoreArbitraryAxes()

asyncthrows
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
NameTypeDescription
streamBufferStreamBufferThe stream buffer to queue actions in.
axesCountIntThe number of axes in the stream.
m

setupStoreComposite()

asyncthrows
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
NameTypeDescription
streamBufferStreamBufferThe stream buffer to queue actions in.
...axes[StreamAxisDefinition]Definition of the stream axes.
m

toString()

throws
try stream.toString()
Returns a string which represents the stream.
Return Value
String String which represents the stream.
m

treatDiscontinuitiesAsError()

throws
try stream.treatDiscontinuitiesAsError()
Makes the stream throw StreamDiscontinuityException when it encounters discontinuities (ND warning flag).
m

uncork()

asyncthrows
try await stream.uncork()
Uncork the front of the queue, unblocking command execution. You can only uncork an idle live stream that is corked.
m

wait()

asyncthrows
try await stream.wait(time, unit = Units.native)
Wait a specified time.
Arguments
NameTypeDescription
timeDoubleAmount of time to wait.
unitUnitsUnits of time.
m

waitUntilIdle()

asyncthrows
try await stream.waitUntilIdle(throwErrorOnFault = true)
Waits until the live stream executes all queued actions.
Arguments
NameTypeDescription
throwErrorOnFaultBoolDetermines whether to throw error when fault is observed.