Commit d33f6497 authored by Emmanuel Papillon's avatar Emmanuel Papillon
Browse files

add airpad hooks for 3dxrd (wago pulse)

parent 3963ff68
from gevent import sleep
from bliss.common.hook import MotionHook
from bliss.common.logtools import log_debug
class AirpadWagoPulseHook(MotionHook):
def __init__(self, name, config):
self.config = config
self.name = name
self.wago = config["wago"]
super(AirpadWagoPulseHook, self).__init__()
def _add_axis(self, axis):
if len(self.axes):
axis_name = list(self.axes.keys())[0]
raise ValueError(
"Cannot attach WagoAirpadHook {0!r} to {1!r}. "
"It is already attached to {2!r}".format(
self.name, axis.name, axis_name
)
)
super(WagoHook, self)._add_axis(axis)
def set(self, phase):
channel = self.config[phase]["channel"]
wait = self.config[phase].get("wait", 0.1)
log_debug(self, f"start {phase}, pulse on {channel} for {wait} sec.")
self.wago.set(channel, 1)
sleep(wait)
self.wago.set(channel, 0)
log_debug(self, f"finished {phase}")
def pre_move(self, motion_list):
self.set("pre_move")
def post_move(self, motion_list):
self.set("post_move")
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