Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: First rough cut at PFS SETUPFIELD/GETOBJECT abstract commands #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ignore some commonly problematic files

# python compiled files
*.pyc
*.pyo

# emacs backups
*~

22 changes: 22 additions & 0 deletions sk/SPEC/GETOBJECT.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
:Header
AUTHOR=cloomis
TRANSCRIBED=ejeschke

:Parameter
NUM = 1
EXPTIME = 15

:Command
:start

:main_start
# Start science exposures. These will continue until
# "exec PFS finishField" is sent to PFS or some planned
# limit is hit.
exec PFS startExposures num=$NUM exptime=$EXPTIME ;

:main_end

:end


95 changes: 95 additions & 0 deletions sk/SPEC/SETUPFIELD.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
:Header
AUTHOR=cloomis
TRANSCRIBED=ejeschke

:Parameter
# we default to the last position sent by PFS if the command is repeated
TARGET = NOP

:Command
:start

# Assume that either we are not yet observing, or that the QA system
# indicates that the running exposure is the last one for theis field.
# Assume that the next field has been selected in the targetting system.

# Get coordinates for next field. Once this command has been run,
# ICC, the AG system, and the FPS also know what the field is.
# NOTE: presumably this can be done concurrently with finishField
exec PFS getNextField ,
# return in status items: PFS.pfsDesign (?), PFS.RA, PFS.DEC, PFS.PA

# Tell SPS that the running exposure (if any) is the last one for
# this field. _Blocks_ until shutter closes (or returns immediately
# if no exposure is active)
exec PFS finishField ;

:main_start

# import Python function to calculate the convergence strategy based
# on some inputs--TODO
from "pfs_utils" import get_convergence_strategy

# Start cobra convergence, slew telescope to field.
# One tricky bit here which I crudely flesh out. If the time to slew
# the rotator is longer than the time to slew the telescope, do all
# fine cobra moves after field acquisition: we do not gain any time by
# turning off the rotator now. But if the rotator slew finishes
# first by an interesting amount, it does pay to stop the rotator
# and make all but the final cobra move now.

# TODO: probably need to pass additional parameters to calculate
# the desired outcome--add later as needed. Probably need azimuth and
# rotator actual position, for example...
asn rot_is_slow = @get_convergence_strategy(!STATS.RA, !STATS.DEC,
!TSCL.INSROTPA_PF,
!PFS.RA, !PFS.DEC, !PFS.PA)

{
if (@rot_is_slow != 0)
exec PFS coarseConvergence dummy=NOP ,
exec TSC TelDrive motor=on ra=!PFS.RA dec=!PFS.DEC ,
exec TSC InsRot_pf motor=on coord=abs telescope=link position=!PFS.PA ;
else
exec TSC TelDrive motor=on ra=!PFS.RA dec=!PFS.DEC ,
{
{
exec PFS coarseConvergence dummy=NOP ,
exec TSC InsRot_pf motor=on coord=abs telescope=link position=!PFS.PA ;
} ;
# stop rotator
exec TSC InsRot_pf motor=off ;
exec PFS continueConvergence dummy=NOP ;
# resume rotator
exec TSC InsRot_pf motor=on coord=abs telescope=link position=!PFS.PA ;
} ;
endif
} ;

# Acquire field. Telescope axes are all moving.
# Note that this might fail and would require manual attention via the AG GUI.
# NOTE: returns PFS.AGRESULT
exec PFS AG_acquireField dummy=NOP ;

# Stop rotator, finish cobra convergence.
exec TSC InsRot_pf motor=off ;
exec PFS finishConvergence dummy=NOP ;

# Restart rotator and allow AG to recenter and start guiding. Field
# should be very close: the AG wlll probably only need a single
# confirmation frame.
exec TSC insrot_pf motor=on coord=abs telescope=link position=!PFS.PA ;

# NOTE: not sure if this ends up being a TSC command or a PFS command (or both);
# it depends on some details of the telescope side that we need to find out
exec TSC ag readout=on exposure=!PFS.AG_EXP_TIME;
#exec PFS ag readout=on exposure=!PFS.AG_EXP_TIME;

# wait for the rotator to settle (may be desirable)
exec OBS check_status mode=AND timeout=0360 N1=[STATS.ROTDIF_PF -0.005 +0.005] ;
# if/after the windscreen is fixed you may need this one as well
#exec OBS check_status mode=AND timeout=0720 N1=[STATL.WINDSDIF_SIGN -0.5 +10.0] ;

:main_end

:end