SetAORotator

Bases: KPFTranslatorFunction

Set the AO rotator destination

KTL Keywords Used:

  • ao.AODCSSIM
  • ao.AOCOMSIM
  • ao.AODCSSFP
Parameters:
  • dest (float) –

    Angle in degrees for the physical drive angle of the rotator.

Source code in kpf/ao/SetAORotator.py
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
46
class SetAORotator(KPFTranslatorFunction):
    '''Set the AO rotator destination

    KTL Keywords Used:

    - `ao.AODCSSIM`
    - `ao.AOCOMSIM`
    - `ao.AODCSSFP`

    Args:
        dest (float): Angle in degrees for the physical drive angle of the
            rotator.
    '''
    @classmethod
    def pre_condition(cls, args, logger, cfg):
        check_input(args, 'dest')

    @classmethod
    def perform(cls, args, logger, cfg):
        ao = ktl.cache('ao')
        dest = args.get('dest', 0)
        log.debug(f"Setting AO Rotator to {dest:.1f}")
        ao['OBRT'].write(dest)
        ao['OBRTMOVE'].write('1')

    @classmethod
    def post_condition(cls, args, logger, cfg):
        success = ktl.waitfor('($ao.OBRTSTST == INPOS)', timeout=180)
        if success is not True:
            ao = ktl.cache('ao')
            raise FailedToReachDestination(ao['OBRTSTST'].read(), 'INPOS')

    @classmethod
    def add_cmdline_args(cls, parser, cfg=None):
        parser.add_argument('dest', type=float,
                            help="Desired rotator position")
        return super().add_cmdline_args(parser, cfg)