You are here: Foswiki>Software Web>GCS (03 Jun 2021, JohnHill)Edit Attach

Guiding Control System

Controls AGW units. Runs full guiding for LUCI, MODS / PEPSI (secondary focus) and PEPSI PFU (tertiary focus). LBTI/LN and LBC have own autoguiders and GCS is not in control. Part of TCS. MODS off-axis control is different from rest of off-axis controllers.

digraph G { rankdir=LR node[shape=box, style=filled] TCS[fillcolor=gray] GCS[fillcolor=lightblue]

subgraph cluster_oac { label="oac" OACServer[fillcolor=gold] }

subgraph cluster_MODS { label="MODS" AGWMODS[fillcolor=gold] }

subgraph cluster_azcam { label="azcam" AZCam[fillcolor=gold] }

subgraph cluster_HW { label="Hardware" node[fillcolor=lightyellow] GuidingCCD WFSCCD AGWAIPUMAC AGWMODSUMAC }


GCS consists of two major modules, i.e. the off-axis autoguider and the wavefront sensing system. The autoguiding task of the GCS consists of controlling the AGW and providing the TCS with the information on the position of the guide star.

GCS functions

  • Acquire Movie
  • Acquisition before guiding
  • Guiding
  • WaveFront Sensing (WFS) for active optics (5-30 seconds/cycle, not the fast loop for AO)

GCS uses PCS for any xy (focal plane) <-> RADEC transformation. Guiding cameras are using AzCam controlling program. GCS controls AGW probes, calling OAC RPCs.


  • when the connection to AGW unit is lost (usually triggered by powering off AGW), GCS might not function properly. GCS restart is recommended every time you power off AGW.
  • For OAC controlled off-axis probes, a restart of oacontrol is recommended as well. Sometimes a reboot of the OAC machine must be performed.
  • TO aren't usually aware of OAC and its subsystems.
  • If you see problems not detecting stars, please consider running sextractor from the command line. See below for details.

GCS configuration

GCS is configured from TCS's gcs/etc/gcs.conf, gcs/configuration/GCS for AGW configuration, and /home/telescope/TCS/Configuration/GCS for instrument configuration. See discussion there.

Running Sextractor from commandline

Current log (not events, TCS [2-][0-9]??????.log file) record command line called when GCS calls sextractor. The line can be obtained by:

%CODE{"sh"}% [tcs@tcs1 ~]$ grep -i "SXT.*executing" /lbt/data/logs/tcs/current.log 2019-06-12T01:07:40.114528+00:00 tcs2 LBT_GCSL: SXT: analyzeFile: executing: /lbt/tcs_runtime/sextractor-2.8.6/bin/sex /tmp/leftAcquisition.fits -PIXEL_SCALE 0.108310 -c /home/telescope/TCS/Configuration/GCS/; grep -v '^#' */ /g' >/tmp/ .... %ENDCODE%

Running command line for the correct side and on corect FITS file shall produce star list in /tmp/ Problems can be visible on console, if any (current GCS implementation doesn't capture and store sextractor error output).

GCS Operation

  • IIF knows if to start autoguiding and wavefront sensing (preset configuration must include guide stars, preset command: TRACK, ACQUIRE, GUIDE, ACTIVE.
  • IIF commands PCS to move the telescope
  • When a move is completed by PCS, IIF commands AG to start the acquisition.
  • After the acquisition offset places the star on the guiding hotspot, guiding is started and verified to be stable.
  • When guiding and wavefront sensing is requested, start WFS


  • gcs/etc/gcs.conf is read
  • internal values populated
  • connection to AzCam and AGWs establised
  • current authorized AGWs are homed (if controlled by GCS - LUCI, IRTC, PEPSIPOL, PEPSIPFU; not for MODS)


  • newly authorized AGWs are homed (if controlled by GCS - LUCI, IRTC, PEPSIPOL, PEPSIPFU; not for MODS)


  1. Request an acquisition image from the guide camera and wait for it to return. (full frame: guidecam_ROI, guidecam_binning)
  2. GCS runs sextractor to find a guide star on the image.
  3. Use brightness, FWHM and other factors to select the proper star in case multiple stars are found (MSCALE, RSCALE, FSCALE, CSCALE).
  4. If guide star is not found - stop (preset fails)
  5. If guide star is found, send acquisition offset to PCS to place star on the guiding hotspot. (guidecam_hotspot_[xy])
  6. Start guiding:
  7. Configure the camera for subframe centred on guiding hotspot
  8. Request a guiding exposure and wait for it to return.
  9. Run sextractor to get guiding star position.
  10. If the guiding star is lost for a significant time, stop guiding
  11. If the image cannot be used for guiding, go to step #6; stop if guiding is not stable within the first N attempts (preset fails)
  12. If that's the first successful guiding image and WFS is requested, starts WFS thread (see below)
  13. Write centroid data (error estimate, FWHM, stellar and background flux) into shared memory
  14. calls PCS:ApplyGuideCorrection to update the position of the telescope optics
  15. adjust exposure time (if the guide star is too faint/too bright), but keep it within configured limits
  16. go to step #6


WFSingThread.cpp (and friends):

This class runs WFS loop. This is the slow loop used to collimate LBT optics (=active optics). This isn't the fast AO (=adaptive optics) loop.

WFS images are obtained from Shack\x96Hartmann (S-H) sensor. The sensor uses a lenslet array to break the incoming beam (pupil) into sub-apertures, creating an array of spots on the detector. Ideally, the collimated beam shall produce spots on the center of regular (lenslet) grid. The greater the distance of the spot from the grid centre, the worse is the collimation of the incoming beam. Distances are fit with Zernike polynomials, and Zernikes are sent to the PSF subsystem for correction of the optics.

After the following conditions are met:
  • stable guiding (e.g. guide star found, centred and in the spot (wfs field stop at the position of guiding hotspot)
  • WFS requested and not paused

Then thread's execute method performs those actions:
  1. Read & parse the configuration file - populates internal variables
  2. Request an image from the WFS camera and wait for it to return (with appropriate timeouts if no image within the expected time).
  3. Check if the image (spots) is too faint or saturated such that it might not be useable.
  4. Adjust exposure time if practical within limits and request another image
  5. Obtain candidate S-H spots (using sextractor) from the image.
  6. Calculate lenslet grid projection on WFS (based on: WFS_hotspot_sext_[xy] WFScam_spacing_[xy], WFS_lenslet_rotation)
  7. Calculate expected shifted pupil position. (based on WFScam_hotspot_[xy] and guide probe position)
  8. Pickup spots for S-H grid calculation (the brightest spots close to ideal lenslet grid centre).
  9. Calculate a distance of all spots from the ideal lenslet projection.
  10. report statistics of spot brightness and FWHM for GCSGUI and telemetry
  11. raw Zernikes are obtained fitting distances and Zernike polynomials (reconstructor: WFS_subDir)
  12. flip some raw Zernikes (Z5, Z8, Z10, etc) if wfs camera is using alternate readout of CCD (WFS_flipX)
  13. raw Zernikes are transformed into primary mirror space (as the sensor might be rotated on the rotator / offs axis pickup arm), so-called calculated Zernikes are produced
  14. Zernikes are corrected for field aberrations expected in the optical design.
  15. Calculated Zernikes are scaled (*) by pre-configured factors.
  16. Zernikes are sent to PSF for mirror correction
  17. After mirrors are stable in position/shape, loop carry over (go to step 1.)

If any of the beforementioned conditions is broken during loop execution, a new image is taken or pause is commanded and the WFS loop is broken. As WFS configuration is re-read during each iteration, changes to the configuration file are propagated automatically (no GCS restart is needed).

GUI Window

Guider image WFS pupil WFS pupil center Sextracted center WFS image

Sextractor tests

From JMH:
The GCS uses the external program sextractor (a.k.a. Source Extractor) to measure the positions of the guide stars. It does some tricky gaussian matching algorithm. I've tested it against IRAF and simple centre-of-gravity algorithms, and it gets the correct answer. The x,y positions are recorded in the tcslog (grep for "GS centroiding analysis").

The accuracy with which you can measure the position of a star image depends on many factors: brightness (brighter is better until you saturate) read noise (lower noise is better) pixel sampling (smaller is better until more read noise kicks in) FWHM (smaller images are better)

When the seeing gets worse you lose twice because there is more natural image motion, and because the FWHM is larger and the centroid is less accurate. For typical guide stars in typical seeing, the centroiding accuracy is something smaller than 1/20 arcsec.

How to Use

Running GCS Command Line Tools

Operating the AzCams

Operating the AGw Stages

Software Notes

Topic revision: r15 - 03 Jun 2021, JohnHill
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback