SOP/UOP may not be available
gavanderhoorn opened this issue · comments
Depending on how the controller is configured, the UOP
and/or SOP
IO elements may not be available.
This makes it impossible to use various functions in controller.py
:
dominh/src/dominh/controller.py
Lines 174 to 245 in d47b6db
def tp_enabled(conx): | |
"""Determine whether the Teach Pendant is currently enabled. | |
Checks SOP output index 7 (from kliosop.kl). | |
:returns: True if the TP is 'ON' | |
:rtype: bool | |
""" | |
return io_read_sopout(conx, idx=kliosop.SOPO_TPENBL) == IO_ON | |
def is_faulted(conx): | |
"""Determine whether the controller is currently faulted. | |
Checks SOP output index 3 (from kliosop.kl). | |
:returns: True if there is an active fault on the controller | |
:rtype: bool | |
""" | |
return io_read_sopout(conx, idx=kliosop.SOPO_FAULT) == IO_ON | |
def is_e_stopped(conx): | |
"""Determine whether the controller is currently e-stopped. | |
Checks SOP input index 0 (from kliosop.kl). | |
:returns: True if the e-stop is active | |
:rtype: bool | |
""" | |
# active low input | |
return io_read_sopin(conx, idx=kliosop.SOPI_ESTOP) == IO_OFF | |
def in_remote_mode(conx): | |
"""Determine whether the controller is in remote mode. | |
Checks SOP output index 0 (from kliosop.kl). | |
:returns: True if a program is running. | |
:rtype: bool | |
""" | |
return io_read_sopout(conx, idx=kliosop.SOPO_REMOTE) == IO_ON | |
def is_program_running(conx): | |
"""Determine whether the controller is executing a program. | |
NOTE: this does not check for any specific program, but will return | |
True whenever the currently selected program (or any of its children) | |
are not PAUSED or ABORTED. | |
Checks UOP output index 3 (from kliouop.kl). | |
:returns: True if a program is running. | |
:rtype: bool | |
""" | |
return io_read_uopout(conx, idx=kliouop.UOPO_PROGRUN) == IO_ON | |
def is_program_paused(conx): | |
"""Determine whether there is a paused program on the controller. | |
NOTE: this does not check for any specific program, but will return | |
True whenever the currently selected program is PAUSED. | |
Checks UOP output index 4 (from kliouop.kl). | |
:returns: True if a program is paused. | |
:rtype: bool | |
""" | |
return io_read_uopout(conx, idx=kliouop.UOPO_PAUSED) == IO_ON |
as they make use of those elements.
With 9afa99a at least the example doesn't crash any more.