#!/bin/csh -f #+ # # en e n # # moves the telescope east e and north n arcsecs relative to base, # its current position. # #- # # 20051122 - MB: added -noask flag to wfao # 20060926 - jlyke: added long workaround to FSM faults caused by # large moves (max following error exceeded) # 20080606 - jlyke/rdc: fixed issue that turned wait4ao on incorrectly # # Boiler plate for "-h" support for command autohelp. if ("$1" == "-h") then help $0 exit $status endif # Boilerplate for syncheck. # Note that the boiler plate should be transparent for all usages, # but to make correct use of syncheck you will need to specify the # correct pattern. set noglob set CheckStatus = `syncheck -command $0 $* -pattern float float` unset noglob if ("$CheckStatus" != "OK") then help $0 exit 1 endif # End of help/syncheck boiler plate. # set max size of a single move (must be integer) set threshold = 9 if (${#argv} == 2) then set dmstat = `show -s ao -terse aodmstat` set dtstat = `show -s ao -terse aodtstat` set aofmmove = `show -s ao -terse aofmmove` if ( $dtstat == "closed" && $aofmmove == "true" ) then # moving in steps requires wait4tt or wait4ao to be on wait4ao save if ( $dmstat == "closed" ) then wait4ao on else wait4tt on endif set ratotal = $1 set dectotal = $2 set raorig = $ratotal set decorig = $dectotal ################################################# ### handle negative numbers ################################################# set rasign = `echo $ratotal | cut -c 1` set decsign = `echo $dectotal | cut -c 1` if ( $rasign == - ) then set rasign = -1.0 set ratotal = `math -1 x $ratotal` else set rasign = 1.0 endif if ( $decsign == - ) then set decsign = -1.0 set dectotal = `math -1 x $dectotal` else set decsign = 1.0 endif ################################################# ### csh requires integers for comparison ### build up offset lists ################################################# set raint = `echo $ratotal | cut -f 1 -d .` set decint = `echo $dectotal | cut -f 1 -d .` if ( $raint < $threshold ) then set raoff = `math $rasign x $ratotal` else set raoff = "" while ( $raint > $threshold ) set raoff = ( $raoff `math $rasign x $threshold` ) set ratotal = `math $ratotal - $threshold` set raint = `echo $ratotal | cut -f 1 -d .` end set raoff = ( $raoff `math $rasign x $ratotal` ) endif if ( $decint < $threshold ) then set decoff = `math $decsign x $dectotal` else set decoff = "" while ( $decint > $threshold ) set decoff = ( $decoff `math $decsign x $threshold` ) set dectotal = `math $dectotal - $threshold` set decint = `echo $dectotal | cut -f 1 -d .` end set decoff = ( $decoff `math $decsign x $dectotal` ) endif ################################################# ### now we need lists of equal length ################################################# while ( ${#raoff} != ${#decoff} ) if ( ${#raoff} > ${#decoff} ) then while ( ${#raoff} != ${#decoff} ) set decoff = ( $decoff 0.0 ) end else while ( ${#raoff} != ${#decoff} ) set raoff = ( $raoff 0.0 ) end endif end ################################################# ### now send the moves ################################################# wfao -noask while ( ${#raoff} > 0 ) modify -s dcs raoff=$raoff[1] decoff=$decoff[1] rel2curr=t sleep 2 wfao shift raoff shift decoff end wait4ao restore ################################################# ### else to if ( $dtstat == "closed" ... ################################################# else wfao -noask modify -s dcs silent raoff=$1 decoff=$2 rel2curr=t #modify -s dcs raoff=$1 decoff=$2 rel2curr=t sleep 3 waitfor -s dcs axestat=tracking endif else echo "Usage: en e n" endif