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
9 changes: 3 additions & 6 deletions Config/acamd.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,11 @@ ACQUIRE_TCS_MAX_OFFSET=60 # the maximum allowable offset sent to the TCS, in
SKYSIM_IMAGE_SIZE=1024

# -----------------------------------------------------------------------------
# TELEM_PROVIDER=( <name> <port> )
# SUBSCRIBE_TO=( <name> <endpoint> )
#
# This is a list of telemetry providers where <name> is the daemon name,
# and <port> is the port on which to send the telemetry request.
# This is a list of pub/sub sources to subscribe to, where <name> is the daemon
# name and <endpoint> is its ZeroMQ publish endpoint.
# Provide one per line.
#
TELEM_PROVIDER=(tcsd @TCSD_NB_PORT@)
TELEM_PROVIDER=(sequencerd @SEQUENCERD_NB_PORT@)
#
SUBSCRIBE_TO=(tcsd "tcp://127.0.0.1:@TCSD_PUB_PORT@")
SUBSCRIBE_TO=(sequencerd "tcp://127.0.0.1:@SEQUENCERD_PUB_PORT@")
19 changes: 5 additions & 14 deletions Config/camerad.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,11 @@ ACTIVATE_COMMANDS=(G PON, ERS 1000 1000, EPG 500, CLR)
ACTIVATE_COMMANDS=(U PON, CLR)

# -----------------------------------------------------------------------------
# TELEM_PROVIDER=( <name> <port> )
#
# This is a list of telemetry providers where <name> is the daemon name,
# and <port> is the port on which to send the telemetry request. These are the
# sources for telemetry information for FITS headers. Provide one per line.
#
TELEM_PROVIDER=(calibd @CALIBD_NB_PORT@)
TELEM_PROVIDER=(flexured @FLEXURED_NB_PORT@)
TELEM_PROVIDER=(focusd @FOCUSD_NB_PORT@)
TELEM_PROVIDER=(powerd @POWERD_NB_PORT@)
TELEM_PROVIDER=(sequencerd @SEQUENCERD_NB_PORT@)
TELEM_PROVIDER=(slitd @SLITD_NB_PORT@)
TELEM_PROVIDER=(tcsd @TCSD_NB_PORT@)
TELEM_PROVIDER=(thermald @THERMALD_NB_PORT@)
# SUBSCRIBE_TO=( <name> <endpoint> )
#
# This is a list of pub/sub sources to subscribe to, where <name> is the daemon
# name and <endpoint> is its ZeroMQ publish endpoint. These are the sources for
# telemetry information for FITS headers. Provide one per line.
#
SUBSCRIBE_TO=(calibd "tcp://127.0.0.1:@CALIBD_PUB_PORT@")
SUBSCRIBE_TO=(flexured "tcp://127.0.0.1:@FLEXURED_PUB_PORT@")
Expand Down
9 changes: 3 additions & 6 deletions Config/flexured.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,11 @@ MOTOR_AXIS="I 3 -1000 1000 0 na 300.0"
#

# -----------------------------------------------------------------------------
# TELEM_PROVIDER=( <name> <port> )
# SUBSCRIBE_TO=( <name> <endpoint> )
#
# This is a list of telemetry providers where <name> is the daemon name,
# and <port> is the port on which to send the telemetry request.
# This is a list of pub/sub sources to subscribe to, where <name> is the daemon
# name and <endpoint> is its ZeroMQ publish endpoint.
# Provide one per line.
#
TELEM_PROVIDER=(tcsd @TCSD_NB_PORT@)
TELEM_PROVIDER=(thermald @THERMALD_NB_PORT@)
#
SUBSCRIBE_TO=(tcsd "tcp://127.0.0.1:@TCSD_PUB_PORT@")
SUBSCRIBE_TO=(thermald "tcp://127.0.0.1:@THERMALD_PUB_PORT@")
33 changes: 17 additions & 16 deletions Config/sequencerd.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ CAMERA_EPILOGUE=(close)
# slit init and shutdown states
# formatted as (width offset)
#
SLIT__INIT=(0.5 3.0)
SLIT__INIT=(0.4 3.0)
SLIT__SHUTDOWN=

# ACAM init and shutdown states
Expand All @@ -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 @@ -162,29 +162,30 @@ ACQUIRE_MIN_REPEAT=2 # minimum number of sequential successful a
ACQUIRE_TCS_MAX_OFFSET=60 # the maximum allowable offset sent to the TCS, in arcsec

# Calibration Settings
# CAL_TARGET=(name caldoor calcover U G R I lampthar lampfear lampbluc lampredc lolamp hilamp mod1 mod2 ... mod6)
# CAL_TARGET=(name caldoor calcover U G R I lampthar lampfear lampbluc lampredc lolamp hilamp mod1 mod2 ... mod6 imgtype)
#
# where name must be "DEFAULT" or start with "CAL_"
# caldoor = open | close
# calcover = open | close
# U,G,R,I = on | off # indicates which channels to enable/disable
# lamp* = on | off # lamp power
# mod* = on | off # lamp modulator
# for a total of 19 required parameters
# imgtype = <imgtype> # FITS IMGTYPE keyword
# for a total of 20 required parameters
# name=SCIENCE defines science target operation
#
# name door cover U G R I thar fear bluc redc llmp hlmp mod1 mod2 mod3 mod4 mod5 mod6
CAL_TARGET=(CAL_THAR open close on on on on on on on on off off off off off off off on )
CAL_TARGET=(CAL_FEAR open close on on on on on on on on off off on off off off off off)
CAL_TARGET=(CAL_THAR_UG open close on on off off on on on on off off off off off off off on )
CAL_TARGET=(CAL_FEAR_UG open close on on off off on on on on off off on off off off off off)
CAL_TARGET=(CAL_CONTR open close on on on on on on on on off off off off off on off off)
CAL_TARGET=(CAL_CONTB open close on on on on on on on on off off off off off off on off)
CAL_TARGET=(CAL_DOME close open on on on on off off off off off on off off off off off off)
CAL_TARGET=(CAL_DOME_UG close open on on off off off off off off off on off off off off off off)
CAL_TARGET=(CAL_BIAS close close on on on on off off off off off off off off off off off off)
CAL_TARGET=(CAL_DARK close close on on on on off off off off off off off off off off off off)
CAL_TARGET=(SCIENCE close open on on on on off off off off off off off off off off off off)
# name door cover U G R I thar fear bluc redc llmp hlmp mod1 mod2 mod3 mod4 mod5 mod6 imgtype
CAL_TARGET=(CAL_THAR open close on on on on on on on on off off off off off off off on THAR )
CAL_TARGET=(CAL_FEAR open close on on on on on on on on off off on off off off off off FEAR )
CAL_TARGET=(CAL_THAR_UG open close on on off off on on on on off off off off off off off on THAR )
CAL_TARGET=(CAL_FEAR_UG open close on on off off on on on on off off on off off off off off FEAR )
CAL_TARGET=(CAL_CONTR open close on on on on on on on on off off off off off on off off CONT )
CAL_TARGET=(CAL_CONTB open close on on on on on on on on off off off off off off on off CONT )
CAL_TARGET=(CAL_DOME close open on on on on off off off off off on off off off off off off DOMEFLAT)
CAL_TARGET=(CAL_DOME_UG close open on on off off off off off off off on off off off off off off DOMEFLAT)
CAL_TARGET=(CAL_BIAS close close on on on on off off off off off off off off off off off off BIAS )
CAL_TARGET=(CAL_DARK close close on on on on off off off off off off off off off off off off DARK )
CAL_TARGET=(SCIENCE close open on on on on off off off off off off off off off off off off SCI )

# miscellaneous
#
Expand Down
9 changes: 3 additions & 6 deletions Config/thermald.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,12 @@ CAMP_CHAN="22 TFLEXCON_UR"
CAMP_CHAN="23 TACAM"

# -----------------------------------------------------------------------------
# TELEM_PROVIDER=( <name> <port> )
# SUBSCRIBE_TO=( <name> <endpoint> )
#
# This is a list of telemetry providers where <name> is the daemon name,
# and <port> is the port on which to send the telemetry request.
# This is a list of pub/sub sources to subscribe to, where <name> is the daemon
# name and <endpoint> is its ZeroMQ publish endpoint.
# Provide one per line.
#
TELEM_PROVIDER=(acamd @ACAMD_NB_PORT@)
TELEM_PROVIDER=(slicecamd @SLICECAMD_NB_PORT@)
#
SUBSCRIBE_TO=(acamd "tcp://127.0.0.1:@ACAMD_PUB_PORT@")
SUBSCRIBE_TO=(slicecamd "tcp://127.0.0.1:@SLICECAMD_PUB_PORT@")

38 changes: 32 additions & 6 deletions acamd/acam_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ namespace Acam {
"not_connected" );

try {
this->publisher->publish( jmessage_out, Topic::SNAPSHOT );
this->publisher->publish( jmessage_out, Topic::ACAMD );
}
catch ( const std::exception &e ) {
logwrite( "Acam::Interface::publish_snapshot",
Expand Down Expand Up @@ -1507,6 +1507,32 @@ namespace Acam {
/***** Acam::Interface::publish_status **************************************/


/***** Acam::Interface::publish_temperature ********************************/
/**
* @brief publish only the andor CCD temperature on Topic::ACAMD
* @details Published on a fixed interval (see acamd.cpp), not on change,
* since the CCD temperature varies continuously.
*
*/
void Interface::publish_temperature() {
int ccdtemp=99;
this->camera.andor.get_temperature( ccdtemp ); // temp is int
nlohmann::json jmessage;
jmessage[Key::SOURCE] = Topic::ACAMD;
jmessage[Key::Acamd::TANDOR] = ( this->isopen("camera") ?
static_cast<float>(ccdtemp) : // database wants float
NAN );
try {
this->publisher->publish( jmessage, Topic::ACAMD );
}
catch ( const std::exception &e ) {
logwrite( "Acam::Interface::publish_temperature",
"ERROR publishing message: "+std::string(e.what()) );
}
}
/***** Acam::Interface::publish_temperature ********************************/


/***** Acam::Interface::request_snapshot ************************************/
/**
* @brief [obsolete] publises request for snapshot
Expand Down Expand Up @@ -1639,11 +1665,11 @@ namespace Acam {
*
*/
void Interface::handletopic_targetinfo( const nlohmann::json &jmessage ) {
this->database.add_from_json<int>( jmessage, "OBS_ID" );
this->database.add_from_json<std::string>( jmessage, "NAME" );
this->database.add_from_json<std::string>( jmessage, "POINTMODE" );
this->database.add_from_json<std::string>( jmessage, "RA" );
this->database.add_from_json<std::string>( jmessage, "DECL" );
this->database.add_from_json<int>( jmessage, Key::TargetInfo::OBS_ID );
this->database.add_from_json<std::string>( jmessage, Key::TargetInfo::NAME );
this->database.add_from_json<std::string>( jmessage, Key::TargetInfo::POINTMODE );
this->database.add_from_json<std::string>( jmessage, Key::TargetInfo::RA );
this->database.add_from_json<std::string>( jmessage, Key::TargetInfo::DECL );
}
/***** Acam::Interface::handletopic_targetinfo ******************************/

Expand Down
4 changes: 1 addition & 3 deletions acamd/acam_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,6 @@ namespace Acam {

std::vector<std::string> db_info; ///< info for constructing telemetry Database object

std::map<std::string, int> telemetry_providers; ///< map of port[daemon_name] for external telemetry providers

struct {
std::string tcsname;
bool is_tcs_open;
Expand Down Expand Up @@ -664,9 +662,9 @@ namespace Acam {
long bin( std::string args, std::string &retstring );
void publish_snapshot();
void publish_status(bool force=false);
void publish_temperature(); ///< publish only the andor temperature on Topic::ACAMD (periodic)
void request_snapshot();
bool wait_for_snapshots();
long handle_json_message( std::string message_in );
long initialize_python_objects(); /// provides interface to initialize all Python modules for objects in this class
long test_image(); ///
long open( std::string args, std::string &help); /// wrapper to open all acam-related hardware components
Expand Down
24 changes: 0 additions & 24 deletions acamd/acam_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,30 +365,6 @@ namespace Acam {
applied++;
}

// TELEM_PROVIDER : contains daemon name and port to contact for header telemetry info
// (these don't get counted with "applied++")
//
if ( config.param[entry] == "TELEM_PROVIDER" ) {
std::vector<std::string> tokens;
Tokenize( config.arg[entry], tokens, " " );
try {
if ( tokens.size() == 2 ) {
this->interface.telemetry_providers[tokens.at(0)] = std::stod(tokens.at(1));
}
else {
message.str(""); message << "ERROR bad format TELEM_PROVIDER=\"" << config.arg[entry] << "\": expected <name> <port>";
logwrite( function, message.str() );
return ERROR;
}
}
catch ( const std::exception &e ) {
message.str(""); message << "ERROR parsing TELEM_PROVIDER from " << config.arg[entry] << ": " << e.what();
logwrite( function, message.str() );
return ERROR;
}
message.str(""); message << "config:" << config.param[entry] << "=" << config.arg[entry];
this->interface.async.enqueue_and_log( to_uppercase(DAEMON_NAME), function, message.str() );
}

} // end loop through the entries in the configuration file

Expand Down
13 changes: 13 additions & 0 deletions acamd/acamd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,19 @@ int main(int argc, char **argv) {
// publish snapshot of my telemetry so the world knows I'm online
acamd.interface.publish_snapshot();

std::this_thread::sleep_for( std::chrono::milliseconds(250) );
acamd.interface.request_snapshot();

// publish the andor CCD temperature on a fixed 60-second interval
// (temperature varies continuously, so it is not published on change)
//
std::thread( []( Acam::Interface &iface ) {
while ( true ) {
iface.publish_temperature();
std::this_thread::sleep_for( std::chrono::seconds(60) );
}
}, std::ref(acamd.interface) ).detach();

// This will pre-thread N_THREADS threads.
// There will be N_THREADS-1 non-blocking threads, then
// loop forever on Accept to dynamically spawn a new thread for each
Expand Down
Loading
Loading