Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
75de970
adds Flexure::Compensator class, and starts to add Matt's functions
Jun 13, 2025
b417df5
improves FITS keyword value type detection and allows forcing keyword…
astronomerdave Jul 26, 2025
6d11562
sequencer sends binning commands to camera
astronomerdave Jun 16, 2025
a084d36
Fixes bug in commit 2f2cff0a04131d2861221610ca94d2930731dca9 to addre…
astronomerdave Jun 24, 2025
e9044a9
fixes connection to MySQL database
astronomerdave Jul 15, 2025
f079316
issue-328
astronomerdave Jul 23, 2025
274fee1
updates for RealVNC and xfce
astronomerdave Jul 23, 2025
6522e3d
adds Flexure::Compensator class, and starts to add Matt's functions
Jun 13, 2025
98cd69c
adds more code, C++ versions of Matt's C code
astronomerdave Jul 26, 2025
dcb52f2
small changes
Aug 11, 2025
1c39815
replaces old DSP directory with submodule reference
astronomerdave Oct 24, 2025
56dfddd
more changes, not compiling
astronomerdave Nov 8, 2025
c4d55b7
core calculation functions are complete
astronomerdave Nov 10, 2025
175643a
adds ZMQ Pub-Sub to flexured
astronomerdave Nov 11, 2025
9f56381
receives/parses TCS ZMQ-published telemetry
Nov 11, 2025
3ddd5f7
fixes a bug in compensate_shift_to_delta
astronomerdave Nov 12, 2025
75aef37
Merge branch 'main' into flexure
astronomerdave Nov 12, 2025
c28b7db
cleans up tcs_info
astronomerdave Nov 12, 2025
274c03f
fixes bug (sign error) and adds some test routines
Nov 26, 2025
279b3b7
fixes another sign error and applies correction to nominal position
Dec 2, 2025
85998b4
fix uncaught exception
astronomerdave Mar 6, 2026
3e9c194
adds some verbosity
astronomerdave Mar 6, 2026
5765765
updates polynomial coefficients
astronomerdave Jul 28, 2026
be4593e
Merge remote-tracking branch 'origin/main' into flexure
astronomerdave Jul 28, 2026
d62cfea
uses X,Y,Z for flexure axes
astronomerdave Jul 29, 2026
b2107ac
.
astronomerdave Jul 29, 2026
8e78622
corrects sign error in Flexure::Interface::offset_tiptilt
astronomerdave Jul 29, 2026
3fba4d4
sequencer invokes flexure compensator
astronomerdave Jul 29, 2026
691c798
Merge remote-tracking branch 'origin/main' into flexure
astronomerdave Jul 29, 2026
75bc233
Merge remote-tracking branch 'origin/main' into flexure
astronomerdave Jul 29, 2026
03c8d88
flexure comp command needed channels
astronomerdave Jul 29, 2026
48354c1
bug fix sequencer setting dome lamp
astronomerdave Jul 29, 2026
b2e94ba
sequencer commands domelamps by names instead of numbers
astronomerdave Jul 29, 2026
fd30613
update message constants
astronomerdave Jul 29, 2026
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
34 changes: 29 additions & 5 deletions Config/flexured.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
LOGPATH=/data/logs/ # where to write logs
BLKPORT=@FLEXURED_BLK_PORT@ # slitd server blocking port
NBPORT=@FLEXURED_NB_PORT@ # slitd server non-blocking port
DAEMON=no # run as daemon?
ASYNCPORT=@MESSAGEPORT@ # asynchronous message port
ASYNCGROUP=239.1.1.234 # asynchronous message broadcast group

Expand All @@ -19,6 +18,31 @@ SUB_ENDPOINT="tcp://127.0.0.1:@MESSAGE_BROKER_PUB_PORT@"
#
EMULATOR_PORT=@FLEXURED_EMULATOR@

# COLLIMATOR_POSITION
# <chan> <axis> <a> <b> <c>
#
POSITION_COEFFICIENTS=(U X 20.962529 -0.037965 1.016758)
POSITION_COEFFICIENTS=(U Y 0.110335 19.866173 -0.209023)
POSITION_COEFFICIENTS=(G X 20.092616 0.202743 -0.028325)
POSITION_COEFFICIENTS=(G Y 0.697003 -21.372195 -1.078488)
POSITION_COEFFICIENTS=(R X -19.342549 -0.139683 0.497744)
POSITION_COEFFICIENTS=(R Y 0.173243 20.487537 0.611772)
POSITION_COEFFICIENTS=(I X -21.177322 0.205141 -0.492189)
POSITION_COEFFICIENTS=(I Y -0.049052 -22.605129 0.141980)

# FLEXURE_POLYNOMIALS
# <chan> <axis> < ... > (expected 20 values)
#
FLEXURE_POLYNOMIALS=( I X -0.010050 -0.453673 3.922206 -5.996148 3.412802 0.005490 -3.205597 -0.720826 -0.054873 -0.071945 1.848058 -10.817125 25.420519 -25.960362 9.732404 -0.012039 -0.126167 0.450766 -0.302394 0.000000 )
FLEXURE_POLYNOMIALS=( I Y 0.002736 0.336990 -6.849322 13.060501 -9.703479 0.056297 -1.168824 2.917605 -7.729839 4.986293 2.292288 -2.011299 0.629802 0.000000 0.000000 -0.138345 0.195320 -0.032475 0.000000 0.000000 )
FLEXURE_POLYNOMIALS=( R X -0.009290 -0.538726 0.119516 0.000000 0.000000 0.031857 1.486486 7.743371 -14.374896 9.870450 2.157921 -7.554184 15.041910 -11.824859 2.810760 -0.028081 0.116145 1.275392 -4.032078 2.742630 )
FLEXURE_POLYNOMIALS=( R Y 0.051850 -4.060014 24.799761 -43.279609 27.854001 0.069700 -0.253810 9.387602 -17.881394 11.001366 1.091908 3.470392 -22.509011 39.129797 -21.486402 0.063973 -1.368978 7.417551 -14.718536 9.557388 )
FLEXURE_POLYNOMIALS=( G X 0.029701 1.331934 -8.949185 10.074266 -3.794059 0.111452 -1.386185 7.325222 -4.590153 -0.796477 1.074222 3.459916 -6.013151 3.162186 0.000000 0.115437 -0.885630 0.680245 0.000000 0.000000 )
FLEXURE_POLYNOMIALS=( G Y 0.023484 0.327449 -6.305071 6.915979 -3.185265 0.043076 -0.308662 8.331641 -9.886829 3.006096 4.718045 -27.106506 74.046080 -84.281823 34.303818 0.004524 -1.747392 9.720284 -19.590870 12.067846 )
FLEXURE_POLYNOMIALS=( U X 0.029929 -2.366930 2.843202 0.000000 0.000000 0.021643 0.446831 11.575399 -13.130549 5.162279 0.712767 -0.519063 0.220622 0.000000 0.000000 0.017301 2.682137 -10.738551 15.776922 -7.607582 )
FLEXURE_POLYNOMIALS=( U Y 0.003026 -0.103969 3.620296 -6.585365 4.795205 0.010984 -3.756635 0.463073 -0.858354 0.000000 0.977025 -11.541444 30.074095 -32.763652 12.876655 -0.020034 0.126004 0.000000 0.000000 0.000000 )


# For each actuator's controller specify:
# MOTOR_CONTROLLER="<name> <host> <port> <addr> <axes>"
# <name> name of controller
Expand All @@ -42,12 +66,12 @@ MOTOR_CONTROLLER="I @IP_FLEXURE_I@ 50000 1 3"
# 3 = Y = spatial
#
MOTOR_AXIS="U 1 25 225 0 na 100.0"
MOTOR_AXIS="U 2 -1000 1000 0 na 0.0"
MOTOR_AXIS="U 3 -1000 1000 0 na 0.0"
MOTOR_AXIS="U 2 -1000 1000 0 na 0.0"
MOTOR_AXIS="U 3 -1000 1000 0 na 0.0"

MOTOR_AXIS="G 1 25 225 0 na 100.0"
MOTOR_AXIS="G 2 -1000 1000 0 na 0.0"
MOTOR_AXIS="G 3 -1000 1000 0 na 0.0"
MOTOR_AXIS="G 2 -1000 1000 0 na 0.0"
MOTOR_AXIS="G 3 -1000 1000 0 na 0.0"

MOTOR_AXIS="R 1 25 225 0 na 100.0"
MOTOR_AXIS="R 2 -1000 1000 0 na 0.0"
Expand Down
14 changes: 7 additions & 7 deletions acamd/acam_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1621,17 +1621,17 @@ namespace Acam {

// extract and store values in the class
//
Common::extract_telemetry_value( jmessage, "TCSNAME", tcsdata.tcsname );
Common::extract_telemetry_value( jmessage, "ISOPEN", tcsdata.is_tcs_open );
Common::extract_telemetry_value( jmessage, Key::Tcsd::TCSNAME, tcsdata.tcsname );
Common::extract_telemetry_value( jmessage, Key::Tcsd::ISOPEN, tcsdata.is_tcs_open );
Common::extract_telemetry_value( jmessage, Key::Tcsd::CASANGLE, tcsdata.angle_scope );
Common::extract_telemetry_value( jmessage, Key::Tcsd::TELRA, tcsdata.ra_scope_hms );
Common::extract_telemetry_value( jmessage, Key::Tcsd::TELDEC, tcsdata.dec_scope_dms );
Common::extract_telemetry_value( jmessage, "RA", tcsdata.ra_scope_h );
Common::extract_telemetry_value( jmessage, "DEC", tcsdata.dec_scope_d );
Common::extract_telemetry_value( jmessage, "RAOFFSET", tcsdata.offsetra );
Common::extract_telemetry_value( jmessage, "DECLOFFS", tcsdata.offsetdec );
Common::extract_telemetry_value( jmessage, Key::Tcsd::TELRA_H, tcsdata.ra_scope_h );
Common::extract_telemetry_value( jmessage, Key::Tcsd::TELDEC_D, tcsdata.dec_scope_d );
Common::extract_telemetry_value( jmessage, Key::Tcsd::RAOFFSET, tcsdata.offsetra );
Common::extract_telemetry_value( jmessage, Key::Tcsd::DECLOFFS, tcsdata.offsetdec );
Common::extract_telemetry_value( jmessage, Key::Tcsd::AZ, tcsdata.az );
Common::extract_telemetry_value( jmessage, "TELFOCUS", tcsdata.telfocus );
Common::extract_telemetry_value( jmessage, Key::Tcsd::TELFOCUS, tcsdata.telfocus );
Common::extract_telemetry_value( jmessage, Key::Tcsd::AIRMASS, tcsdata.airmass );

// save them to the database
Expand Down
4 changes: 4 additions & 0 deletions camerad/astrocam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2805,6 +2805,10 @@ namespace AstroCam {

Common::Header telem;

// Helper function adds all keys from a table.
// The tables are defined in fits_header_defs.h and contain extension
// channel name (as appropriate), keyword, value, comment, and type.
//
auto add = [&]( const std::string &topic, const auto &keytable ) {
auto it = this->live_telemetry.find( topic );
if ( it != this->live_telemetry.end() ) add_cached_telem( telem, it->second, keytable );
Expand Down
9 changes: 9 additions & 0 deletions common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

#pragma once

#include <cstddef>
#include <climits>
#include <cstddef>
#include <sstream>
#include <queue>
#include <string>
Expand Down Expand Up @@ -233,6 +235,13 @@ namespace Common {
iface.subscriber_topics.push_back(topic);
}

// check subscriber initialization (this would be a programming error)
//
if (!iface.subscriber) {
logwrite(function, "ERROR subscriber object is not initialized");
return ERROR;
}

try {
// connect to the message broker and wait for connection to establish
//
Expand Down
27 changes: 15 additions & 12 deletions common/fits_header_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ namespace FitsHeaderKeys {
};

const Extension FlexureInfoKeys[] = {
{ "I", Key::Flexured::FLXSPE_I.c_str(), "FLXSPE", "I flexure spectral axis 2 (X) in um", "" },
{ "I", Key::Flexured::FLXSPA_I.c_str(), "FLXSPA", "I flexure spatial axis 3 (Y) in um", "" },
{ "I", Key::Flexured::FLXPIS_I.c_str(), "FLXPIS", "I flexure piston axis 1 (Z) in um", "" },
{ "R", Key::Flexured::FLXSPE_R.c_str(), "FLXSPE", "R flexure spectral axis 2 (X) in um", "" },
{ "R", Key::Flexured::FLXSPA_R.c_str(), "FLXSPA", "R flexure spatial axis 3 (Y) in um", "" },
{ "R", Key::Flexured::FLXPIS_R.c_str(), "FLXPIS", "R flexure piston axis 1 (Z) in um", "" },
{ "G", Key::Flexured::FLXSPE_G.c_str(), "FLXSPE", "G flexure spectral axis 2 (X) in um", "" },
{ "G", Key::Flexured::FLXSPA_G.c_str(), "FLXSPA", "G flexure spatial axis 3 (Y) in um", "" },
{ "G", Key::Flexured::FLXPIS_G.c_str(), "FLXPIS", "G flexure piston axis 1 (Z) in um", "" },
{ "U", Key::Flexured::FLXSPE_U.c_str(), "FLXSPE", "U flexure spectral axis 2 (X) in um", "" },
{ "U", Key::Flexured::FLXSPA_U.c_str(), "FLXSPA", "U flexure spatial axis 3 (Y) in um", "" },
{ "U", Key::Flexured::FLXPIS_U.c_str(), "FLXPIS", "U flexure piston axis 1 (Z) in um", "" }
{ "I", Key::Flexured::FLEX_X_I.c_str(), "FLEX_X", "I flexure axis 2 (X) in um", "" },
{ "I", Key::Flexured::FLEX_Y_I.c_str(), "FLEX_Y", "I flexure axis 3 (Y) in um", "" },
{ "I", Key::Flexured::FLEX_Z_I.c_str(), "FLEX_Z", "I flexure axis 1 (Z) in um", "" },
{ "R", Key::Flexured::FLEX_X_R.c_str(), "FLEX_X", "R flexure axis 2 (X) in um", "" },
{ "R", Key::Flexured::FLEX_Y_R.c_str(), "FLEX_Y", "R flexure axis 3 (Y) in um", "" },
{ "R", Key::Flexured::FLEX_Z_R.c_str(), "FLEX_Z", "R flexure axis 1 (Z) in um", "" },
{ "G", Key::Flexured::FLEX_X_G.c_str(), "FLEX_X", "G flexure axis 2 (X) in um", "" },
{ "G", Key::Flexured::FLEX_Y_G.c_str(), "FLEX_Y", "G flexure axis 3 (Y) in um", "" },
{ "G", Key::Flexured::FLEX_Z_G.c_str(), "FLEX_Z", "G flexure axis 1 (Z) in um", "" },
{ "U", Key::Flexured::FLEX_X_U.c_str(), "FLEX_X", "U flexure axis 2 (X) in um", "" },
{ "U", Key::Flexured::FLEX_Y_U.c_str(), "FLEX_Y", "U flexure axis 3 (Y) in um", "" },
{ "U", Key::Flexured::FLEX_Z_U.c_str(), "FLEX_Z", "U flexure axis 1 (Z) in um", "" }
};

const Extension FocusInfoKeys[] = {
Expand Down Expand Up @@ -92,12 +92,15 @@ namespace FitsHeaderKeys {
};

const Primary TcsInfoKeys[] = {
{ Key::Tcsd::PA.c_str(), "", "position angle in deg" },
{ Key::Tcsd::CASANGLE.c_str(), "", "TCS reported Cassegrain angle in deg", "FLOAT" },
{ Key::Tcsd::HA.c_str(), "", "hour angle" },
{ Key::Tcsd::RAOFFSET.c_str(), "", "offset Right Ascension" },
{ Key::Tcsd::DECLOFFS.c_str(), "", "offset Declination" },
{ Key::Tcsd::TELRA.c_str(), "", "TCS reported Right Ascension" },
{ Key::Tcsd::TELDEC.c_str(), "", "TCS reported Declination" },
{ Key::Tcsd::TELRA_H.c_str(), "", "TCS reported RA in decimal hours", "DOUBLE" },
{ Key::Tcsd::TELDEC_D.c_str(), "", "TCS reported DEC in decimal deg", "DOUBLE" },
{ Key::Tcsd::AZ.c_str(), "", "TCS reported azimuth" },
{ Key::Tcsd::ZENANGLE.c_str(), "", "TCS reported Zenith angle", "FLOAT" },
{ Key::Tcsd::DOMEAZ.c_str(), "", "TCS reported dome azimuth", "FLOAT" },
Expand Down
33 changes: 21 additions & 12 deletions common/message_keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,17 @@ namespace Key {
namespace Tcsd {
inline const std::string TELRA = "TELRA";
inline const std::string TELDEC = "TELDEC";
inline const std::string TELRA_H = "TELRA_H";
inline const std::string TELDEC_D = "TELDEC_D";
inline const std::string ALT = "ALT";
inline const std::string AZ = "AZ";
inline const std::string AIRMASS = "AIRMASS";
inline const std::string CASANGLE = "CASANGLE";
inline const std::string MOTION = "MOTION";
inline const std::string ISOPEN = "ISOPEN";
inline const std::string TCSNAME = "TCSNAME";
inline const std::string HA = "HA";
inline const std::string PA = "PA";
inline const std::string RAOFFSET = "RAOFFSET";
inline const std::string DECLOFFS = "DECLOFFS";
inline const std::string ZENANGLE = "ZENANGLE";
Expand All @@ -151,18 +156,22 @@ namespace Key {
}

namespace Flexured {
inline const std::string FLXSPE_I = "FLXSPE_I";
inline const std::string FLXSPA_I = "FLXSPA_I";
inline const std::string FLXPIS_I = "FLXPIS_I";
inline const std::string FLXSPE_R = "FLXSPE_R";
inline const std::string FLXSPA_R = "FLXSPA_R";
inline const std::string FLXPIS_R = "FLXPIS_R";
inline const std::string FLXSPE_G = "FLXSPE_G";
inline const std::string FLXSPA_G = "FLXSPA_G";
inline const std::string FLXPIS_G = "FLXPIS_G";
inline const std::string FLXSPE_U = "FLXSPE_U";
inline const std::string FLXSPA_U = "FLXSPA_U";
inline const std::string FLXPIS_U = "FLXPIS_U";
inline const std::string AxisX = "FLEX_X_";
inline const std::string AxisY = "FLEX_Y_";
inline const std::string AxisZ = "FLEX_Z_";

inline const std::string FLEX_X_U = "FLEX_X_U";
inline const std::string FLEX_Y_U = "FLEX_Y_U";
inline const std::string FLEX_Z_U = "FLEX_Z_U";
inline const std::string FLEX_X_G = "FLEX_X_G";
inline const std::string FLEX_Y_G = "FLEX_Y_G";
inline const std::string FLEX_Z_G = "FLEX_Z_G";
inline const std::string FLEX_X_R = "FLEX_X_R";
inline const std::string FLEX_Y_R = "FLEX_Y_R";
inline const std::string FLEX_Z_R = "FLEX_Z_R";
inline const std::string FLEX_X_I = "FLEX_X_I";
inline const std::string FLEX_Y_I = "FLEX_Y_I";
inline const std::string FLEX_Z_I = "FLEX_Z_I";
}

namespace Focusd {
Expand Down
2 changes: 1 addition & 1 deletion common/tcs_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ inline static const char TCS_LAMPNAME_ULTRA[] = "ULTRA"; const int TCS_LAMPNUM_U
inline static const char TCS_SUCCESS_STR[] = "success";
inline static const char TCS_UNRECOGNIZED_COMMAND_STR[] = "tcs_unrecognized_command";
inline static const char TCS_INVALID_PARAMETER_STR[] = "tcs_bad_param";
inline static const char TCS_UNABLE_TO_EXECUTE_STR[] = "tcs_already_moving";
inline static const char TCS_UNABLE_TO_EXECUTE_STR[] = "tcs_unable_to_execute";
inline static const char TCS_HOST_UNAVAILABLE_STR[] = "tcs_unavailable";
inline static const char TCS_UNDEFINED_STR[] = "tcs_undefined";

Expand Down
10 changes: 10 additions & 0 deletions flexured/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# @author David Hale <dhale@caltech.edu>
# ----------------------------------------------------------------------------

# add_compile_options( -O0 -g -march=native -DNDEBUG)

cmake_minimum_required( VERSION 3.12 )

set( FLEXURED_DIR ${PROJECT_BASE_DIR}/flexured )
Expand All @@ -16,10 +18,16 @@ include_directories( ${PROJECT_BASE_DIR}/common )

link_directories( ${PROJECT_BASE_DIR}/lib )

# ZeroMQ
#
find_library( ZMQPP_LIB zmqpp NAMES libzmqpp PATHS /usr/local/lib )
find_library( ZMQ_LIB zmq NAMES libzmq PATHS /usr/local/lib )

add_executable(flexured
${FLEXURED_DIR}/flexured.cpp
${FLEXURED_DIR}/flexure_server.cpp
${FLEXURED_DIR}/flexure_interface.cpp
${FLEXURED_DIR}/flexure_compensator.cpp
)

target_link_libraries(flexured
Expand All @@ -29,6 +37,8 @@ target_link_libraries(flexured
logentry
utilities
${CMAKE_THREAD_LIBS_INIT}
${ZMQPP_LIB}
${ZMQ_LIB}
)

# -- Port Definitions ----------------------------------------------------------
Expand Down
Loading
Loading