Skip to content
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
8 changes: 6 additions & 2 deletions Config/sequencerd.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ CALIB_DOOR__SHUTDOWN=close
# Virtual Slit Mode slit offset positions
# units are arcseconds
#
VIRTUAL_SLITW_ACQUIRE=0.5 # slit width during acquire
VIRTUAL_SLITW_ACQUIRE=0.4 # slit width during acquire
VIRTUAL_SLITO_ACQUIRE=-3.0 # slit offset for acquiring target
VIRTUAL_SLITO_EXPOSE=3.0 # slit offset for science exposure

Expand Down Expand Up @@ -155,11 +155,15 @@ TCS_PREAUTH_TIME=10 # seconds before end of exposure to notify

# ACAM Target acquisition
#
ACQUIRE_TIMEOUT=90 # seconds before ACAM acquisition sequence aborts on failure to acquire (REQUIRED!)
ACQUIRE_TIMEOUT=120 # seconds before ACAM acquisition sequence aborts on failure to acquire (REQUIRED!)
ACQUIRE_RETRYS=5 # max number of retrys before acquisition fails (optional, can be left blank to disable)
ACQUIRE_OFFSET_THRESHOLD=0.5 # computed offset below this threshold (in arcsec) defines successful acquisition
ACQUIRE_MIN_REPEAT=2 # minimum number of sequential successful acquires
ACQUIRE_TCS_MAX_OFFSET=60 # the maximum allowable offset sent to the TCS, in arcsec
ACQ_AUTOMATIC_MODE=1 # 1=legacy, 2=semi-auto, 3=auto
ACQ_FINE_TUNE_CMD=ngps_acq # command to run after guiding for final fine tune
ACQ_FINE_TUNE_LOG=1 # log fine tune output to /data/<datedir>/logs/ngps_acq_<datedir>.log (0/1)
ACQ_OFFSET_SETTLE=3 # seconds to wait after automatic offset

# Calibration Settings
# CAL_TARGET=(name caldoor calcover U G R I lampthar lampfear lampbluc lampredc lolamp hilamp mod1 mod2 ... mod6)
Expand Down
3 changes: 3 additions & 0 deletions Config/slicecamd.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ SUB_ENDPOINT="tcp://127.0.0.1:@MESSAGE_BROKER_PUB_PORT@"
#
TCSD_PORT=@TCSD_BLK_PORT@
ACAMD_PORT=@ACAMD_BLK_PORT@
# AUTOACQ_ARGS defines defaults for slicecamd in-process ngps_acq.
# This line intentionally includes all supported ngps_acq options.
AUTOACQ_ARGS="--frame-mode stream --input /tmp/slicecam.fits --goal-x 150.0 --goal-y 115.5 --bg-x1 80 --bg-x2 165 --bg-y1 30 --bg-y2 210 --pixel-origin 1 --max-dist 40 --snr 3 --min-adj 4 --centroid-hw 4 --centroid-sigma 1.2 --loop 1 --cadence-sec 4 --prec-arcsec 0.4 --goal-arcsec 0.3 --gain 1.0 --dry-run 0 --tcs-set-units 0 --verbose 1 --debug 1 --use-putonslit 1 --adaptive 1 --adaptive-bright 40000 --adaptive-bright-goal 10000"

# ANDOR=( <name> [emulate] <sn> <scale> <hflip> <vflip> <rot> <temp> <hbin> <vbin> )
# For each slice camera specify:
Expand Down
13 changes: 7 additions & 6 deletions acamd/acam_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,11 @@ namespace Acam {
this->motion.get_current_coverpos() :
"not_connected" );

std::string mode = this->target.acquire_mode_string();
jmessage_out["ACAM_ACQUIRE_MODE"] = mode;
jmessage_out["ACAM_GUIDING"] = ( mode == "guiding" );
jmessage_out["ACAM_ACQUIRING"] = ( mode == "acquiring" );

try {
this->publisher->publish( jmessage_out );
}
Expand Down Expand Up @@ -5522,12 +5527,8 @@ logwrite( function, message.str() );
retstring = message.str();

if ( this->target.acquire_mode == Acam::TARGET_GUIDE ) {
this->target.acquire_mode = Acam::TARGET_ACQUIRE;
this->target.nacquired = 0;
this->target.attempts = 0;
this->target.sequential_failures = 0;
this->target.timeout_time = std::chrono::steady_clock::now()
+ std::chrono::duration<double>(this->target.timeout);
// Keep GUIDE mode; just reset filtering so the new goal takes effect quickly.
this->target.reset_offset_params();
}

return NO_ERROR;
Expand Down
11 changes: 7 additions & 4 deletions camerad/astrocam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5821,8 +5821,11 @@ logwrite(function, message.str());

/***** AstroCam::Interface::get_logical *************************************/
/**
* @brief return the class physical coords in logical coords
* @details This is for internal use.
* @brief return the original detector geometry in logical coords
* @details Uses the default (config-specified) detector dimensions and
* overscans so that repeated calls to set_image_size via the
* bin command are idempotent. The current binning is returned
* from the info class.
* @param[in] pcontroller pointer to Controller object
* @param[out] spat reference to spat
* @param[out] spec reference to spec
Expand All @@ -5835,8 +5838,8 @@ logwrite(function, message.str());
void Interface::get_logical(Controller* pcontroller,
int &spat, int &spec, int &osspat, int &osspec, int &binspat, int &binspec) {
if (!pcontroller) return;
pcontroller->physical_to_logical( pcontroller->detrows, pcontroller->detcols, spat, spec );
pcontroller->physical_to_logical( pcontroller->osrows, pcontroller->oscols, osspat, osspec );
pcontroller->physical_to_logical( pcontroller->defrows, pcontroller->defcols, spat, spec );
pcontroller->physical_to_logical( pcontroller->defosrows, pcontroller->defoscols, osspat, osspec );
pcontroller->physical_to_logical( pcontroller->info.binning[_ROW_], pcontroller->info.binning[_COL_],
binspat, binspec );
}
Expand Down
13 changes: 13 additions & 0 deletions common/message_keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace Topic {
inline const std::string TARGETINFO = "tcsd";
inline const std::string SLITD = "slitd";
inline const std::string CAMERAD = "camerad";
inline const std::string SEQ_PROGRESS = "seq_progress";
}

namespace Key {
Expand All @@ -23,4 +24,16 @@ namespace Key {
namespace Camerad {
inline const std::string READY = "ready";
}

namespace SeqProgress {
inline const std::string ONTARGET = "ontarget";
inline const std::string FINE_TUNE_ACTIVE = "fine_tune_active";
inline const std::string OFFSET_ACTIVE = "offset_active";
inline const std::string OFFSET_SETTLE = "offset_settle";
inline const std::string OFFSET_RA = "offset_ra";
inline const std::string OFFSET_DEC = "offset_dec";
inline const std::string OBSID = "obsid";
inline const std::string TARGET_STATE = "target_state";
inline const std::string EVENT = "event";
}
}
39 changes: 39 additions & 0 deletions common/ngps_acq_embed.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* @file ngps_acq_embed.h
* @brief in-process API for NGPS auto-acquire logic
*/

#pragma once

#include <stddef.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct ngps_acq_hooks {
void *user;

int (*tcs_set_native_units)( void *user, int dry_run, int verbose );
int (*tcs_move_arcsec)( void *user, double dra_arcsec, double ddec_arcsec,
int dry_run, int verbose );
int (*scam_putonslit_deg)( void *user,
double slit_ra_deg, double slit_dec_deg,
double cross_ra_deg, double cross_dec_deg,
int dry_run, int verbose );
int (*acam_query_state)( void *user, char *state, size_t state_sz, int verbose );
int (*scam_framegrab_one)( void *user, const char *outpath, int verbose );
int (*scam_set_exptime)( void *user, double exptime_sec, int dry_run, int verbose );
int (*scam_set_avgframes)( void *user, int avgframes, int dry_run, int verbose );
int (*is_stop_requested)( void *user );
void (*log_message)( void *user, const char *line );
} ngps_acq_hooks_t;

void ngps_acq_set_hooks( const ngps_acq_hooks_t *hooks );
void ngps_acq_clear_hooks( void );
void ngps_acq_request_stop( int stop_requested );
int ngps_acq_run_from_argv( int argc, char **argv );

#ifdef __cplusplus
}
#endif
2 changes: 2 additions & 0 deletions common/sequencerd_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#ifndef SEQEUNCERD_COMMANDS_H
#define SEQEUNCERD_COMMANDS_H
const std::string SEQUENCERD_ABORT = "abort";
const std::string SEQUENCERD_ACQMODE = "acqmode";
const std::string SEQUENCERD_CONFIG = "config";
const std::string SEQUENCERD_DOTYPE = "do";
const std::string SEQUENCERD_EXIT = "exit";
Expand Down Expand Up @@ -47,6 +48,7 @@ const std::vector<std::string> SEQUENCERD_SYNTAX = {
SEQUENCERD_TCS+" ...",
"",
SEQUENCERD_ABORT,
SEQUENCERD_ACQMODE+" [ ? | <mode> ]",
SEQUENCERD_CONFIG,
SEQUENCERD_DOTYPE+" [ one | all ]",
SEQUENCERD_EXIT,
Expand Down
2 changes: 2 additions & 0 deletions common/slicecamd_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#pragma once

const std::string SLICECAMD_AVGFRAMES= "avgframes"; ///< set/get camera binning
const std::string SLICECAMD_AUTOACQ = "autoacq"; ///< run/monitor in-process auto-acquire logic
const std::string SLICECAMD_BIN = "bin"; ///< set/get camera binning
const std::string SLICECAMD_CLOSE = "close"; ///< *** close connection to all devices
const std::string SLICECAMD_CONFIG = "config"; ///< reload configuration, apply what can be applied
Expand Down Expand Up @@ -69,6 +70,7 @@ const std::vector<std::string> SLICECAMD_SYNTAX = {
SLICECAMD_SPEED+" [ ? | <hori> <vert> ]",
SLICECAMD_TEMP+" [ ? | <setpoint> ]",
" OTHER:",
SLICECAMD_AUTOACQ+" [ ? | start [--log-file <path>] [<args>] | stop | status ]",
SLICECAMD_PUTONSLIT+" [ ? | <slitra> <slitdec> <crossra> <crossdec> ]",
SLICECAMD_SAVEFRAMES+" [ ? | <nsave> <nskip> ]",
SLICECAMD_SHUTDOWN+" [ ? ]",
Expand Down
10 changes: 10 additions & 0 deletions run/seq-progress
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
#
# Launch the sequencer progress popup GUI
#

SCRIPT_DIR="$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)"
export NGPS_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd)"

CONFIG="${NGPS_ROOT}/Config/sequencerd.cfg"
exec "${NGPS_ROOT}/bin/seq_progress_gui" --config "${CONFIG}" --poll-ms 10000
Loading