Triggerclass
Module: zaber_motion.ascii
A handle for a trigger with this number on the device. Triggers allow setting up actions that occur when a certain condition has been met or an event has occurred. Please note that the Triggers API is currently an experimental feature.
Requires at least Firmware 7.06.
To use this type, add from zaber_motion.ascii import Trigger to the top of your source code.
Properties
ptrigger.device
Device Device that this trigger belongs to.
ptrigger.trigger_number
int Number of this trigger.
Methods
mclear_action()
async availabletrigger.clear_action(action = TriggerAction.ALL)
Arguments
| Name | Type | Description |
|---|
| action | TriggerAction | The action number to clear. The default option is to clear all actions. |
mtrigger.disable()
Disables the trigger. Once disabled, the trigger will not fire and trigger actions will not run, even if trigger conditions are met.
mtrigger.enable(count = 0)
Enables the trigger. Once a trigger is enabled, it will fire whenever its condition transitions from false to true. If a trigger condition is true when a disabled trigger is enabled, the trigger will fire immediately.
Arguments
| Name | Type | Description |
|---|
| count | int | Number of times the trigger will fire before disabling itself. If count is not specified, or 0, the trigger will fire indefinitely. |
mfire_at_interval()
async availabletrigger.fire_at_interval(interval, unit = Units.NATIVE)
Set a trigger condition based on a time interval.
Arguments
| Name | Type | Description |
|---|
| interval | float | The time interval between trigger fires. |
| unit | TimeUnits | Units of time. |
mfire_when()
async availabletrigger.fire_when(condition)
Set a generic trigger condition.
Arguments
| Name | Type | Description |
|---|
| condition | str | The condition to set for this trigger. |
mfire_when_absolute_setting()
async availabletrigger.fire_when_absolute_setting(axis, setting, trigger_condition, value, unit = Units.NATIVE)
Set a trigger condition based on an absolute setting value.
Arguments
| Name | Type | Description |
|---|
| axis | int | The axis to monitor for this condition. Set to 0 for device-scope settings. |
| setting | str | The setting to monitor. |
| trigger_condition | TriggerCondition | Comparison operator. |
| value | float | Comparison value. |
| unit | UnitsAndLiterals | Units of value. |
mfire_when_distance_travelled()
async availabletrigger.fire_when_distance_travelled(axis, distance, unit = Units.NATIVE)
Set a trigger condition for when an axis position has changed by a specific distance.
Arguments
| Name | Type | Description |
|---|
| axis | int | The axis to monitor for this condition. May be set to 0 on single-axis devices only. |
| distance | float | The measured distance between trigger fires. |
| unit | LengthUnits | Units of dist. |
mfire_when_encoder_distance_travelled()
async availabletrigger.fire_when_encoder_distance_travelled(axis, distance, unit = Units.NATIVE)
Set a trigger condition for when an encoder position has changed by a specific distance.
Arguments
| Name | Type | Description |
|---|
| axis | int | The axis to monitor for this condition. May be set to 0 on single-axis devices only. |
| distance | float | The measured encoder distance between trigger fires. |
| unit | LengthUnits | Units of dist. |
mfire_when_io()
async availabletrigger.fire_when_io(port_type, channel, trigger_condition, value)
Set a trigger condition based on an IO channel value.
Arguments
| Name | Type | Description |
|---|
| port_type | IoPortType | The type of IO channel to monitor. |
| channel | int | The IO channel to monitor. |
| trigger_condition | TriggerCondition | Comparison operator. |
| value | float | Comparison value. |
mfire_when_setting()
async availabletrigger.fire_when_setting(axis, setting, trigger_condition, value, unit = Units.NATIVE)
Set a trigger condition based on a setting value.
Arguments
| Name | Type | Description |
|---|
| axis | int | The axis to monitor for this condition. Set to 0 for device-scope settings. |
| setting | str | The setting to monitor. |
| trigger_condition | TriggerCondition | Comparison operator. |
| value | float | Comparison value. |
| unit | UnitsAndLiterals | Units of value. |
mget_enabled_state()
async availabletrigger.get_enabled_state()
Gets the enabled state of the trigger.
Return Value
mget_label()
async availabletrigger.get_label()
Returns the label for the trigger.
Return Value
str The label for the trigger.
mget_state()
async availabletrigger.get_state()
Gets the state of the trigger.
Return Value
mtrigger.on_fire(action, axis, command)
Set a command to be a trigger action.
Arguments
| Name | Type | Description |
|---|
| action | TriggerAction | The action number to assign the command to. |
| axis | int | The axis to on which to run this command. Set to 0 for device-scope settings or to run command on all axes. |
| command | str | The command to run when the action is triggered. |
mon_fire_set()
async availabletrigger.on_fire_set(action, axis, setting, operation, value, unit = Units.NATIVE)
Set a trigger action to update a setting.
Arguments
| Name | Type | Description |
|---|
| action | TriggerAction | The action number to assign the command to. |
| axis | int | The axis on which to change the setting. Set to 0 to change the setting for the device. |
| setting | str | The name of the setting to change. |
| operation | TriggerOperation | The operation to apply to the setting. |
| value | float | Operation value. |
| unit | UnitsAndLiterals | Units of value. |
mon_fire_set_to_setting()
async availabletrigger.on_fire_set_to_setting(action, axis, setting, operation, from_axis, from_setting)
Set a trigger action to update a setting with the value of another setting.
Arguments
| Name | Type | Description |
|---|
| action | TriggerAction | The action number to assign the command to. |
| axis | int | The axis on which to change the setting. Set to 0 to change the setting for the device. |
| setting | str | The name of the setting to change. Must have either integer or boolean type. |
| operation | TriggerOperation | The operation to apply to the setting. |
| from_axis | int | The axis from which to read the setting. Set to 0 to read the setting from the device. |
| from_setting | str | The name of the setting to read. Must have either integer or boolean type. |
mset_label()
async availabletrigger.set_label(label)
Sets the label for the trigger.
Arguments
| Name | Type | Description |
|---|
| label | Optional[str] | The label to set for this trigger. If no value or an empty string is provided, this label is deleted. |