API Reference v9.2.0
Deviceclass
Module: zaber_motion.ascii
Represents the controller part of one device - may be either a standalone controller or an integrated controller.
The following example illustrates how you can obtain an instance of this type:
from zaber_motion.ascii import Connection
connection = Connection.open_serial_port('COM3')
device = connection.get_device(1)Related Guides:
Index
pProperties
Properties
p
device.all_axesAllAxes Virtual axis which allows you to target all axes of this device.p
p
p
p
p
p
p
device.oscilloscopeOscilloscope Oscilloscope recording helper for this device. Requires at least Firmware 7.00.p
device.pvtPvt Gets an object that provides access to PVT functions of this device. Note that as of ZML v5.0.0, this returns a Pvt object and NOT a PvtSequence object. The PvtSequence can now be obtained from the Pvt object. Requires at least Firmware 7.33.p
p
p
device.streamsStreams Gets an object that provides access to Streams on this device. Requires at least Firmware 7.05.p
p
Methods
m
device.generic_command(command, axis = 0, check_errors = True, timeout = 0)Sends a generic ASCII command to this device. For more information refer to: ASCII Protocol Manual.
Arguments
| Name | Type | Description |
|---|---|---|
| command | str | Command and its parameters. |
| axis | int | Optional axis number to send the command to. |
| check_errors | 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
device.generic_command_multi_response(command, axis = 0, check_errors = True, timeout = 0)Sends a generic ASCII command to this device and expect multiple responses. Responses are returned in order of arrival. For more information refer to: ASCII Protocol Manual.
Arguments
| Name | Type | Description |
|---|---|---|
| command | str | Command and its parameters. |
| axis | int | Optional axis number to send the command to. |
| check_errors | 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
List[Response] All responses to the command.m
device.generic_command_no_response(command, axis = 0)Sends a generic ASCII command to this device without expecting a response and without adding a message ID For more information refer to: ASCII Protocol Manual.
Arguments
| Name | Type | Description |
|---|---|---|
| command | str | Command and its parameters. |
| axis | int | Optional axis number to send the command to. Specifying -1 omits the number completely. |
m
device.get_axis(axis_number)Gets an Axis class instance which allows you to control a particular axis on this device. Axes are numbered from 1.
Arguments
| Name | Type | Description |
|---|---|---|
| axis_number | int | Number of axis intended to control. |
Return Value
Axis Axis instance.m
device.get_command_unit_conversion_descriptors(command_template)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 |
|---|---|---|
| command_template | str | Template of the command. Parameters are denoted by question marks. |
Return Value
List[Optional[UnitConversionDescriptor]] Unit conversion descriptor for each parameter in the command. Nil if a parameter does not have conversion.m
device.get_lockstep(lockstep_group_id)Gets a Lockstep class instance which allows you to control a particular lockstep group on the device.
Requires at least Firmware 6.15 or 7.11.
Arguments
| Name | Type | Description |
|---|---|---|
| lockstep_group_id | int | The ID of the lockstep group to control. Lockstep group IDs start at one. |
Return Value
Lockstep Lockstep instance.m
m
device.identify(assume_version = None)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 |
|---|---|---|
| assume_version | Optional[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
device.prepare_command(command_template, *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 device. Unit conversion is not supported for commands where axes can be remapped, such as stream and PVT commands. For more information refer to: ASCII Protocol Manual.
Arguments
| Name | Type | Description |
|---|---|---|
| command_template | str | Template of a command to prepare. Parameters are denoted by question marks. |
| *parameters | Measurement | Variable number of command parameters. |
Return Value
str Command with converted parameters.m
device.renumber(address)Changes the address of this device. After the address is successfully changed, the existing device class instance no longer represents the device. Instead, use the new device instance returned by this method.
Arguments
| Name | Type | Description |
|---|---|---|
| address | int | The new address to assign to the device. |
Return Value
Device New device instance with the new address.m
device.restore(hard = False)Restores most of the settings to their default values. Deletes all triggers, stream and PVT buffers, servo tunings. Deletes all zaber storage keys. Disables locksteps, unparks axes. Preserves storage, communication settings, peripherals (unless hard is specified). The device needs to be identified again after the restore.
Arguments
| Name | Type | Description |
|---|---|---|
| hard | bool | If true, completely erases device's memory. The device also resets. |
m
m
device.set_state(state, device_only = False)Applies a saved state to this device.
Arguments
| Name | Type | Description |
|---|---|---|
| state | str | The state object to apply to this device. |
| device_only | bool | If true, only device scope settings and features will be set. |
Return Value
SetStateDeviceResponse Reports of any issues that were handled, but caused the state to not be exactly restored.