API Reference v9.2.0

Deviceclass

Module: ZaberMotionBinary

Represents a device using the binary protocol.

To use this type, add import ZaberMotionBinary to the top of your source code.

Constants

c

defaultMovementTimeout

Device.defaultMovementTimeout
Double Default timeout for move commands in seconds.
Value
60

Properties

p

connection

readonly
device.connection
Connection Connection of this device.
p

deviceAddress

readonly
device.deviceAddress
Int The device address uniquely identifies the device on the connection. It can be configured or automatically assigned by the renumber command.
p

deviceId

readonlythrows
try device.deviceId
Int Unique ID of the device hardware.
p

deviceType

readonlythrows
try device.deviceType
DeviceType Determines the type of an device and units it accepts.
p

firmwareVersion

readonlythrows
try device.firmwareVersion
FirmwareVersion Version of the firmware.
p

identity

readonlythrows
try device.identity
DeviceIdentity Identity of the device.
p

isIdentified

readonlythrows
try device.isIdentified
Bool Indicates whether or not the device has been identified.
p

isPeripheral

readonlythrows
try device.isPeripheral
Bool Indicates whether the device is a peripheral or part of an integrated device.
p

name

readonlythrows
try device.name
String Name of the product.
p

peripheralId

readonlythrows
try device.peripheralId
Int Unique ID of the peripheral hardware.
p

peripheralName

readonlythrows
try device.peripheralName
String Name of the peripheral hardware.
p

serialNumber

readonlythrows
try device.serialNumber
UInt Serial number of the device. Requires at least Firmware 6.15 for devices or 6.24 for peripherals.
p

settings

readonly
device.settings
DeviceSettings Settings and properties of this axis.

Methods

m

genericCommand()

asyncthrows
try await device.genericCommand(command, data = 0, timeout = 0.0, checkErrors = true)
Sends a generic Binary command to this device. For more information please refer to the Binary Protocol Manual.
Arguments
NameTypeDescription
commandCommandCodeCommand to send.
dataIntOptional data argument to the command. Defaults to zero.
timeoutDoubleNumber of seconds to wait for a response from the device. 0 or negative defaults to 0.5s.
checkErrorsBoolControls whether to throw an exception when the device rejects the command.
Return Value
Message A response to the command.
m

genericCommandNoResponse()

asyncthrows
try await device.genericCommandNoResponse(command, data = 0)
Sends a generic Binary command to this device without expecting a response. For more information please refer to the Binary Protocol Manual.
Arguments
NameTypeDescription
commandCommandCodeCommand to send.
dataIntOptional data argument to the command. Defaults to zero.
m

genericCommandWithUnits()

asyncthrows
try await device.genericCommandWithUnits(command, data = 0, fromUnit = Units.native, toUnit = Units.native, timeout = 0.0)
Sends a generic Binary command to this device with unit conversions for both sent data and retrieved data.
Arguments
NameTypeDescription
commandCommandCodeCommand to send.
dataDoubleData argument to the command. Defaults to zero.
fromUnitUnitsUnit to convert sent data from.
toUnitUnitsUnit to convert retrieved data to.
timeoutDoubleNumber of seconds to wait for a response from the device. 0 or negative defaults to 0.5s.
Return Value
Double Data that has been converted to the provided unit.
m

getPosition()

asyncthrows
try await device.getPosition(unit = Units.native)
Returns current device position.
Arguments
NameTypeDescription
unitUnitsUnits of position.
Return Value
Double Axis position.
m

home()

asyncthrows
try await device.home(unit = Units.native, timeout = Device.defaultMovementTimeout)
Homes device. Device returns to its homing position.
Arguments
NameTypeDescription
unitUnitsUnit to convert returned position to.
timeoutDoubleNumber of seconds to wait for response from the device chain (defaults to 60s).
Return Value
Double Current position that has been converted to the provided unit.
m

identify()

asyncthrows
try await device.identify(assumeVersion = nil)
Queries the device and the database, gathering information about the product. Without this information features such as unit conversions will not work. Usually, called automatically by detect devices method.
Arguments
NameTypeDescription
assumeVersionFirmwareVersion?The identification assumes the specified firmware version instead of the version queried from the device. Providing this argument can lead to unexpected compatibility issues.
Return Value
DeviceIdentity Device identification data.
m

isBusy()

asyncthrows
try await device.isBusy()
Check whether the device is moving.
Return Value
Bool True if the device is currently executing a motion command.
m

isParked()

asyncthrows
try await device.isParked()
Returns bool indicating whether the axis is parked or not. Requires at least Firmware 6.06.
Return Value
Bool True if the axis is currently parked. False otherwise.
m

moveAbsolute()

asyncthrows
try await device.moveAbsolute(position, unit = Units.native, timeout = Device.defaultMovementTimeout)
Move device to absolute position.
Arguments
NameTypeDescription
positionDoubleAbsolute position.
unitUnitsUnit for the provided position as well as position returned by the device.
timeoutDoubleNumber of seconds to wait for response from the device chain (defaults to 60s).
Return Value
Double Current position that has been converted to the provided unit.
m

moveRelative()

asyncthrows
try await device.moveRelative(position, unit = Units.native, timeout = Device.defaultMovementTimeout)
Move device to position relative to current position.
Arguments
NameTypeDescription
positionDoubleRelative position.
unitUnitsUnit for the provided position as well as position returned by the device.
timeoutDoubleNumber of seconds to wait for response from the device chain (defaults to 60s).
Return Value
Double Current position that has been converted to the provided unit.
m

moveVelocity()

asyncthrows
try await device.moveVelocity(velocity, unit = Units.native)
Begins to move device at specified speed.
Arguments
NameTypeDescription
velocityDoubleMovement velocity.
unitUnitsUnit to convert returned velocity to.
Return Value
Double Device velocity that has been converted to the provided unit.
m

park()

asyncthrows
try await device.park()
Parks the axis. Motor drivers remain enabled and hold current continues to be applied until the device is powered off. It can later be unparked and moved without first having to home it. Requires at least Firmware 6.06.
m

stop()

asyncthrows
try await device.stop(unit = Units.native, timeout = Device.defaultMovementTimeout)
Stops ongoing device movement. Decelerates until zero speed.
Arguments
NameTypeDescription
unitUnitsUnit to convert returned position to.
timeoutDoubleNumber of seconds to wait for response from the device chain (defaults to 60s).
Return Value
Double Current position that has been converted to the provided unit.
m

toString()

throws
try device.toString()
Returns a string that represents the device.
Return Value
String A string that represents the device.
m

unpark()

asyncthrows
try await device.unpark()
Unparks axis. Axis will now be able to move. Requires at least Firmware 6.06.
m

waitUntilIdle()

asyncthrows
try await device.waitUntilIdle()
Waits until device stops moving.