1 from __future__
import division, absolute_import
3 from twistedActor
import CommandError
6 from tcc.parse import getPVTList, getRestart
7 from .checkTargetForSlew
import checkTargetForSlew
8 from .startSlew
import startSlew
9 from .trackStop
import trackStop
14 """Implement the rotate command
16 @todo: Handle these qualifiers:
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
21 @param[in,out] tccActor tcc actor;
22 modifies obj and slewCmd
23 @param[in,out] userCmd rotate command
25 parsedCmd = userCmd.parsedCmd
26 if not tccActor.inst.hasRotator():
27 raise CommandError(
"The current instrument has no rotator")
29 qualDict = parsedCmd.qualDict
30 if qualDict[
"stop"].boolValue:
31 return trackStop(tccActor=tccActor, userCmd=userCmd, doObj=
False, doRot=
True)
34 newObj = tcc.base.Obj(tccActor.obj)
35 nextTAI = tcc.base.tai() + tccActor.tune.trackInterval + tccActor.tune.trackAdvTime
38 qual = qualDict[
"restart"],
39 rotExists = tccActor.inst.hasRotator(),
41 perfect = qualDict[
"perfect"].boolValue
43 if qualDict[
"refcoefficients"].boolValue:
44 tccActor.weath.updateSite(newObj.site)
46 rotAngleParam = parsedCmd.paramDict[
"rotangle"]
47 isNewRot = rotAngleParam.boolValue
50 newObj.rotUser =
getPVTList(rotAngleParam, numAxes=1, defTAI=nextTAI)[0][0]
52 rotTypeParam = parsedCmd.paramDict[
"rottype"]
53 if rotTypeParam.boolValue:
54 rotTypeName = rotTypeParam.valueList[0].keyword
55 newObj.rotType = tcc.base.RotTypeNameDict[rotTypeName.lower()]
58 raise CommandError(
"rotation angle required if rotation type specified")
60 raise CommandError(
"rotation type required if rotation angle specified")
62 if newObj.userSys.getName() ==
"mount":
63 newObj.azWrapPref = tcc.base.WrapType_None
66 newObj.azWrapPref = tcc.base.WrapType_Nearest
68 if newObj.rotType == tcc.base.RotType_Mount:
69 newObj.rotWrapPref = tcc.base.WrapType_None
71 newObj.rotWrapPref = tcc.base.WrapTypeNameDict[qualDict[
"rotwrap"].valueList[0].lower()]
80 doRestart = doRestart,
91 doAbsRefCorr = qualDict[
"absrefcorrect"].boolValue,
92 doCollimate = qualDict[
"collimate"].boolValue,
def getRestart
Get a list of axes from the /Restart qualifier.
def getPVTList
Obtain a list of PVTs from a PVT list parameter.