#!/bin/csh -f #+ # skypa -- set rotator celestial position angle in position angle mode # # Purpose: # With no arguments, show the current rotator position angle as # it would appear on FACSUM. With one numeric argument, set the # rotator to the specified sky position angle. # # Usage: # skypa [-relative] [angle] # # Arguments: # angle = rotator position angle [degrees] # # Options: # -relative = apply a delta move; default is absolute move # # Output: # Current or new position angle [degrees] # # Restrictions: # - DEIMOS must be the selected instrument # # Exit values: # 0 = normal completion # 1 = wrong number of arguments # # Example: # #- # Modification history: # 2002-Aug-12 GDW Original version # 2012-May-30 GDW Add -relative option #----------------------------------------------------------------------- set buf = $0 set cmd = $buf:t set usage = "Usage: $cmd [angle]" set mode = absolute # parse flags... while ( $#argv > 0 ) # check for -debug flag... if ( "$1" =~ \-d* ) then set debug = 1 printf "DEBUG MODE enabled\n\a" shift continue endif # check for -relative flag... if ( "$1" =~ \-r* ) then set mode = relative shift continue endif # exit flag check if no flags remain... break end # verify args... if ( $#argv > 1 ) then printf "$usage\n" exit 1 endif # check the instrument... set instrume = `show -s dcs -terse instrume` if ( $instrume != "DEIMOS" ) then printf "ERROR -- current instrument is not DEIMOS\n" exit 2 endif # take appropriate action... if ( $#argv == 0 ) then set rotposn = `show -s dcs2 -terse rotposn` set skypa = `calc "$rotposn+90"` printf "%g\n" $skypa else # validate argument... set skypa = $1 is_float $skypa > /dev/null if ( $status != 0 ) then printf "$usage\n" exit 1 endif # set rotator angle... if ( "$mode" == "relative" ) then set rotdest = `show -s dcs2 -terse rotdest` set rotdest = `calc $rotdest + $skypa` else set rotdest = `calc "$skypa-90"` endif # make the move... if ( $?debug ) then echo modify -s dcs ROTDEST=$rotdest ROTMODE=1 echo sleep 3 echo waitfor -s dcs ROTSTAT=8 exit endif modify -s dcs ROTDEST=$rotdest ROTMODE=1 sleep 3 waitfor -s dcs ROTSTAT=8 endif