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.
Index
cConstants
pProperties
Constants
c
Properties
p
p
p
try device.deviceTypeDeviceType Determines the type of an device and units it accepts.p
p
p
p
p
p
Methods
m
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
| Name | Type | Description |
|---|---|---|
| command | CommandCode | Command to send. |
| data | Int | Optional data argument to the command. Defaults to zero. |
| timeout | Double | Number of seconds to wait for a response from the device. 0 or negative defaults to 0.5s. |
| checkErrors | Bool | Controls whether to throw an exception when the device rejects the command. |
Return Value
Message A response to the command.m
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
| Name | Type | Description |
|---|---|---|
| command | CommandCode | Command to send. |
| data | Int | Optional data argument to the command. Defaults to zero. |
m
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
| Name | Type | Description |
|---|---|---|
| command | CommandCode | Command to send. |
| data | Double | Data argument to the command. Defaults to zero. |
| fromUnit | Units | Unit to convert sent data from. |
| toUnit | Units | Unit to convert retrieved data to. |
| timeout | Double | Number 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
try await device.getPosition(unit = Units.native)Returns current device position.
Arguments
| Name | Type | Description |
|---|---|---|
| unit | Units | Units of position. |
Return Value
Double Axis position.m
try await device.home(unit = Units.native, timeout = Device.defaultMovementTimeout)Homes device. Device returns to its homing position.
Arguments
| Name | Type | Description |
|---|---|---|
| unit | Units | Unit to convert returned position to. |
| timeout | Double | Number 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
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
| Name | Type | Description |
|---|---|---|
| assumeVersion | FirmwareVersion? | 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
m
m
try await device.moveAbsolute(position, unit = Units.native, timeout = Device.defaultMovementTimeout)Move device to absolute position.
Arguments
| Name | Type | Description |
|---|---|---|
| position | Double | Absolute position. |
| unit | Units | Unit for the provided position as well as position returned by the device. |
| timeout | Double | Number 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
try await device.moveRelative(position, unit = Units.native, timeout = Device.defaultMovementTimeout)Move device to position relative to current position.
Arguments
| Name | Type | Description |
|---|---|---|
| position | Double | Relative position. |
| unit | Units | Unit for the provided position as well as position returned by the device. |
| timeout | Double | Number 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
try await device.moveVelocity(velocity, unit = Units.native)Begins to move device at specified speed.
Arguments
| Name | Type | Description |
|---|---|---|
| velocity | Double | Movement velocity. |
| unit | Units | Unit to convert returned velocity to. |
Return Value
Double Device velocity that has been converted to the provided unit.m
m
try await device.stop(unit = Units.native, timeout = Device.defaultMovementTimeout)Stops ongoing device movement. Decelerates until zero speed.
Arguments
| Name | Type | Description |
|---|---|---|
| unit | Units | Unit to convert returned position to. |
| timeout | Double | Number 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
m