Bases: KPFTranslatorFunction
Start the agitator motion and wait the appropriate startup time before
returning.
ARGS:
None
Source code in kpf/spectrograph/StartAgitator.py
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 | class StartAgitator(KPFTranslatorFunction):
'''Start the agitator motion and wait the appropriate startup time before
returning.
ARGS:
=====
None
'''
@classmethod
def pre_condition(cls, args, logger, cfg):
pass
@classmethod
def perform(cls, args, logger, cfg):
agitator = ktl.cache('kpfmot', 'AGITATOR')
if agitator.read() == 'Running':
log.debug('Agitator is running')
else:
startup = cfg.getfloat('times', 'agitator_startup_time', fallback=0.325)
log.debug('Starting agitator motion')
try:
agitator.write('Run')
except Exception as e:
log.warning('Write to kpfmot.AGITATOR failed')
log.debug(e)
log.warning('Retrying')
time.sleep(1)
agitator.write('Run')
time.sleep(startup)
@classmethod
def post_condition(cls, args, logger, cfg):
startup = cfg.getfloat('times', 'agitator_startup_time', fallback=0.325)
success = ktl.waitFor('$kpfmot.AGITATOR == Running', timeout=5*startup)
if success is not True:
agitator = ktl.cache('kpfmot', 'AGITATOR')
raise FailedToReachDestination(agitator.read(), 'Running')
|