Fix #120: send axis position signal to controller output

parent 9c8a1e63
Pipeline #1050 passed with stages
in 5 minutes and 50 seconds
......@@ -411,7 +411,70 @@ class Icepap(Controller):
if mode == "INPOS":
_ackcommand(self._cnx, "%d:POS INPOS 0" % address)
_ackcommand(self._cnx,"%d:LTRACK %s" % (address,mode))
@object_method(types_info=(("bool", "str", "sense"), "None"))
def activate_axis_to_sync(self, axis, activate=True, signal='MEASURE',
sense='NORMAL'):
"""
Send the given motor position to IcePAP controller
"SYNCRO" output (DB9 on controller front panel)
Valid values for *signal* are:
- AXIS - axis nominal position
- MOTOR - axis electrical phase (MOTOR internal variable)
- MEASURE (default) - signal used as axis measurement
- SHFTENC
- CTRLENC
- ENCIN
- INPOS
- ABSENC
Valid values for *sense* are:
- NORMAL (default)
- INVERTED
Args:
axis (Axis): concerned axis object
Keyword Args:
activate (bool): activate or de-activate axis to sync [default: True]
signal (str): position signal [default: MEASURE]
sense (str): position signal sense [default: NORMAL]
"""
address = axis.address
if not activate:
# only remove pmux if the axis is active (avoid deactivating
# other axes unintentionally)
if self.is_axis_to_sync_active(axis):
self.pmux_remove()
return
# remove any previous multiplexer rule
self.pmux_remove()
# set the new multiplexer rule
cmd = "PMUX HARD B{0}".format(address)
_ackcommand(self._cnx, cmd)
# set which signal the DRIVER has to send to multiplexer
cmd = '{0}:SYNCPOS {1} {2}'.format(address, signal, sense)
_ackcommand(self._cnx, cmd)
@object_method(types_info=("None","bool"))
def is_axis_to_sync_active(self, axis):
"""
Tell if the given axis is feeding a position signal to the
"SYNCRO" output (DB9 on controller front panel)
Returns:
bool: True if active or False otherwise
"""
return 'B{0}'.format(axis.address) in _command(self._cnx, '?PMUX')
def pmux_remove(self):
_command(self._cnx, "PMUX REMOVE")
def reset(self):
_command(self._cnx,"RESET")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment