The following examples illustrate how you can obtain an instance of this type:
from zaber_motion.ascii import Connection
from zaber_motion.gcode import OfflineTranslator
connection = Connection.open_serial_port('COM3')
device = connection.get_device(1)
offline_translator = OfflineTranslator.setup_from_device(device, [1, 2])offline_translator.get_axis_coordinate_system_offset(coordinate_system, axis, unit)| Name | Type | Description |
|---|---|---|
| coordinate_system | str | Coordinate system (e.g. G54). |
| axis | str | Letter of the axis. |
| unit | LengthUnits | Units of position. |
float Offset in translator units of the axis.offline_translator.get_axis_position(axis, unit)| Name | Type | Description |
|---|---|---|
| axis | str | Letter of the axis. |
| unit | LengthUnits | Units of position. |
float Position of translator's axis.offline_translator.set_axis_home_position(axis, position, unit)| Name | Type | Description |
|---|---|---|
| axis | str | Letter of the axis. |
| position | float | The home position. |
| unit | LengthUnits | Units of position. |
offline_translator.set_axis_position(axis, position, unit)| Name | Type | Description |
|---|---|---|
| axis | str | Letter of the axis. |
| position | float | The position. |
| unit | LengthUnits | Units of position. |
offline_translator.set_axis_secondary_home_position(axis, position, unit)| Name | Type | Description |
|---|---|---|
| axis | str | Letter of the axis. |
| position | float | The home position. |
| unit | LengthUnits | Units of position. |
offline_translator.set_traverse_rate(traverse_rate, unit)| Name | Type | Description |
|---|---|---|
| traverse_rate | float | The traverse rate. |
| unit | VelocityUnits | Units of the traverse rate. |
OfflineTranslator.setup(definition, config = None)| Name | Type | Description |
|---|---|---|
| definition | DeviceDefinition | Definition of device and its peripherals. The definition must match a device that later performs the commands. |
| config | Optional[TranslatorConfig] | Configuration of the translator. |
OfflineTranslator New instance of translator.OfflineTranslator.setup_from_device(device, axes, config = None)| Name | Type | Description |
|---|---|---|
| device | Device | Device that later performs the command streaming. |
| axes | List[int] | Axis numbers that are later used to setup the stream. For a lockstep group specify only the first axis of the group. |
| config | Optional[TranslatorConfig] | Configuration of the translator. |
OfflineTranslator New instance of translator.offline_translator.translate(block)| Name | Type | Description |
|---|---|---|
| block | str | Block (line) of G-code. |
TranslateResult Result of translation containing the stream commands.