Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.apo.nmsu.edu/Telescopes/TCC/html/rotate_8py_source.html
Дата изменения: Tue Sep 15 02:25:37 2015
Дата индексирования: Sun Apr 10 00:44:56 2016
Кодировка:
lsst.tcc: python/tcc/cmd/rotate.py Source File
lsst.tcc  1.2.2-3-g89ecb63
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
rotate.py
Go to the documentation of this file.
1 from __future__ import division, absolute_import
2 
3 from twistedActor import CommandError
4 
5 import tcc.base
6 from tcc.parse import getPVTList, getRestart
7 from .checkTargetForSlew import checkTargetForSlew
8 from .startSlew import startSlew
9 from .trackStop import trackStop
10 
11 __all__ = ["rotate"]
12 
13 def rotate(tccActor, userCmd):
14  """Implement the rotate command
15 
16  @todo: Handle these qualifiers:
17  - ScanVelocity
18  - PtErr (raises a not implemented error)
19  @todo: for the position check, improve the error and warning reporting; right now it is much too minimal
20 
21  @param[in,out] tccActor tcc actor;
22  modifies obj and slewCmd
23  @param[in,out] userCmd rotate command
24  """
25  parsedCmd = userCmd.parsedCmd
26  if not tccActor.inst.hasRotator():
27  raise CommandError("The current instrument has no rotator")
28 
29  qualDict = parsedCmd.qualDict
30  if qualDict["stop"].boolValue:
31  return trackStop(tccActor=tccActor, userCmd=userCmd, doObj=False, doRot=True)
32 
33  # modify a copy of obj; if all goes well then switch to the copy
34  newObj = tcc.base.Obj(tccActor.obj)
35  nextTAI = tcc.base.tai() + tccActor.tune.trackInterval + tccActor.tune.trackAdvTime
36 
37  doRestart = getRestart(
38  qual = qualDict["restart"],
39  rotExists = tccActor.inst.hasRotator(),
40  )
41  perfect = qualDict["perfect"].boolValue
42 
43  if qualDict["refcoefficients"].boolValue:
44  tccActor.weath.updateSite(newObj.site)
45 
46  rotAngleParam = parsedCmd.paramDict["rotangle"]
47  isNewRot = rotAngleParam.boolValue
48  if isNewRot:
49  # getPVTList returns (pvtList, rotOmitted), so we want the [0][0] returned value, a single PVT
50  newObj.rotUser = getPVTList(rotAngleParam, numAxes=1, defTAI=nextTAI)[0][0]
51 
52  rotTypeParam = parsedCmd.paramDict["rottype"]
53  if rotTypeParam.boolValue:
54  rotTypeName = rotTypeParam.valueList[0].keyword
55  newObj.rotType = tcc.base.RotTypeNameDict[rotTypeName.lower()]
56  if not isNewRot:
57  # I don't think this can happen, but just in case...
58  raise CommandError("rotation angle required if rotation type specified")
59  elif isNewRot:
60  raise CommandError("rotation type required if rotation angle specified")
61 
62  if newObj.userSys.getName() == "mount":
63  newObj.azWrapPref = tcc.base.WrapType_None
64  else:
65  # don't unwrap azimuth axis; we're just changing the rotator
66  newObj.azWrapPref = tcc.base.WrapType_Nearest
67 
68  if newObj.rotType == tcc.base.RotType_Mount:
69  newObj.rotWrapPref = tcc.base.WrapType_None
70  else:
71  newObj.rotWrapPref = tcc.base.WrapTypeNameDict[qualDict["rotwrap"].valueList[0].lower()]
72 
74  tccActor = tccActor,
75  userCmd = userCmd,
76  newObj = newObj,
77  isNewObj = False,
78  isNewRot = isNewRot,
79  doWrap = True,
80  doRestart = doRestart,
81  perfect = perfect,
82  tai = nextTAI,
83  )
84  if userCmd.isDone:
85  return
86 
87  startSlew(
88  tccActor = tccActor,
89  obj = newObj,
90  slewCmd = userCmd,
91  doAbsRefCorr = qualDict["absrefcorrect"].boolValue,
92  doCollimate = qualDict["collimate"].boolValue,
93  )
def getRestart
Get a list of axes from the /Restart qualifier.
Definition: getRestart.py:15
def rotate
Definition: rotate.py:13
def getPVTList
Obtain a list of PVTs from a PVT list parameter.
Definition: getPVTList.py:10