From ba54907d1b7a1fe3a0b57f5ae430fa0695576a18 Mon Sep 17 00:00:00 2001 From: Ian Lowe Date: Mon, 6 Jul 2026 15:58:35 -0600 Subject: [PATCH 1/3] test removal of vestigial code in video transmitter --- mcp/tx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mcp/tx.c b/mcp/tx.c index 981b5cd2a..fc0648ad2 100644 --- a/mcp/tx.c +++ b/mcp/tx.c @@ -63,7 +63,6 @@ extern int16_t InCharge; /* in auxiliary.c */ void ChargeController(void); void ControlAuxMotors(); -void VideoTx(void); /* in das.c */ void BiasControl(); From 9e22948340dd8a9dd9728e056f21ff7a1eb9a5e6 Mon Sep 17 00:00:00 2001 From: Ian Lowe Date: Wed, 15 Jul 2026 10:21:46 -0600 Subject: [PATCH 2/3] initial round of XSC trimming, compiles but may not run --- blast_config/command_list.c | 329 +-------- blast_config/include/command_list.h | 55 +- legacyMCP/commands | 669 ++++++++++++++++++ {mcp => legacyMCP}/housekeeping/auxiliary.c | 0 .../includes}/xsc_network.h | 0 .../includes}/xsc_pointing.h | 0 {mcp/include => legacyMCP/includes}/xystage.h | 0 {mcp => legacyMCP}/motors/xystage.c | 0 legacyMCP/pointing/acs.c | 0 legacyMCP/pointing/pointing.c | 85 +++ .../pointing}/xsc_network.c | 0 {mcp => legacyMCP}/pointing/xsc_pointing.c | 0 mcp/commanding/commands.c | 542 +------------- mcp/housekeeping/CMakeLists.txt | 1 - mcp/mcp.c | 30 - mcp/motors/CMakeLists.txt | 1 - mcp/motors/motors.c | 12 +- mcp/pointing/CMakeLists.txt | 1 - mcp/pointing/pointing.c | 125 +--- mcp/sensors/CMakeLists.txt | 2 - mcp/sensors/acs.c | 309 -------- mcp/sensors/socket_utils.c | 2 +- mcp/tx.c | 2 - 23 files changed, 776 insertions(+), 1389 deletions(-) create mode 100644 legacyMCP/commands rename {mcp => legacyMCP}/housekeeping/auxiliary.c (100%) rename {mcp/include => legacyMCP/includes}/xsc_network.h (100%) rename {mcp/include => legacyMCP/includes}/xsc_pointing.h (100%) rename {mcp/include => legacyMCP/includes}/xystage.h (100%) rename {mcp => legacyMCP}/motors/xystage.c (100%) create mode 100644 legacyMCP/pointing/acs.c create mode 100644 legacyMCP/pointing/pointing.c rename {mcp/sensors => legacyMCP/pointing}/xsc_network.c (100%) rename {mcp => legacyMCP}/pointing/xsc_pointing.c (100%) diff --git a/blast_config/command_list.c b/blast_config/command_list.c index e5bb48800..0a96ec891 100644 --- a/blast_config/command_list.c +++ b/blast_config/command_list.c @@ -261,11 +261,6 @@ struct scom scommands[xyzzy + 1] = { {COMMAND(disallow_hw_wd), "Setting the HW watchdog to be ignored", GR_MISC | CONFIRM}, {COMMAND(allow_hw_wd), "Setting the HW watchdog to be listened to", GR_MISC | CONFIRM}, {COMMAND(take_incharge), "Setting InCharge to 1 and taking control", GR_MISC | CONFIRM}, - // Video transmitters - {COMMAND(vtx_xsc0), "Setting video transmitter to XSC0", GR_XSC_MODE | GR_TELEM}, - {COMMAND(vtx_xsc1), "Setting video transmitter to XSC1", GR_XSC_MODE | GR_TELEM}, - // XY stage - {COMMAND(xy_panic), "stop XY stage motors immediately", GR_MISC}, // BLAST(TIM) Misc {COMMAND(reap_fc1), "ask MCP to reap the fc1 watchdog tickle", GR_MISC | CONFIRM}, {COMMAND(reap_fc2), "ask MCP to reap the fc2 watchdog tickle", GR_MISC | CONFIRM}, @@ -1265,293 +1260,13 @@ struct mcom mcommands[plugh + 2] = { }, /* STAR CAMERAS */ - {COMMAND(xsc_is_new_window_period), "Set the time for which commands are valid (centi-seconds)", GR_XSC_PARAM, 2, - { - {"Which", 0, 2, 'i', "NONE"}, - {"Window period", 0, 2000, 'i', "NONE"}, - } - }, - {COMMAND(xsc_offset), "Trim the star camera", GR_XSC_PARAM|GR_TRIM, 3, + {COMMAND(sc_offset), "Trim the star camera", GR_XSC_PARAM|GR_TRIM, 3, { {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, {"Cross-El trim", -180, 180, 'd', "NONE"}, {"El trim", -180, 180, 'd', "NONE"}, } }, - {COMMAND(xsc_heaters_off), "Turn off the XSC heater", GR_XSC_HOUSE, 1, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - } - }, - {COMMAND(xsc_heaters_on), "Turn on the XSC heater", GR_XSC_HOUSE, 1, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - } - }, - {COMMAND(xsc_heaters_auto), "Allow XSC to control its heater", GR_XSC_HOUSE, 1, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - } - }, - {COMMAND(xsc_exposure_timing), "xsc exposure time", GR_XSC_PARAM, 4, - { - {"which", 0, 2, 'i', "NONE"}, - {"exposure time_cs (cs) [default: 12]", 1, 100, 'l', "NONE"}, - {"grace period (s) (disregards which) [default: 45.0]", 1.0, 100.0, 'f', "NONE"}, - {"post trigger counter_mcp share delay (cs) (disregards which) [default: 200]", 1, 1000, 'l', "NONE"}, - }, - }, - {COMMAND(xsc_multi_trigger), "xsc trigger timing", GR_XSC_PARAM, 3, - { - {"num triggers [default: 1]", 0, 16, 'i', "NONE"}, - {"time between triggers (cs) [default: 19]", 1, 100, 'l', "NONE"}, - {"stars readout delay (s) [default: 1.0]", 0.1, 10.0, 'f', "NONE"}, - }, - }, - {COMMAND(xsc_trigger_threshold), "Allow XSC to trigger based on predicted px streaking", GR_XSC_PARAM, 3, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Enabled", 0, 1, 'i', "NONE"}, - {"Blob streaking limit (pixels", 0, 100, 'f', "NONE"}, - } - }, - {COMMAND(xsc_scan_force_trigger), "Force XSC to trigger on turnaround (ignore speed)", GR_XSC_PARAM, 2, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Force the trigger on scan limits", 0, 1, 'i', "NONE"}, - } - }, - {COMMAND(xsc_quit), "Quit XSC", GR_XSC_HOUSE|CONFIRM, 1, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - } - }, - {COMMAND(xsc_shutdown), "Shutdown the XSC computer", GR_XSC_HOUSE|CONFIRM, 2, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Restart?", 0, 1, 'i', "NONE"} - } - }, - {COMMAND(xsc_main_settings), "xsc main settings", GR_XSC_PARAM, 6, - { - {"which", 0, 2, 'i', "NONE"}, - {"display_frequency [default: 20.0]", 1.0, 30.0, 'f', "NONE"}, - {"display_fullscreen [default: 1]", 0, 1, 'i', "NONE"}, - {"display_image_only [default: 0]", 0, 1, 'i', "NONE"}, - {"display_solving_filters [default: 0]]", 0, 1, 'i', "NONE"}, - {"display_image_brightness [default: 1.0]", 0.5, 4.0, 'f', "NONE"}, - }, - }, - {COMMAND(xsc_display_zoom), "xsc display zoom", GR_XSC_PARAM, 4, - { - {"which", 0, 2, 'i', "NONE"}, - {"center x display pixel [default: 320]", 0, 1000, 'i', "NONE"}, - {"center y display pixel [default: 240]", 0, 1000, 'i', "NONE"}, - {"zoom [default: 1.0]", 1.0, 4.0, 'f', "NONE"}, - }, - }, - {COMMAND(xsc_image_client), "Enable or disable sending images to mcp", GR_XSC_MODE, 2, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Image client enabled", 0, 1, 'i', "NONE"}, - } - }, - {COMMAND(xsc_init_focus), "Initialize the focus motor", GR_XSC_MODE, 1, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - } - }, - {COMMAND(xsc_get_focus), "Get the absolute focus position", GR_XSC_MODE, 1, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - } - }, - {COMMAND(xsc_set_focus), "Set the absolute focus position", GR_XSC_MODE, 2, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Absolute focus position", 0, 5000, 'i', "NONE"}, - } - }, - {COMMAND(xsc_stop_focus), "Stop all motion on the focus actuator", GR_XSC_MODE, 1, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - } - }, - {COMMAND(xsc_define_focus), "Define the value of the focus at the current position", GR_XSC_MODE, 2, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Focus value", 0, 5000, 'i', "NONE"}, - } - }, - {COMMAND(xsc_set_focus_incremental), "Command an incremental step to the focus motor", GR_XSC_MODE, 2, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Incremental focus steps", -5000, 5000, 'i', "NONE"}, - } - }, - {COMMAND(xsc_run_autofocus), "xsc run autofocus", GR_XSC_PARAM, 1, - { - {"which", 0, 2, 'i', "NONE"}, - }, - }, - - {COMMAND(xsc_set_autofocus_range), "xsc set autofocus range", GR_XSC_PARAM, 4, - { - {"which", 0, 2, 'i', "NONE"}, - {"focus_search_min", 0, 5000, 'l', "NONE"}, - {"focus_search_max", 0, 5000, 'l', "NONE"}, - {"focus_search_step", 1, 1000, 'l', "NONE"}, - }, - }, - {COMMAND(xsc_abort_autofocus), "xsc abort autofocus", GR_XSC_PARAM, 2, - { - {"which", 0, 2, 'i', "NONE"}, - {"still_use_solution", 0, 1, 'i', "NONE"}, - }, - }, - {COMMAND(xsc_autofocus_display_mode), "xsc autofocus display mode", GR_XSC_PARAM, 2, - { - {"which", 0, 2, 'i', "NONE"}, - {"mode (0=auto, 1=on, 2=off)", 0, 2, 'i', "NONE"}, - }, - }, - {COMMAND(xsc_init_aperture), "Initialize the aperture motor", GR_XSC_MODE, 1, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - } - }, - {COMMAND(xsc_get_aperture), "Get Aperture", GR_XSC_MODE, 1, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - } - }, - {COMMAND(xsc_set_aperture), "Set the absolute aperture position", GR_XSC_MODE, 2, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Absolute aperture position", 0, 1000, 'i', "NONE"}, - } - }, - {COMMAND(xsc_stop_aperture), "Stop all motion on the aperture actuator", GR_XSC_MODE, 1, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - } - }, - {COMMAND(xsc_define_aperture), "Define the value of the aperture at the current position", GR_XSC_MODE, 2, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Aperture value", 0, 1000, 'i', "NONE"}, - } - }, - {COMMAND(xsc_get_gain), "xsc get gain", GR_XSC_PARAM, 0, - { - {"which", 0, 2, 'i', "NONE"}, - }, - }, - - {COMMAND(xsc_set_gain), "xsc set gain", GR_XSC_PARAM, 0, - { - {"which", 0, 2, 'i', "NONE"}, - {"position", 0.5, 10.0, 'f', "NONE"}, - }, - }, - {COMMAND(xsc_fake_sky_brightness), "xsc fake sky brightness", GR_XSC_PARAM, 0, - { - {"which", 0, 2, 'i', "NONE"}, - {"enabled", 0, 1, 'i', "NONE"}, - {"level_kepsa", 0.0, 10000.0, 'f', "NONE"}, - {"gain_db", -50, 10, 'f', "NONE"}, - {"actual exposure time (s)", 0.01, 10.0, 'f', "NONE"}, - {"simulated exposure time (s)", 0.01, 10.0, 'f', "NONE"}, - }, - }, - {COMMAND(xsc_solver_general), "Solver parameter settings", GR_XSC_PARAM, 3, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Enable the solver", 0, 1, 'i', "NONE"}, - {"Set the solver timeout period (s)", 5, 600, 'f', "NONE"}, - } - }, - {COMMAND(xsc_solver_abort), "Abort the solving the current image", GR_XSC_MODE, 1, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"} - } - }, - {COMMAND(xsc_selective_mask), "Set the XSC selective mask", GR_XSC_PARAM, 5, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Enable selective masking", 0, 1, 'i', "NONE"}, - {"Mask field 1", 0, CMD_L_MAX, 'l', "NONE"}, - {"Mask field 2", 0, CMD_L_MAX, 'l', "NONE"}, - {"Mask field 3", 0, CMD_L_MAX, 'l', "NONE"}, - } - }, - {COMMAND(xsc_blob_finding), "XSC blob finder settings", GR_XSC_PARAM, 5, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"SNR Threshhold", 0.01, 10, 'f', "NONE"}, - {"Max num blobs", 3, 100, 'i', "NONE"}, - {"Enable Robust mode", 0, 1, 'i', "NONE"}, - {"Fitting method (0= none, 1=gaussian, 2=double gaussian)", 0, 2, 'i', "NONE"}, - } - }, - {COMMAND(xsc_blob_cells), "XSC blob cell settings", GR_XSC_PARAM, 3, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Cell size (pixels, power of 2)", 4, 512, 'i', "NONE"}, - {"Max num blobs per cell (default 2)", 1, 10, 'i', "NONE"}, - } - }, - {COMMAND(xsc_pattern_matching), "XSC pattern matching settings", GR_XSC_PARAM, 8, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Pattern match enable", 0, 1, 'i', "NONE"}, - {"Display Star names", 0, 1, 'i', "NONE"}, - {"Match Tolerance (pixels)", 0.01, 10, 'f', "NONE"}, - {"Platescale min (\"/px)", 6.0, 7.0, 'f', "NONE"}, - {"Platescale max (\"/px)", 6.0, 7.0, 'f', "NONE"}, - {"Use fixed Platescale", 0, 1, 'i', "NONE"}, - {"Fixed Platescale (\"/px)", 6.0, 7.0, 'f', "NONE"}, - } - }, - {COMMAND(xsc_filter_hor_location), "XSC Horizontal Location Filter", GR_XSC_PARAM, 3, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Horizontal Limit Enabled", 0, 1, 'i', "NONE"}, - {"Horizontal Radius (degrees)", 0.0, 90.0, 'f', "NONE"}, - } - }, - {COMMAND(xsc_filter_hor_roll), "XSC Horizontal Roll Limit", GR_XSC_PARAM, 4, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Horizontal Roll Limit", 0, 1, 'i', "NONE"}, - {"Minimum Horizontal Roll (degrees)", -180.0, 180.0, 'f', "NONE"}, - {"Maximum Horizontal Roll (degrees)", -180.0, 180.0, 'f', "NONE"}, - } - }, - {COMMAND(xsc_filter_el), "XSC Elevation Limit", GR_XSC_PARAM, 4, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Elevation Limit", 0, 1, 'i', "NONE"}, - {"Minimum Elevation (degrees)", -90.0, 90.0, 'f', "NONE"}, - {"Maximum Elevation (degrees)", -90.0, 90.0, 'f', "NONE"}, - } - }, - {COMMAND(xsc_filter_eq_location), "XSC Equatorial Location Filter", GR_XSC_PARAM, 3, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Equatorial Limit Enabled", 0, 1, 'i', "NONE"}, - {"Equatorial Radius (degrees)", 0.0, 90.0, 'f', "NONE"}, - } - }, - {COMMAND(xsc_filter_matching), "XSC Matching Filter", GR_XSC_PARAM, 4, - { - {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, - {"Pointing Error threshold (arc seconds)", 0.01, 120, 'f', "NONE"}, - {"Pixel Error threshold (pixels)", 0.01, 20, 'f', "NONE"}, - {"Minimum stars matched", 4, 30, 'i', "NONE"}, - } - }, - /* MISC */ // ACOMP {COMMAND(acomp_save_n_seconds), "Tell ACOMP to save N seconds of data", GR_MISC, 1, @@ -1559,48 +1274,6 @@ struct mcom mcommands[plugh + 2] = { {"Length of timestream", 1, 1200, 'i', "NONE"} } }, - // XY stage - {COMMAND(xy_goto), "move the X-Y translation stage to absolute position", GR_MISC, 4, - { - {"X destination", 0, 8000000, 'l', "X_STAGE"}, - {"Y destination", 0, 8000000, 'l', "Y_STAGE"}, - {"X speed", 0, 100000, 'l', "X_VEL_STAGE"}, - {"Y speed", 0, 100000, 'l', "Y_VEL_STAGE"} - } - }, - {COMMAND(xy_jump), "move the X-Y translation stage to relative position", GR_MISC, 4, - { - {"X delta", -1000000, 1000000, 'l', "0"}, - {"Y delta", -1000000, 1000000, 'l', "0"}, - {"X speed", 0, 100000, 'l', "X_VEL_STAGE"}, - {"Y speed", 0, 100000, 'l', "Y_VEL_STAGE"} - } - }, - {COMMAND(xy_xscan), "scan the X-Y translation stage in X", GR_MISC, 3, - { - {"X center", 0, 8000000, 'l', "X_STAGE"}, - {"delta X", 0, 4000000, 'l', "NONE"}, - {"X speed", 0, 1000000, 'l', "X_VEL_STAGE"}, - } - }, - {COMMAND(xy_yscan), "scan the X-Y translation stage in Y", GR_MISC, 3, - { - {"Y center", 0, 8000000, 'l', "Y_STAGE"}, - {"delta Y", 0, 4000000, 'l', "NONE"}, - {"Y speed", 0, 1000000, 'l', "Y_VEL_STAGE"}, - } - }, - {COMMAND(xy_raster), "raster the X-Y translation stage", GR_MISC, 7, - { - {"X center", 0, 10000000, 'l', "X_STAGE"}, - {"X Width", 0, 8000000, 'l', "NONE"}, - {"Y center", 0, 10000000, 'l', "Y_STAGE"}, - {"Y Width", 0, 8000000, 'l', "NONE"}, - {"X Velocity", 0, 5000000, 'l', "X_VEL_STAGE"}, - {"Y Velocity", 0, 5000000, 'l', "Y_VEL_STAGE"}, - {"Step Size", 0, 4000000, 'l', "NONE"}, - } - }, // Labjacks {COMMAND(set_queue_execute), "command queue changed", GR_CRYO, 1, { diff --git a/blast_config/include/command_list.h b/blast_config/include/command_list.h index e9f518f6f..613c0bc61 100644 --- a/blast_config/include/command_list.h +++ b/blast_config/include/command_list.h @@ -226,11 +226,6 @@ enum singleCommand { disallow_hw_wd, allow_hw_wd, take_incharge, - // Video transmitters - vtx_xsc0, - vtx_xsc1, - // XY stage - xy_panic, // BLAST(TIM) Misc reap_fc1, reap_fc2, halt_fc1, halt_fc2, @@ -423,59 +418,11 @@ enum multiCommand { /* OLD STAR CAMERAS */ // TODO(ianlowe13): Remove these old XSC commands - xsc_is_new_window_period, - xsc_offset, - xsc_heaters_off, - xsc_heaters_on, - xsc_heaters_auto, - xsc_exposure_timing, - xsc_multi_trigger, - xsc_trigger_threshold, - xsc_scan_force_trigger, - xsc_quit, - xsc_shutdown, - xsc_main_settings, - xsc_display_zoom, - xsc_image_client, - xsc_init_focus, - xsc_get_focus, - xsc_set_focus, - xsc_stop_focus, - xsc_define_focus, - xsc_set_focus_incremental, - xsc_run_autofocus, - xsc_set_autofocus_range, - xsc_abort_autofocus, - xsc_autofocus_display_mode, - xsc_init_aperture, - xsc_get_aperture, - xsc_set_aperture, - xsc_stop_aperture, - xsc_define_aperture, - xsc_get_gain, - xsc_set_gain, - xsc_fake_sky_brightness, - xsc_solver_general, - xsc_solver_abort, - xsc_selective_mask, - xsc_blob_finding, - xsc_blob_cells, - xsc_pattern_matching, - xsc_filter_hor_location, - xsc_filter_hor_roll, - xsc_filter_el, - xsc_filter_eq_location, - xsc_filter_matching, + sc_offset, /* MISC */ // acomp acomp_save_n_seconds, - // XY stage - xy_goto, - xy_jump, - xy_xscan, - xy_yscan, - xy_raster, // Labjacks set_queue_execute, // Who sends the modbus commands reconnect_lj, // Force a reconnect attempt to labjack_i diff --git a/legacyMCP/commands b/legacyMCP/commands new file mode 100644 index 000000000..059e36ec2 --- /dev/null +++ b/legacyMCP/commands @@ -0,0 +1,669 @@ + + // XY stage + {COMMAND(xy_panic), "stop XY stage motors immediately", GR_MISC}, + + + {COMMAND(xsc_image_client), "Enable or disable sending images to mcp", GR_XSC_MODE, 2, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + {"Image client enabled", 0, 1, 'i', "NONE"}, + } + }, + {COMMAND(xsc_init_focus), "Initialize the focus motor", GR_XSC_MODE, 1, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + } + }, + {COMMAND(xsc_get_focus), "Get the absolute focus position", GR_XSC_MODE, 1, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + } + }, + {COMMAND(xsc_set_focus), "Set the absolute focus position", GR_XSC_MODE, 2, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + {"Absolute focus position", 0, 5000, 'i', "NONE"}, + } + }, + {COMMAND(xsc_stop_focus), "Stop all motion on the focus actuator", GR_XSC_MODE, 1, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + } + }, + {COMMAND(xsc_define_focus), "Define the value of the focus at the current position", GR_XSC_MODE, 2, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + {"Focus value", 0, 5000, 'i', "NONE"}, + } + }, + {COMMAND(xsc_set_focus_incremental), "Command an incremental step to the focus motor", GR_XSC_MODE, 2, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + {"Incremental focus steps", -5000, 5000, 'i', "NONE"}, + } + }, + {COMMAND(xsc_run_autofocus), "xsc run autofocus", GR_XSC_PARAM, 1, + { + {"which", 0, 2, 'i', "NONE"}, + }, + }, + + {COMMAND(xsc_set_autofocus_range), "xsc set autofocus range", GR_XSC_PARAM, 4, + { + {"which", 0, 2, 'i', "NONE"}, + {"focus_search_min", 0, 5000, 'l', "NONE"}, + {"focus_search_max", 0, 5000, 'l', "NONE"}, + {"focus_search_step", 1, 1000, 'l', "NONE"}, + }, + }, + {COMMAND(xsc_abort_autofocus), "xsc abort autofocus", GR_XSC_PARAM, 2, + { + {"which", 0, 2, 'i', "NONE"}, + {"still_use_solution", 0, 1, 'i', "NONE"}, + }, + }, + {COMMAND(xsc_autofocus_display_mode), "xsc autofocus display mode", GR_XSC_PARAM, 2, + { + {"which", 0, 2, 'i', "NONE"}, + {"mode (0=auto, 1=on, 2=off)", 0, 2, 'i', "NONE"}, + }, + }, + {COMMAND(xsc_init_aperture), "Initialize the aperture motor", GR_XSC_MODE, 1, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + } + }, + {COMMAND(xsc_get_aperture), "Get Aperture", GR_XSC_MODE, 1, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + } + }, + {COMMAND(xsc_set_aperture), "Set the absolute aperture position", GR_XSC_MODE, 2, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + {"Absolute aperture position", 0, 1000, 'i', "NONE"}, + } + }, + {COMMAND(xsc_stop_aperture), "Stop all motion on the aperture actuator", GR_XSC_MODE, 1, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + } + }, + {COMMAND(xsc_define_aperture), "Define the value of the aperture at the current position", GR_XSC_MODE, 2, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + {"Aperture value", 0, 1000, 'i', "NONE"}, + } + }, + {COMMAND(xsc_get_gain), "xsc get gain", GR_XSC_PARAM, 0, + { + {"which", 0, 2, 'i', "NONE"}, + }, + }, + + {COMMAND(xsc_set_gain), "xsc set gain", GR_XSC_PARAM, 0, + { + {"which", 0, 2, 'i', "NONE"}, + {"position", 0.5, 10.0, 'f', "NONE"}, + }, + }, + {COMMAND(xsc_fake_sky_brightness), "xsc fake sky brightness", GR_XSC_PARAM, 0, + { + {"which", 0, 2, 'i', "NONE"}, + {"enabled", 0, 1, 'i', "NONE"}, + {"level_kepsa", 0.0, 10000.0, 'f', "NONE"}, + {"gain_db", -50, 10, 'f', "NONE"}, + {"actual exposure time (s)", 0.01, 10.0, 'f', "NONE"}, + {"simulated exposure time (s)", 0.01, 10.0, 'f', "NONE"}, + }, + }, + {COMMAND(xsc_solver_general), "Solver parameter settings", GR_XSC_PARAM, 3, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + {"Enable the solver", 0, 1, 'i', "NONE"}, + {"Set the solver timeout period (s)", 5, 600, 'f', "NONE"}, + } + }, + {COMMAND(xsc_solver_abort), "Abort the solving the current image", GR_XSC_MODE, 1, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"} + } + }, + {COMMAND(xsc_selective_mask), "Set the XSC selective mask", GR_XSC_PARAM, 5, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + {"Enable selective masking", 0, 1, 'i', "NONE"}, + {"Mask field 1", 0, CMD_L_MAX, 'l', "NONE"}, + {"Mask field 2", 0, CMD_L_MAX, 'l', "NONE"}, + {"Mask field 3", 0, CMD_L_MAX, 'l', "NONE"}, + } + }, + {COMMAND(xsc_blob_finding), "XSC blob finder settings", GR_XSC_PARAM, 5, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + {"SNR Threshhold", 0.01, 10, 'f', "NONE"}, + {"Max num blobs", 3, 100, 'i', "NONE"}, + {"Enable Robust mode", 0, 1, 'i', "NONE"}, + {"Fitting method (0= none, 1=gaussian, 2=double gaussian)", 0, 2, 'i', "NONE"}, + } + }, + {COMMAND(xsc_blob_cells), "XSC blob cell settings", GR_XSC_PARAM, 3, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + {"Cell size (pixels, power of 2)", 4, 512, 'i', "NONE"}, + {"Max num blobs per cell (default 2)", 1, 10, 'i', "NONE"}, + } + }, + {COMMAND(xsc_pattern_matching), "XSC pattern matching settings", GR_XSC_PARAM, 8, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + {"Pattern match enable", 0, 1, 'i', "NONE"}, + {"Display Star names", 0, 1, 'i', "NONE"}, + {"Match Tolerance (pixels)", 0.01, 10, 'f', "NONE"}, + {"Platescale min (\"/px)", 6.0, 7.0, 'f', "NONE"}, + {"Platescale max (\"/px)", 6.0, 7.0, 'f', "NONE"}, + {"Use fixed Platescale", 0, 1, 'i', "NONE"}, + {"Fixed Platescale (\"/px)", 6.0, 7.0, 'f', "NONE"}, + } + }, + {COMMAND(xsc_filter_hor_location), "XSC Horizontal Location Filter", GR_XSC_PARAM, 3, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + {"Horizontal Limit Enabled", 0, 1, 'i', "NONE"}, + {"Horizontal Radius (degrees)", 0.0, 90.0, 'f', "NONE"}, + } + }, + {COMMAND(xsc_filter_hor_roll), "XSC Horizontal Roll Limit", GR_XSC_PARAM, 4, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + {"Horizontal Roll Limit", 0, 1, 'i', "NONE"}, + {"Minimum Horizontal Roll (degrees)", -180.0, 180.0, 'f', "NONE"}, + {"Maximum Horizontal Roll (degrees)", -180.0, 180.0, 'f', "NONE"}, + } + }, + {COMMAND(xsc_filter_el), "XSC Elevation Limit", GR_XSC_PARAM, 4, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + {"Elevation Limit", 0, 1, 'i', "NONE"}, + {"Minimum Elevation (degrees)", -90.0, 90.0, 'f', "NONE"}, + {"Maximum Elevation (degrees)", -90.0, 90.0, 'f', "NONE"}, + } + }, + {COMMAND(xsc_filter_eq_location), "XSC Equatorial Location Filter", GR_XSC_PARAM, 3, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + {"Equatorial Limit Enabled", 0, 1, 'i', "NONE"}, + {"Equatorial Radius (degrees)", 0.0, 90.0, 'f', "NONE"}, + } + }, + {COMMAND(xsc_filter_matching), "XSC Matching Filter", GR_XSC_PARAM, 4, + { + {"Which camera (0, 1, 2=both)", 0, 2, 'i', "NONE"}, + {"Pointing Error threshold (arc seconds)", 0.01, 120, 'f', "NONE"}, + {"Pixel Error threshold (pixels)", 0.01, 20, 'f', "NONE"}, + {"Minimum stars matched", 4, 30, 'i', "NONE"}, + } + }, + + // XY stage + {COMMAND(xy_goto), "move the X-Y translation stage to absolute position", GR_MISC, 4, + { + {"X destination", 0, 8000000, 'l', "X_STAGE"}, + {"Y destination", 0, 8000000, 'l', "Y_STAGE"}, + {"X speed", 0, 100000, 'l', "X_VEL_STAGE"}, + {"Y speed", 0, 100000, 'l', "Y_VEL_STAGE"} + } + }, + {COMMAND(xy_jump), "move the X-Y translation stage to relative position", GR_MISC, 4, + { + {"X delta", -1000000, 1000000, 'l', "0"}, + {"Y delta", -1000000, 1000000, 'l', "0"}, + {"X speed", 0, 100000, 'l', "X_VEL_STAGE"}, + {"Y speed", 0, 100000, 'l', "Y_VEL_STAGE"} + } + }, + {COMMAND(xy_xscan), "scan the X-Y translation stage in X", GR_MISC, 3, + { + {"X center", 0, 8000000, 'l', "X_STAGE"}, + {"delta X", 0, 4000000, 'l', "NONE"}, + {"X speed", 0, 1000000, 'l', "X_VEL_STAGE"}, + } + }, + {COMMAND(xy_yscan), "scan the X-Y translation stage in Y", GR_MISC, 3, + { + {"Y center", 0, 8000000, 'l', "Y_STAGE"}, + {"delta Y", 0, 4000000, 'l', "NONE"}, + {"Y speed", 0, 1000000, 'l', "Y_VEL_STAGE"}, + } + }, + {COMMAND(xy_raster), "raster the X-Y translation stage", GR_MISC, 7, + { + {"X center", 0, 10000000, 'l', "X_STAGE"}, + {"X Width", 0, 8000000, 'l', "NONE"}, + {"Y center", 0, 10000000, 'l', "Y_STAGE"}, + {"Y Width", 0, 8000000, 'l', "NONE"}, + {"X Velocity", 0, 5000000, 'l', "X_VEL_STAGE"}, + {"Y Velocity", 0, 5000000, 'l', "Y_VEL_STAGE"}, + {"Step Size", 0, 4000000, 'l', "NONE"}, + } + }, + + + case xsc_image_client: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.image_client_enabled = (ivalues[1] != 0); + xsc_activate_command(which, xC_image_client); + } + } + break; + } + case xsc_init_focus: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + xsc_activate_command(which, xC_init_focus); + } + } + break; + } + case xsc_get_focus: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + xsc_activate_command(which, xC_get_focus); + } + } + break; + } + case xsc_set_focus: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.set_focus_value = ivalues[1]; + xsc_activate_command(which, xC_set_focus); + } + } + break; + } + case xsc_stop_focus: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + xsc_activate_command(which, xC_stop_focus); + } + } + break; + } + case xsc_define_focus: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.define_focus_value = ivalues[1]; + xsc_activate_command(which, xC_define_focus); + } + } + break; + } + case xsc_set_focus_incremental: + { + if (ivalues[0]) { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.set_focus_incremental_value = ivalues[1]; + xsc_activate_command(which, xC_set_focus_incremental); + } + } + } else { + blast_err("Commands: must provide non-zero incremental value\n"); + } + break; + } + case xsc_run_autofocus: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + xsc_activate_command(which, xC_run_autofocus); + } + } + break; + } + case xsc_set_autofocus_range: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.autofocus_search_min = ivalues[1]; + CommandData.XSC[which].net.autofocus_search_max = ivalues[2]; + CommandData.XSC[which].net.autofocus_search_step = ivalues[3]; + xsc_activate_command(which, xC_set_autofocus_range); + } + } + break; + } + case xsc_abort_autofocus: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.abort_autofocus_still_use_solution = (ivalues[1] != 0); + xsc_activate_command(which, xC_abort_autofocus); + } + } + break; + } + case xsc_autofocus_display_mode: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + if (ivalues[1] >= xC_autofocus_display_mode_auto && ivalues[1] + <= xC_autofocus_display_mode_off) { + CommandData.XSC[which].net.autofocus_display_mode = ivalues[1]; + xsc_activate_command(which, xC_autofocus_display_mode); + } else { + blast_warn("warning: command xsc_autofocus_display_mode: display mode out of range"); + } + } + } + break; + } + case xsc_init_aperture: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + xsc_activate_command(which, xC_init_aperture); + } + } + break; + } + case xsc_get_aperture: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + xsc_activate_command(which, xC_get_aperture); + } + } + break; + } + case xsc_set_aperture: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.set_aperture_value = ivalues[1]; + xsc_activate_command(which, xC_set_aperture); + } + } + break; + } + case xsc_stop_aperture: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + xsc_activate_command(which, xC_stop_aperture); + } + } + break; + } + case xsc_define_aperture: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.define_aperture_value = ivalues[1]; + xsc_activate_command(which, xC_define_aperture); + } + } + break; + } + case xsc_get_gain: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + xsc_activate_command(which, xC_get_gain); + } + } + break; + } + case xsc_set_gain: + { + for (unsigned int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.set_gain_value = rvalues[1]; + xsc_activate_command(which, xC_set_gain); + } + } + break; + } + case xsc_fake_sky_brightness: + { + for (int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.brightness.counter++; + CommandData.XSC[which].net.brightness.enabled = (ivalues[1] != 0); + CommandData.XSC[which].net.brightness.level_kepsa = rvalues[2]; + CommandData.XSC[which].net.brightness.gain_db = rvalues[3]; + CommandData.XSC[which].net.brightness.actual_exposure = rvalues[4]; + CommandData.XSC[which].net.brightness.simulated_exposure = rvalues[5]; + xsc_activate_command(which, xC_brightness); + } + } + break; + } + case xsc_solver_general: + { + for (int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.solver.enabled = (ivalues[1] != 0); + CommandData.XSC[which].net.solver.timeout = rvalues[2]; + xsc_activate_command(which, xC_solver_general); + } + } + break; + } + case xsc_solver_abort: + { + for (int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + xsc_activate_command(which, xC_solver_abort); + } + } + break; + } + case xsc_selective_mask: + { + for (int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.solver.mask.enabled = (ivalues[1] != 0); + CommandData.XSC[which].net.solver.mask.field0 = (unsigned int) ivalues[2]; + CommandData.XSC[which].net.solver.mask.field1 = (unsigned int) ivalues[3]; + CommandData.XSC[which].net.solver.mask.field2 = (unsigned int) ivalues[4]; + xsc_activate_command(which, xC_solver_mask); + } + } + break; + } + case xsc_blob_finding: + { + for (int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.solver.snr_threshold = rvalues[1]; + CommandData.XSC[which].net.solver.max_num_blobs = ivalues[2]; + CommandData.XSC[which].net.solver.robust_mode_enabled = (ivalues[3] != 0); + if (ivalues[4] >= xC_solver_fitting_method_none && ivalues[4] + <= xC_solver_fitting_method_double_gaussian) { + CommandData.XSC[which].net.solver.fitting_method = ivalues[4]; + } else { + blast_warn( + "warning: command xsc_blob_finder: fitting_method out of range. Defaulting to 'none'"); + CommandData.XSC[which].net.solver.fitting_method = xC_solver_fitting_method_none; + } + xsc_activate_command(which, xC_solver_blob_finder); + } + } + break; + } + case xsc_blob_cells: + { + for (int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.solver.cell_size = pow(2, ivalues[1]); + CommandData.XSC[which].net.solver.max_num_blobs_per_cell = ivalues[2]; + xsc_activate_command(which, xC_solver_blob_cells); + } + } + break; + } + case xsc_pattern_matching: + { + for (int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.solver.pattern_matcher_enabled = (ivalues[1] != 0); + CommandData.XSC[which].net.solver.display_star_names = (ivalues[2] != 0); + CommandData.XSC[which].net.solver.match_tolerance_px = rvalues[3]; + CommandData.XSC[which].net.solver.iplatescale_min = from_arcsec(rvalues[4]); + CommandData.XSC[which].net.solver.iplatescale_max = from_arcsec(rvalues[5]); + CommandData.XSC[which].net.solver.platescale_always_fixed = (ivalues[6] != 0); + CommandData.XSC[which].net.solver.iplatescale_fixed = from_arcsec(rvalues[7]); + xsc_activate_command(which, xC_solver_pattern_matcher); + } + } + break; + } + case xsc_filter_hor_location: + { + for (int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.solver.filters.hor_location_limit_enabled = (ivalues[1] != 0); + CommandData.XSC[which].net.solver.filters.hor_location_limit_radius = from_degrees(rvalues[2]); + xsc_activate_command(which, xC_solver_filter_hor_location); + } + } + break; + } + case xsc_filter_hor_roll: + { + for (int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.solver.filters.hor_roll_limit_enabled = (ivalues[1] != 0); + CommandData.XSC[which].net.solver.filters.hor_roll_limit_min = from_degrees(rvalues[2]); + CommandData.XSC[which].net.solver.filters.hor_roll_limit_max = from_degrees(rvalues[3]); + xsc_activate_command(which, xC_solver_filter_hor_roll); + } + } + break; + } + case xsc_filter_el: + { + for (int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.solver.filters.hor_el_limit_enabled = (ivalues[1] != 0); + CommandData.XSC[which].net.solver.filters.hor_el_limit_min = from_degrees(rvalues[2]); + CommandData.XSC[which].net.solver.filters.hor_el_limit_max = from_degrees(rvalues[3]); + xsc_activate_command(which, xC_solver_filter_hor_el); + } + } + break; + } + case xsc_filter_eq_location: + { + for (int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.solver.filters.eq_location_limit_enabled = (ivalues[1] != 0); + CommandData.XSC[which].net.solver.filters.eq_location_limit_radius = from_degrees(rvalues[2]); + xsc_activate_command(which, xC_solver_filter_eq_location); + } + } + break; + } + case xsc_filter_matching: + { + for (int which = 0; which < 2; which++) { + if (xsc_command_applies_to(which, ivalues[0])) { + CommandData.XSC[which].net.solver.filters.matching_pointing_error_threshold = from_arcsec( + rvalues[1]); + CommandData.XSC[which].net.solver.filters.matching_fit_error_threshold_px = rvalues[2]; + CommandData.XSC[which].net.solver.filters.matching_num_matched = (unsigned int) ivalues[3]; + xsc_activate_command(which, xC_solver_filter_matching); + } + } + break; + } + + + + // XY stage + case xy_goto: + CommandData.xystage.x1 = ivalues[0]; + CommandData.xystage.y1 = ivalues[1]; + CommandData.xystage.xvel = ivalues[2]; + CommandData.xystage.yvel = ivalues[3]; + CommandData.xystage.mode = XYSTAGE_GOTO; + CommandData.xystage.is_new = 1; + break; + case xy_jump: + CommandData.xystage.x1 = ivalues[0]; + CommandData.xystage.y1 = ivalues[1]; + CommandData.xystage.xvel = ivalues[2]; + CommandData.xystage.yvel = ivalues[3]; + CommandData.xystage.mode = XYSTAGE_JUMP; + CommandData.xystage.is_new = 1; + break; + case xy_xscan: + CommandData.xystage.x1 = ivalues[0]; + CommandData.xystage.x2 = ivalues[1]; + CommandData.xystage.xvel = ivalues[2]; + CommandData.xystage.yvel = 0; + CommandData.xystage.mode = XYSTAGE_SCAN; + CommandData.xystage.is_new = 1; + break; + case xy_yscan: + CommandData.xystage.y1 = ivalues[0]; + CommandData.xystage.y2 = ivalues[1]; + CommandData.xystage.yvel = ivalues[2]; + CommandData.xystage.xvel = 0; + CommandData.xystage.mode = XYSTAGE_SCAN; + CommandData.xystage.is_new = 1; + break; + case xy_raster: + CommandData.xystage.x1 = ivalues[0]; + CommandData.xystage.x2 = ivalues[1]; + CommandData.xystage.y1 = ivalues[2]; + CommandData.xystage.y2 = ivalues[3]; + CommandData.xystage.xvel = ivalues[4]; + CommandData.xystage.yvel = ivalues[5]; + CommandData.xystage.step = ivalues[6]; + CommandData.xystage.mode = XYSTAGE_RASTER; + CommandData.xystage.is_new = 1; + break; + + + + // XY STAGE + CommandData.xystage.x1 = 0; + CommandData.xystage.y1 = 0; + CommandData.xystage.x2 = 0; + CommandData.xystage.y2 = 0; + CommandData.xystage.step = 0; + CommandData.xystage.xvel = 0; + CommandData.xystage.yvel = 0; + CommandData.xystage.is_new = 1; + CommandData.xystage.mode = XYSTAGE_GOTO; + CommandData.xystage.force_repoll = 0; + + + // Video transmitters + case vtx_xsc0: + CommandData.vtx_sel[0] = VTX_XSC0; + // CommandData.Relays.video_trans = 0; + // CommandData.Relays.update_video = 1; + break; + case vtx_xsc1: + CommandData.vtx_sel[0] = VTX_XSC1; + // CommandData.Relays.video_trans = 1; + // CommandData.Relays.update_video = 1; + break; + // XY stage + #ifdef USE_XY_THREAD + case xy_panic: + CommandData.xystage.mode = XYSTAGE_PANIC; + CommandData.xystage.is_new = 1; + break; + #endif \ No newline at end of file diff --git a/mcp/housekeeping/auxiliary.c b/legacyMCP/housekeeping/auxiliary.c similarity index 100% rename from mcp/housekeeping/auxiliary.c rename to legacyMCP/housekeeping/auxiliary.c diff --git a/mcp/include/xsc_network.h b/legacyMCP/includes/xsc_network.h similarity index 100% rename from mcp/include/xsc_network.h rename to legacyMCP/includes/xsc_network.h diff --git a/mcp/include/xsc_pointing.h b/legacyMCP/includes/xsc_pointing.h similarity index 100% rename from mcp/include/xsc_pointing.h rename to legacyMCP/includes/xsc_pointing.h diff --git a/mcp/include/xystage.h b/legacyMCP/includes/xystage.h similarity index 100% rename from mcp/include/xystage.h rename to legacyMCP/includes/xystage.h diff --git a/mcp/motors/xystage.c b/legacyMCP/motors/xystage.c similarity index 100% rename from mcp/motors/xystage.c rename to legacyMCP/motors/xystage.c diff --git a/legacyMCP/pointing/acs.c b/legacyMCP/pointing/acs.c new file mode 100644 index 000000000..e69de29bb diff --git a/legacyMCP/pointing/pointing.c b/legacyMCP/pointing/pointing.c new file mode 100644 index 000000000..38bea387e --- /dev/null +++ b/legacyMCP/pointing/pointing.c @@ -0,0 +1,85 @@ +// TODO(laura): This function doesn't appear to be called by anything in mcp. +// Is this BLASTPol code that Seth overwrote? +// +// int possible_solution(double az, double el, int i_point) { +// double mag_az, enc_el, d_az; +// +// // test for insanity +// if (!finite(az)) return(0); +// if (!finite(el)) return(0); +// if (el > 70.0) return (0); +// if (el < 0.0) return(0); +// +// mag_az = PointingData[i_point].mag_az; +// +// if (CommandData.use_mag) { +// d_az = az - mag_az; +// +// if (d_az > 180.0) d_az -= 360; +// if (d_az < -180.0) d_az += 360; +// +// if (d_az > 30.0) return (0); +// if (d_az < -30.0) return (0); +// } +// +// +// return(1); +// } + +// TODO(ianlowe13): remove deprecated, should be updated with new XSC stuff +static xsc_last_trigger_state_t *XSCHasNewSolution(int which) +{ + xsc_last_trigger_state_t *trig_state = NULL; + + // The latest solution isn't good + if (!XSC_SERVER_DATA(which).channels.image_eq_valid) { + return NULL; + } + + // The camera system has just started + if (XSC_SERVER_DATA(which).channels.image_ctr_stars < 0 || XSC_SERVER_DATA(which).channels.image_ctr_mcp < 0) { + return NULL; + } + + // The solution has already been processed + if (XSC_SERVER_DATA(which).channels.image_ctr_stars == xsc_pointing_state[which].last_solution_stars_counter) { + return NULL; + } + while ((trig_state = xsc_get_trigger_data(which))) { + if ((XSC_SERVER_DATA(which).channels.image_ctr_mcp == trig_state->counter_mcp) + && (XSC_SERVER_DATA(which).channels.image_ctr_stars == trig_state->counter_stars)) { + break; + } + blast_dbg("Discarding trigger data with counter_mcp %d", trig_state->counter_mcp); + blast_dbg("Discarding trigger data with image_ctr_mcp %d", XSC_SERVER_DATA(which).channels.image_ctr_mcp); + blast_dbg("Discarding trigger data with counter_stars %d", trig_state->counter_stars); + blast_dbg("Discarding trigger data with image_ctr_stars %d", XSC_SERVER_DATA(which).channels.image_ctr_stars); + free(trig_state); + } + return trig_state; +} + +// TODO(ianlowe13): remove deprecated, replace with new XSC stuff +/** + * @brief Calculate the star camera pointing after incorporating all sensor + * measurements. + * @param which int Star camera identifier + */ +static void sc_calculate_full_pointing_estimated_location(int which) +{ + int pointing_read_index = GETREADINDEX(point_index); + double az = from_degrees(PointingData[pointing_read_index].az); + double el = from_degrees(PointingData[pointing_read_index].el); + double sc_az = az - approximate_az_from_cross_el(CommandData.XSC[which].cross_el_trim, el); + double sc_el = el - CommandData.XSC[which].el_trim; + double sc_ra_hours = 0.0; + double sc_dec_deg = 0.0; + horizontal_to_equatorial(to_degrees(sc_az), to_degrees(sc_el), + PointingData[pointing_read_index].lst, + PointingData[pointing_read_index].lat, &sc_ra_hours, &sc_dec_deg); + // Save off data to use as priors for new star camera solve + PointingData[point_index].estimated_xsc_az_deg[which] = to_degrees(sc_az); + PointingData[point_index].estimated_xsc_el_deg[which] = to_degrees(sc_el); + PointingData[point_index].estimated_xsc_ra_hours[which] = sc_ra_hours; + PointingData[point_index].estimated_xsc_dec_deg[which] = sc_dec_deg; +} \ No newline at end of file diff --git a/mcp/sensors/xsc_network.c b/legacyMCP/pointing/xsc_network.c similarity index 100% rename from mcp/sensors/xsc_network.c rename to legacyMCP/pointing/xsc_network.c diff --git a/mcp/pointing/xsc_pointing.c b/legacyMCP/pointing/xsc_pointing.c similarity index 100% rename from mcp/pointing/xsc_pointing.c rename to legacyMCP/pointing/xsc_pointing.c diff --git a/mcp/commanding/commands.c b/mcp/commanding/commands.c index 15a62ec69..51707cabd 100644 --- a/mcp/commanding/commands.c +++ b/mcp/commanding/commands.c @@ -891,24 +891,6 @@ void SingleCommand(enum singleCommand command, int scheduled) case take_incharge: InCharge = 1; break; - // Video transmitters - case vtx_xsc0: - CommandData.vtx_sel[0] = VTX_XSC0; - // CommandData.Relays.video_trans = 0; - // CommandData.Relays.update_video = 1; - break; - case vtx_xsc1: - CommandData.vtx_sel[0] = VTX_XSC1; - // CommandData.Relays.video_trans = 1; - // CommandData.Relays.update_video = 1; - break; - // XY stage - #ifdef USE_XY_THREAD - case xy_panic: - CommandData.xystage.mode = XYSTAGE_PANIC; - CommandData.xystage.is_new = 1; - break; - #endif // BLAST(TIM) Misc case reap_fc1: // Miscellaneous commands if (command == reap_fc1 && !SouthIAm) { @@ -2061,16 +2043,7 @@ void MultiCommand(enum multiCommand command, double *rvalues, break; // TODO(ianlowe13): remove XSC stuff /* STAR CAMERAS */ - case xsc_is_new_window_period: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].is_new_window_period_cs = ivalues[1]; - } - } - break; - } - case xsc_offset: + case sc_offset: { for (unsigned int which = 0; which < 2; which++) { if (xsc_command_applies_to(which, ivalues[0])) { @@ -2080,456 +2053,6 @@ void MultiCommand(enum multiCommand command, double *rvalues, } break; } - case xsc_heaters_off: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].heaters.mode = xsc_heater_off; - } - } - break; - } - case xsc_heaters_on: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].heaters.mode = xsc_heater_on; - } - } - break; - } - case xsc_heaters_auto: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].heaters.mode = xsc_heater_auto; - CommandData.XSC[which].heaters.setpoint = rvalues[1]; - } - } - break; - } - case xsc_exposure_timing: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].trigger.exposure_time_cs = ivalues[1]; - } - // Commanded value is in seconds! - CommandData.XSC[which].trigger.grace_period_cs = rvalues[2] * 100.0; - CommandData.XSC[which].trigger.post_trigger_counter_mcp_share_delay_cs = ivalues[3]; - } - break; - } - case xsc_multi_trigger: - { - for (unsigned int which = 0; which < 2; which++) { - CommandData.XSC[which].trigger.num_triggers = ivalues[1]; - CommandData.XSC[which].trigger.multi_trigger_time_between_triggers_cs = ivalues[2]; - xsc_activate_command(which, xC_multi_triggering); - } - break; - } - case xsc_trigger_threshold: - { - int which = 0; - for (which = 0; which < 2; which++) { - CommandData.XSC[which].trigger.threshold.enabled = (ivalues[1] != 0); - CommandData.XSC[which].trigger.threshold.blob_streaking_px = rvalues[2]; - } - break; - } - case xsc_scan_force_trigger: - { - int which = 0; - for (which = 0; which < 2; which++) { - CommandData.XSC[which].trigger.scan_force_trigger_enabled = (ivalues[1] != 0); - } - break; - } - case xsc_quit: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - xsc_activate_command(which, xC_quit); - } - } - break; - } - case xsc_shutdown: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.shutdown.shutdown_now = true; - CommandData.XSC[which].net.shutdown.include_restart = (ivalues[1] != 0); - xsc_activate_command(which, xC_shutdown); - } - } - break; - } - case xsc_main_settings: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.main_settings.display_frequency = rvalues[1]; - CommandData.XSC[which].net.main_settings.display_fullscreen = (ivalues[2] != 0); - CommandData.XSC[which].net.main_settings.display_image_only = (ivalues[3] != 0); - CommandData.XSC[which].net.main_settings.display_solving_filters = (ivalues[4] != 0); - CommandData.XSC[which].net.main_settings.display_image_brightness = rvalues[5]; - xsc_activate_command(which, xC_main_settings); - } - } - break; - } - case xsc_display_zoom: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.main_settings.display_zoom_x = ivalues[1]; - CommandData.XSC[which].net.main_settings.display_zoom_y = ivalues[2]; - CommandData.XSC[which].net.main_settings.display_zoom_magnitude = rvalues[3]; - xsc_activate_command(which, xC_display_zoom); - } - } - break; - } - case xsc_image_client: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.image_client_enabled = (ivalues[1] != 0); - xsc_activate_command(which, xC_image_client); - } - } - break; - } - case xsc_init_focus: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - xsc_activate_command(which, xC_init_focus); - } - } - break; - } - case xsc_get_focus: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - xsc_activate_command(which, xC_get_focus); - } - } - break; - } - case xsc_set_focus: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.set_focus_value = ivalues[1]; - xsc_activate_command(which, xC_set_focus); - } - } - break; - } - case xsc_stop_focus: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - xsc_activate_command(which, xC_stop_focus); - } - } - break; - } - case xsc_define_focus: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.define_focus_value = ivalues[1]; - xsc_activate_command(which, xC_define_focus); - } - } - break; - } - case xsc_set_focus_incremental: - { - if (ivalues[0]) { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.set_focus_incremental_value = ivalues[1]; - xsc_activate_command(which, xC_set_focus_incremental); - } - } - } else { - blast_err("Commands: must provide non-zero incremental value\n"); - } - break; - } - case xsc_run_autofocus: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - xsc_activate_command(which, xC_run_autofocus); - } - } - break; - } - case xsc_set_autofocus_range: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.autofocus_search_min = ivalues[1]; - CommandData.XSC[which].net.autofocus_search_max = ivalues[2]; - CommandData.XSC[which].net.autofocus_search_step = ivalues[3]; - xsc_activate_command(which, xC_set_autofocus_range); - } - } - break; - } - case xsc_abort_autofocus: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.abort_autofocus_still_use_solution = (ivalues[1] != 0); - xsc_activate_command(which, xC_abort_autofocus); - } - } - break; - } - case xsc_autofocus_display_mode: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - if (ivalues[1] >= xC_autofocus_display_mode_auto && ivalues[1] - <= xC_autofocus_display_mode_off) { - CommandData.XSC[which].net.autofocus_display_mode = ivalues[1]; - xsc_activate_command(which, xC_autofocus_display_mode); - } else { - blast_warn("warning: command xsc_autofocus_display_mode: display mode out of range"); - } - } - } - break; - } - case xsc_init_aperture: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - xsc_activate_command(which, xC_init_aperture); - } - } - break; - } - case xsc_get_aperture: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - xsc_activate_command(which, xC_get_aperture); - } - } - break; - } - case xsc_set_aperture: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.set_aperture_value = ivalues[1]; - xsc_activate_command(which, xC_set_aperture); - } - } - break; - } - case xsc_stop_aperture: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - xsc_activate_command(which, xC_stop_aperture); - } - } - break; - } - case xsc_define_aperture: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.define_aperture_value = ivalues[1]; - xsc_activate_command(which, xC_define_aperture); - } - } - break; - } - case xsc_get_gain: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - xsc_activate_command(which, xC_get_gain); - } - } - break; - } - case xsc_set_gain: - { - for (unsigned int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.set_gain_value = rvalues[1]; - xsc_activate_command(which, xC_set_gain); - } - } - break; - } - case xsc_fake_sky_brightness: - { - for (int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.brightness.counter++; - CommandData.XSC[which].net.brightness.enabled = (ivalues[1] != 0); - CommandData.XSC[which].net.brightness.level_kepsa = rvalues[2]; - CommandData.XSC[which].net.brightness.gain_db = rvalues[3]; - CommandData.XSC[which].net.brightness.actual_exposure = rvalues[4]; - CommandData.XSC[which].net.brightness.simulated_exposure = rvalues[5]; - xsc_activate_command(which, xC_brightness); - } - } - break; - } - case xsc_solver_general: - { - for (int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.solver.enabled = (ivalues[1] != 0); - CommandData.XSC[which].net.solver.timeout = rvalues[2]; - xsc_activate_command(which, xC_solver_general); - } - } - break; - } - case xsc_solver_abort: - { - for (int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - xsc_activate_command(which, xC_solver_abort); - } - } - break; - } - case xsc_selective_mask: - { - for (int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.solver.mask.enabled = (ivalues[1] != 0); - CommandData.XSC[which].net.solver.mask.field0 = (unsigned int) ivalues[2]; - CommandData.XSC[which].net.solver.mask.field1 = (unsigned int) ivalues[3]; - CommandData.XSC[which].net.solver.mask.field2 = (unsigned int) ivalues[4]; - xsc_activate_command(which, xC_solver_mask); - } - } - break; - } - case xsc_blob_finding: - { - for (int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.solver.snr_threshold = rvalues[1]; - CommandData.XSC[which].net.solver.max_num_blobs = ivalues[2]; - CommandData.XSC[which].net.solver.robust_mode_enabled = (ivalues[3] != 0); - if (ivalues[4] >= xC_solver_fitting_method_none && ivalues[4] - <= xC_solver_fitting_method_double_gaussian) { - CommandData.XSC[which].net.solver.fitting_method = ivalues[4]; - } else { - blast_warn( - "warning: command xsc_blob_finder: fitting_method out of range. Defaulting to 'none'"); - CommandData.XSC[which].net.solver.fitting_method = xC_solver_fitting_method_none; - } - xsc_activate_command(which, xC_solver_blob_finder); - } - } - break; - } - case xsc_blob_cells: - { - for (int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.solver.cell_size = pow(2, ivalues[1]); - CommandData.XSC[which].net.solver.max_num_blobs_per_cell = ivalues[2]; - xsc_activate_command(which, xC_solver_blob_cells); - } - } - break; - } - case xsc_pattern_matching: - { - for (int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.solver.pattern_matcher_enabled = (ivalues[1] != 0); - CommandData.XSC[which].net.solver.display_star_names = (ivalues[2] != 0); - CommandData.XSC[which].net.solver.match_tolerance_px = rvalues[3]; - CommandData.XSC[which].net.solver.iplatescale_min = from_arcsec(rvalues[4]); - CommandData.XSC[which].net.solver.iplatescale_max = from_arcsec(rvalues[5]); - CommandData.XSC[which].net.solver.platescale_always_fixed = (ivalues[6] != 0); - CommandData.XSC[which].net.solver.iplatescale_fixed = from_arcsec(rvalues[7]); - xsc_activate_command(which, xC_solver_pattern_matcher); - } - } - break; - } - case xsc_filter_hor_location: - { - for (int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.solver.filters.hor_location_limit_enabled = (ivalues[1] != 0); - CommandData.XSC[which].net.solver.filters.hor_location_limit_radius = from_degrees(rvalues[2]); - xsc_activate_command(which, xC_solver_filter_hor_location); - } - } - break; - } - case xsc_filter_hor_roll: - { - for (int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.solver.filters.hor_roll_limit_enabled = (ivalues[1] != 0); - CommandData.XSC[which].net.solver.filters.hor_roll_limit_min = from_degrees(rvalues[2]); - CommandData.XSC[which].net.solver.filters.hor_roll_limit_max = from_degrees(rvalues[3]); - xsc_activate_command(which, xC_solver_filter_hor_roll); - } - } - break; - } - case xsc_filter_el: - { - for (int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.solver.filters.hor_el_limit_enabled = (ivalues[1] != 0); - CommandData.XSC[which].net.solver.filters.hor_el_limit_min = from_degrees(rvalues[2]); - CommandData.XSC[which].net.solver.filters.hor_el_limit_max = from_degrees(rvalues[3]); - xsc_activate_command(which, xC_solver_filter_hor_el); - } - } - break; - } - case xsc_filter_eq_location: - { - for (int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.solver.filters.eq_location_limit_enabled = (ivalues[1] != 0); - CommandData.XSC[which].net.solver.filters.eq_location_limit_radius = from_degrees(rvalues[2]); - xsc_activate_command(which, xC_solver_filter_eq_location); - } - } - break; - } - case xsc_filter_matching: - { - for (int which = 0; which < 2; which++) { - if (xsc_command_applies_to(which, ivalues[0])) { - CommandData.XSC[which].net.solver.filters.matching_pointing_error_threshold = from_arcsec( - rvalues[1]); - CommandData.XSC[which].net.solver.filters.matching_fit_error_threshold_px = rvalues[2]; - CommandData.XSC[which].net.solver.filters.matching_num_matched = (unsigned int) ivalues[3]; - xsc_activate_command(which, xC_solver_filter_matching); - } - } - break; - } - /* MISC */ // acomp case acomp_save_n_seconds: @@ -2538,50 +2061,6 @@ void MultiCommand(enum multiCommand command, double *rvalues, CommandData.acomp_commands.counting = 1; CommandData.acomp_commands.countdown = ivalues[0]; break; - // XY stage - case xy_goto: - CommandData.xystage.x1 = ivalues[0]; - CommandData.xystage.y1 = ivalues[1]; - CommandData.xystage.xvel = ivalues[2]; - CommandData.xystage.yvel = ivalues[3]; - CommandData.xystage.mode = XYSTAGE_GOTO; - CommandData.xystage.is_new = 1; - break; - case xy_jump: - CommandData.xystage.x1 = ivalues[0]; - CommandData.xystage.y1 = ivalues[1]; - CommandData.xystage.xvel = ivalues[2]; - CommandData.xystage.yvel = ivalues[3]; - CommandData.xystage.mode = XYSTAGE_JUMP; - CommandData.xystage.is_new = 1; - break; - case xy_xscan: - CommandData.xystage.x1 = ivalues[0]; - CommandData.xystage.x2 = ivalues[1]; - CommandData.xystage.xvel = ivalues[2]; - CommandData.xystage.yvel = 0; - CommandData.xystage.mode = XYSTAGE_SCAN; - CommandData.xystage.is_new = 1; - break; - case xy_yscan: - CommandData.xystage.y1 = ivalues[0]; - CommandData.xystage.y2 = ivalues[1]; - CommandData.xystage.yvel = ivalues[2]; - CommandData.xystage.xvel = 0; - CommandData.xystage.mode = XYSTAGE_SCAN; - CommandData.xystage.is_new = 1; - break; - case xy_raster: - CommandData.xystage.x1 = ivalues[0]; - CommandData.xystage.x2 = ivalues[1]; - CommandData.xystage.y1 = ivalues[2]; - CommandData.xystage.y2 = ivalues[3]; - CommandData.xystage.xvel = ivalues[4]; - CommandData.xystage.yvel = ivalues[5]; - CommandData.xystage.step = ivalues[6]; - CommandData.xystage.mode = XYSTAGE_RASTER; - CommandData.xystage.is_new = 1; - break; // Labjacks case set_queue_execute: set_execute(ivalues[0]); @@ -3042,8 +2521,6 @@ void InitCommandData() copysvalue(CommandData.bi0_linklist_name, "roach_noise_psd.ll"); copysvalue(CommandData.highrate_linklist_name, "test3.ll"); copysvalue(CommandData.sbd_linklist_name, "sbd.ll"); - CommandData.vtx_sel[0] = vtx_xsc0; - CommandData.vtx_sel[1] = vtx_xsc1; CommandData.pilot_oth = 0; CommandData.slew_veto = VETO_MAX; /* 5 minutes */ @@ -3108,6 +2585,7 @@ void InitCommandData() CommandData.use_elclin2 = 1; CommandData.use_pss = 1; CommandData.use_dgps = 0; +// TODO(IAN): check this CommandData.use_xsc0 = 1; CommandData.use_xsc1 = 1; CommandData.use_mag1 = 1; @@ -3222,19 +2700,7 @@ void InitCommandData() CommandData.actbus.shutter_acc = 1; CommandData.pin_is_in = 1; - - // XY STAGE - CommandData.xystage.x1 = 0; - CommandData.xystage.y1 = 0; - CommandData.xystage.x2 = 0; - CommandData.xystage.y2 = 0; - CommandData.xystage.step = 0; - CommandData.xystage.xvel = 0; - CommandData.xystage.yvel = 0; - CommandData.xystage.is_new = 1; - CommandData.xystage.mode = XYSTAGE_GOTO; - CommandData.xystage.force_repoll = 0; - +// TODO(IAN): check this CommandData.ISCControl[0].max_age = 200; /* 2000 ms*/ CommandData.ISCControl[0].autofocus = 0; @@ -3270,8 +2736,6 @@ void InitCommandData() CommandData.XSC[which].el_trim = 0.0; CommandData.XSC[which].cross_el_trim = 0.0; CommandData.XSC[which].uncertainty_floor_arcsec = 3.0; // approx. 1/2 px uncertainty at our plate scale - - xsc_clear_client_data(&CommandData.XSC[which].net); } CommandData.temp1 = 0; diff --git a/mcp/housekeeping/CMakeLists.txt b/mcp/housekeeping/CMakeLists.txt index 19db9a9f9..496881d5a 100644 --- a/mcp/housekeeping/CMakeLists.txt +++ b/mcp/housekeeping/CMakeLists.txt @@ -1,5 +1,4 @@ add_library(housekeeping STATIC - ${CMAKE_CURRENT_SOURCE_DIR}/auxiliary.c ${CMAKE_CURRENT_SOURCE_DIR}/chrgctrl.c ${CMAKE_CURRENT_SOURCE_DIR}/computer_sensors.c ${CMAKE_CURRENT_SOURCE_DIR}/data_sharing_server.c diff --git a/mcp/mcp.c b/mcp/mcp.c index 66784be78..7a86205e4 100644 --- a/mcp/mcp.c +++ b/mcp/mcp.c @@ -122,9 +122,6 @@ bool ready_to_close = false; void Pointing(); void WatchFIFO(void*); // commands.c -#ifdef USE_XY_THREAD -void StageBus(void); -#endif logger_t logger = {0}; uint8_t * logger_buffer = NULL; @@ -259,12 +256,7 @@ static void mcp_100hz_routines(void) update_axes_mode(); store_100hz_acs(); send_fast_data(); - store_100hz_xsc(0); - store_100hz_xsc(1); write_motor_channels_100hz(); - xsc_control_triggers(); - xsc_decrement_is_new_countdowns(&CommandData.XSC[0].net); - xsc_decrement_is_new_countdowns(&CommandData.XSC[1].net); // write the logs to the frame if (logger_buffer) { if (ResetLog) { @@ -308,20 +300,14 @@ static void mcp_5hz_routines(void) // Tickles software WD 2.5x as fast as timeout read_5hz_acs(); store_5hz_acs(); - store_5hz_xsc(0); - store_5hz_xsc(1); write_motor_channels_5hz(); store_axes_mode_data(); WriteAux(); ControlBalance(); StoreActBus(); update_sun_sensors(); - #ifdef USE_XY_THREAD - StoreStageBus(0); - #endif // PhaseControl(); // ChargeController(); -// VideoTx(); // cameraFields(); record_loop_timing(RATE_5HZ); share_data(RATE_5HZ); @@ -331,10 +317,6 @@ static void mcp_5hz_routines(void) } static void mcp_2hz_routines(void) { - if (InCharge) { - xsc_write_data(0); - xsc_write_data(1); - } record_loop_timing(RATE_2HZ); } @@ -372,8 +354,6 @@ static void mcp_1hz_routines(void) record_motor_status_1hz(); // blast_store_disk_space(); update_az_vel_limit_tlm(); - store_1hz_xsc(0); - store_1hz_xsc(1); store_charge_controller_data(); record_loop_timing(RATE_1HZ); share_data(RATE_1HZ); @@ -644,13 +624,6 @@ blast_info("Finished initializing Beaglebones..."); */ pthread_create(&CPU_monitor, NULL, CPU_health, NULL); -// this will need to be changed with the new star cameras - if (use_starcams) { - xsc_networking_init(0); - xsc_networking_init(1); - xsc_trigger(0, 0); - xsc_trigger(1, 0); - } // RFSOC commanding stuff pthread_t rfsoc1_command_thread; pthread_t rfsoc2_command_thread; @@ -768,9 +741,6 @@ blast_info("Finished initializing Beaglebones..."); */ init_loop_timing(); main_thread = ph_thread_spawn(mcp_main_loop, NULL); -#ifdef USE_XY_THREAD // define should be set in mcp.h - ph_thread_t *xy_thread = ph_thread_spawn(StageBus, NULL); -#endif ph_sched_run(); blast_info("Joining main thread."); diff --git a/mcp/motors/CMakeLists.txt b/mcp/motors/CMakeLists.txt index 55c2b8246..7299c3c95 100644 --- a/mcp/motors/CMakeLists.txt +++ b/mcp/motors/CMakeLists.txt @@ -3,7 +3,6 @@ add_library (motors STATIC ${CMAKE_CURRENT_SOURCE_DIR}/motors.c ${CMAKE_CURRENT_SOURCE_DIR}/actuators.c ${CMAKE_CURRENT_SOURCE_DIR}/ezstep.c - ${CMAKE_CURRENT_SOURCE_DIR}/xystage.c ${CMAKE_CURRENT_SOURCE_DIR}/balance.c ) define_file_basename_for_sources(motors) diff --git a/mcp/motors/motors.c b/mcp/motors/motors.c index 25819af30..a3ba47367 100644 --- a/mcp/motors/motors.c +++ b/mcp/motors/motors.c @@ -90,8 +90,9 @@ static double az_accel = 0.1; // last pointing mode static int last_mode = -1; -extern bool scan_entered_snap_mode; -extern bool scan_leaving_snap_mode; +// ian commented out 7/14/26 +// extern bool scan_entered_snap_mode; +// extern bool scan_leaving_snap_mode; /** @@ -671,7 +672,8 @@ static void calculate_az_mode_vel(double m_az, double m_leftbound, double m_righ if (axes_mode.az_vel < m_vel + m_az_drift_vel) axes_mode.az_vel += az_accel; // Forced Triggering if (from_scan_to_turnaround) { - scan_entered_snap_mode = true; + // note Ian 7/14/26 - this is an XSC variable i believe + // scan_entered_snap_mode = true; from_scan_to_turnaround = false; } from_turnaround_to_scan = true; @@ -680,7 +682,7 @@ static void calculate_az_mode_vel(double m_az, double m_leftbound, double m_righ if (axes_mode.az_vel > -m_vel + m_az_drift_vel) axes_mode.az_vel -= az_accel; // Forced Triggering if (from_scan_to_turnaround) { - scan_entered_snap_mode = true; + // scan_entered_snap_mode = true; from_scan_to_turnaround = false; } from_turnaround_to_scan = true; @@ -694,7 +696,7 @@ static void calculate_az_mode_vel(double m_az, double m_leftbound, double m_righ // Forced Triggering from_scan_to_turnaround = true; if (from_turnaround_to_scan) { - scan_leaving_snap_mode = true; + // scan_leaving_snap_mode = true; from_turnaround_to_scan = false; } } diff --git a/mcp/pointing/CMakeLists.txt b/mcp/pointing/CMakeLists.txt index 925e660ce..82aff58d1 100644 --- a/mcp/pointing/CMakeLists.txt +++ b/mcp/pointing/CMakeLists.txt @@ -6,7 +6,6 @@ add_library (pointing STATIC ${CMAKE_CURRENT_SOURCE_DIR}/time_julian.c ${CMAKE_CURRENT_SOURCE_DIR}/time_nutation.c ${CMAKE_CURRENT_SOURCE_DIR}/utilities_pointing.c - ${CMAKE_CURRENT_SOURCE_DIR}/xsc_pointing.c ) define_file_basename_for_sources(pointing) diff --git a/mcp/pointing/pointing.c b/mcp/pointing/pointing.c index 8284795c0..76256fc6d 100644 --- a/mcp/pointing/pointing.c +++ b/mcp/pointing/pointing.c @@ -710,88 +710,6 @@ static void record_gyro_history(int m_index, gyro_history_t *m_gyhist, gyro_read m_gyhist->i_history++; } -// TODO(laura): This function doesn't appear to be called by anything in mcp. -// Is this BLASTPol code that Seth overwrote? -// -// int possible_solution(double az, double el, int i_point) { -// double mag_az, enc_el, d_az; -// -// // test for insanity -// if (!finite(az)) return(0); -// if (!finite(el)) return(0); -// if (el > 70.0) return (0); -// if (el < 0.0) return(0); -// -// mag_az = PointingData[i_point].mag_az; -// -// if (CommandData.use_mag) { -// d_az = az - mag_az; -// -// if (d_az > 180.0) d_az -= 360; -// if (d_az < -180.0) d_az += 360; -// -// if (d_az > 30.0) return (0); -// if (d_az < -30.0) return (0); -// } -// -// -// return(1); -// } - - -// TODO(ianlowe13): remove deprecated, should be updated with new XSC stuff -static xsc_last_trigger_state_t *XSCHasNewSolution(int which) -{ - xsc_last_trigger_state_t *trig_state = NULL; - - // The latest solution isn't good - if (!XSC_SERVER_DATA(which).channels.image_eq_valid) { - return NULL; - } - - // The camera system has just started - if (XSC_SERVER_DATA(which).channels.image_ctr_stars < 0 || XSC_SERVER_DATA(which).channels.image_ctr_mcp < 0) { - return NULL; - } - - // The solution has already been processed - if (XSC_SERVER_DATA(which).channels.image_ctr_stars == xsc_pointing_state[which].last_solution_stars_counter) { - return NULL; - } - - /* Joy is commenting this out, replacing with previous EBEX logic - while ((trig_state = xsc_get_trigger_data(which))) { - if (XSC_SERVER_DATA(which).channels.image_ctr_mcp == trig_state->counter_mcp) - break; - blast_dbg("Discarding trigger data with counter_mcp %d", trig_state->counter_mcp); - free(trig_state); - } - */ - while ((trig_state = xsc_get_trigger_data(which))) { - if ((XSC_SERVER_DATA(which).channels.image_ctr_mcp == trig_state->counter_mcp) - && (XSC_SERVER_DATA(which).channels.image_ctr_stars == trig_state->counter_stars)) { - break; - } - blast_dbg("Discarding trigger data with counter_mcp %d", trig_state->counter_mcp); - blast_dbg("Discarding trigger data with image_ctr_mcp %d", XSC_SERVER_DATA(which).channels.image_ctr_mcp); - blast_dbg("Discarding trigger data with counter_stars %d", trig_state->counter_stars); - blast_dbg("Discarding trigger data with image_ctr_stars %d", XSC_SERVER_DATA(which).channels.image_ctr_stars); - free(trig_state); - } - /* - trig_state = xsc_get_trigger_data(which); - if (XSC_SERVER_DATA(which).channels.image_ctr_stars != trig_state->counter_stars) { - free(trig_state); - return NULL; - } - if (XSC_SERVER_DATA(which).channels.image_ctr_mcp != trig_state->counter_mcp) { - free(trig_state); - return NULL; - } - */ - - return trig_state; -} // TODO(ianlowe13, evanmayer): replace this with new XSC information @@ -806,10 +724,9 @@ static xsc_last_trigger_state_t *XSCHasNewSolution(int which) * @return a The azimuth solution struct. * @return 1 upon successful completion. */ -static void EvolveXSCSolution(struct ElSolutionStruct *e, struct AzSolutionStruct *a, gyro_reading_t *m_rg, +static void EvolveSCSolution(struct ElSolutionStruct *e, struct AzSolutionStruct *a, gyro_reading_t *m_rg, gyro_history_t *m_hs, double old_el, int which) { - xsc_last_trigger_state_t *trig_state = NULL; int i_point = GETREADINDEX(point_index); double gy_az; @@ -870,7 +787,8 @@ static void EvolveXSCSolution(struct ElSolutionStruct *e, struct AzSolutionStruc GET_VALUE(sc_decAddr, sc_dec_deg); GET_VALUE(sc_image_rmsAddr, sc_rms_arcsec); - blast_info("Evolve RA value is %lf\n", sc_ra_deg); + // uncomment for testing purposes + // blast_info("Evolve RA value is %lf\n", sc_ra_deg); // Calculate the time delta between the star camera time of validity and the current time. int32_t msec_per_100hz_frame = 10; @@ -880,7 +798,6 @@ static void EvolveXSCSolution(struct ElSolutionStruct *e, struct AzSolutionStruc if (delta_100hz < GY_HISTORY_AGE_CS) { blast_info("Star camera %i: new solution young enough to accept", which + 1); - // TODO(ianlowe13) find out if this is J2000 or precessed ra = sc_ra_deg/HR2DEG; dec = sc_dec_deg; @@ -963,10 +880,9 @@ static void EvolveXSCSolution(struct ElSolutionStruct *e, struct AzSolutionStruc a->angle += gy_az_delta; // add back to now a->angle = normalize_angle_360(a->angle); - blast_dbg(" Az result is: %f\n", a->angle); + blast_dbg("Az result is: %f\n", a->angle); blast_dbg("Evolved SC AZ EL is %f %f\n", a->angle, e->angle); } - free(trig_state); } } @@ -1191,30 +1107,7 @@ static void EvolveAzSolution(struct AzSolutionStruct *s, double ifroll_gy, } -// TODO(ianlowe13): remove deprecated, replace with new XSC stuff -/** - * @brief Calculate the star camera pointing after incorporating all sensor - * measurements. - * @param which int Star camera identifier - */ -static void xsc_calculate_full_pointing_estimated_location(int which) -{ - int pointing_read_index = GETREADINDEX(point_index); - double az = from_degrees(PointingData[pointing_read_index].az); - double el = from_degrees(PointingData[pointing_read_index].el); - double xsc_az = az - approximate_az_from_cross_el(CommandData.XSC[which].cross_el_trim, el); - double xsc_el = el - CommandData.XSC[which].el_trim; - double xsc_ra_hours = 0.0; - double xsc_dec_deg = 0.0; - horizontal_to_equatorial(to_degrees(xsc_az), to_degrees(xsc_el), - PointingData[pointing_read_index].lst, - PointingData[pointing_read_index].lat, &xsc_ra_hours, &xsc_dec_deg); - // Save off data to use as priors for new star camera solve - PointingData[point_index].estimated_xsc_az_deg[which] = to_degrees(xsc_az); - PointingData[point_index].estimated_xsc_el_deg[which] = to_degrees(xsc_el); - PointingData[point_index].estimated_xsc_ra_hours[which] = xsc_ra_hours; - PointingData[point_index].estimated_xsc_dec_deg[which] = xsc_dec_deg; -} + /** @@ -1708,8 +1601,8 @@ void Pointing(void) PointingData[point_index].dgps_az_raw = CSBFGPSAz.az; // Evolve star camera solutions with gyro data - EvolveXSCSolution(&ISCEl, &ISCAz, &RG, &hs, PointingData[i_point_read].el, 0); - EvolveXSCSolution(&OSCEl, &OSCAz, &RG, &hs, PointingData[i_point_read].el, 1); + EvolveSCSolution(&ISCEl, &ISCAz, &RG, &hs, PointingData[i_point_read].el, 0); + EvolveSCSolution(&OSCEl, &OSCAz, &RG, &hs, PointingData[i_point_read].el, 1); // ************************************************************************ // ELEVATION SOLUTION @@ -1949,8 +1842,8 @@ void Pointing(void) PointingData[point_index].new_el = NewAzEl.el; // Calculate a new star camera boresight solution based on sensor data - xsc_calculate_full_pointing_estimated_location(0); - xsc_calculate_full_pointing_estimated_location(1); + // sc_calculate_full_pointing_estimated_location(0); + // sc_calculate_full_pointing_estimated_location(1); // Set Manual Trims if (CommandData.autotrim_enable) { diff --git a/mcp/sensors/CMakeLists.txt b/mcp/sensors/CMakeLists.txt index 4e3569ed2..28f6eb54c 100644 --- a/mcp/sensors/CMakeLists.txt +++ b/mcp/sensors/CMakeLists.txt @@ -11,8 +11,6 @@ add_library (mcp_sensors STATIC ${CMAKE_CURRENT_SOURCE_DIR}/star_camera_solutions.c ${CMAKE_CURRENT_SOURCE_DIR}/star_camera_transmit.c ${CMAKE_CURRENT_SOURCE_DIR}/star_camera_trigger.c - ${CMAKE_CURRENT_SOURCE_DIR}/xsc_network.c - ${CMAKE_CURRENT_SOURCE_DIR}/xsc_protocol.c ) define_file_basename_for_sources(mcp_sensors) diff --git a/mcp/sensors/acs.c b/mcp/sensors/acs.c index 7e7d69e86..68efef330 100644 --- a/mcp/sensors/acs.c +++ b/mcp/sensors/acs.c @@ -804,315 +804,6 @@ static inline channel_t* get_xsc_channel(const char *m_field, int m_which) } -/** - * @brief Stores the 5Hz star camera data to the frame - * - * @param m_which which star camera to store data from - */ -void store_5hz_xsc(int m_which) -{ - static bool firsttime[2] = {true, true}; - static channel_t* address_xN_point_az[2]; - static channel_t* address_xN_point_el[2]; - static channel_t* address_xN_point_var[2]; - static channel_t* address_xN_point_sigma[2]; - - int i_point = GETREADINDEX(point_index); - - if (firsttime[m_which]) { - firsttime[m_which] = false; - address_xN_point_az[m_which] = get_xsc_channel("point_az" , m_which); - address_xN_point_el[m_which] = get_xsc_channel("point_el" , m_which); - address_xN_point_var[m_which] = get_xsc_channel("point_var" , m_which); - address_xN_point_sigma[m_which] = get_xsc_channel("point_sigma" , m_which); - } - SET_SCALED_VALUE(address_xN_point_az[m_which] , PointingData[i_point].xsc_az[m_which]); - SET_SCALED_VALUE(address_xN_point_el[m_which] , PointingData[i_point].xsc_el[m_which]); - SET_SCALED_VALUE(address_xN_point_var[m_which] , PointingData[i_point].xsc_var[m_which]); - SET_SCALED_VALUE(address_xN_point_sigma[m_which] , PointingData[i_point].xsc_sigma[m_which]); -} - - -/** - * @brief Stores the 1Hz camera data to the frame - * - * @param m_which which star camera to store data from - */ -void store_1hz_xsc(int m_which) -{ - static bool firsttime[2] = {true, true}; - - static channel_t* address_xN_point_az_raw[2]; - static channel_t* address_xN_point_el_raw[2]; - static channel_t* address_xN_point_az_trim[2]; - static channel_t* address_xN_point_el_trim[2]; - static channel_t* address_xN_cd_robust_mode[2]; -// static channel_t* address_xN_num_images_saved[2]; - - static channel_t* address_xN_last_trig_lat; - static channel_t* address_xN_last_trig_lst; - - static channel_t *address_xN_hk_temp_lens[2]; - static channel_t *address_xN_hk_temp_comp[2]; - static channel_t *address_xN_hk_temp_plate[2]; - static channel_t *address_xN_hk_temp_flange[2]; - static channel_t *address_xN_hk_pressure[2]; - static channel_t *address_xN_hk_disk[2]; - - static channel_t *address_xN_image_eq_valid[2]; - static channel_t *address_xN_cam_gain_valid[2]; - static channel_t *address_xN_image_hor_valid[2]; - static channel_t *address_xN_image_afocus_metric_valid[2]; - - static channel_t *address_xN_stars_run_time[2]; - static channel_t *address_xN_cam_gain_db[2]; - static channel_t *address_xN_lens_focus[2]; - static channel_t *address_xN_lens_aperture[2]; - - static channel_t *address_xN_image_num_exposures[2]; - static channel_t *address_xN_image_stats_mean[2]; - static channel_t *address_xN_image_stats_noise[2]; - static channel_t *address_xN_image_stats_gaindb[2]; - static channel_t *address_xN_image_stats_num_px_sat[2]; - static channel_t *address_xN_image_stats_frac_px_sat[2]; - static channel_t *address_xN_image_afocus_metric[2]; - - static channel_t *address_xN_image_eq_iplate[2]; - static channel_t *address_xN_image_hor_iplate[2]; - - static channel_t *address_xN_image_eq_ra[2]; - static channel_t *address_xN_image_eq_dec[2]; - static channel_t *address_xN_image_eq_roll[2]; - static channel_t *address_xN_image_eq_sigma_ra[2]; - static channel_t *address_xN_image_eq_sigma_dec[2]; - static channel_t *address_xN_image_eq_sigma_roll[2]; - static channel_t *address_xN_image_eq_sigma_pointing[2]; - static channel_t *address_xN_image_hor_az[2]; - static channel_t *address_xN_image_hor_el[2]; - static channel_t *address_xN_image_hor_roll[2]; - static channel_t *address_xN_image_hor_sigma_az[2]; - static channel_t *address_xN_image_hor_sigma_el[2]; - static channel_t *address_xN_image_hor_sigma_roll[2]; - static channel_t *address_xN_image_hor_sigma_pointing[2]; - - static channel_t *address_xN_image_num_blobs_found[2]; - static channel_t *address_xN_image_num_blobs_matched[2]; - - if (firsttime[m_which]) { - firsttime[m_which] = false; - - address_xN_image_num_blobs_found[m_which] = get_xsc_channel("image_num_blobs_found", m_which); - address_xN_image_num_blobs_matched[m_which] = get_xsc_channel("image_num_blobs_matched", m_which); - - address_xN_hk_temp_lens[m_which] = get_xsc_channel("hk_temp_lens", m_which); - address_xN_hk_temp_comp[m_which] = get_xsc_channel("hk_temp_comp", m_which); - address_xN_hk_temp_plate[m_which] = get_xsc_channel("hk_temp_plate", m_which); - address_xN_hk_temp_flange[m_which] = get_xsc_channel("hk_temp_flange", m_which); - address_xN_hk_pressure[m_which] = get_xsc_channel("hk_pressure", m_which); - address_xN_hk_disk[m_which] = get_xsc_channel("hk_disk", m_which); - - address_xN_image_eq_valid[m_which] = get_xsc_channel("image_eq_valid", m_which); - address_xN_cam_gain_valid[m_which] = get_xsc_channel("cam_gain_valid", m_which); - address_xN_image_hor_valid[m_which] = get_xsc_channel("image_hor_valid", m_which); - address_xN_image_afocus_metric_valid[m_which] = get_xsc_channel("image_afocus_metric_valid", m_which); - - address_xN_stars_run_time[m_which] = get_xsc_channel("stars_run_time", m_which); - address_xN_cam_gain_db[m_which] = get_xsc_channel("cam_gain_db", m_which); - address_xN_lens_focus[m_which] = get_xsc_channel("lens_focus", m_which); - address_xN_lens_aperture[m_which] = get_xsc_channel("lens_aperture", m_which); - - address_xN_image_num_exposures[m_which] = get_xsc_channel("image_num_exposures", m_which); - address_xN_image_stats_mean[m_which] = get_xsc_channel("image_stats_mean", m_which); - address_xN_image_stats_noise[m_which] = get_xsc_channel("image_stats_noise", m_which); - address_xN_image_stats_gaindb[m_which] = get_xsc_channel("image_stats_gaindb", m_which); - address_xN_image_stats_num_px_sat[m_which] = get_xsc_channel("image_stats_num_px_sat", m_which); - address_xN_image_stats_frac_px_sat[m_which] = get_xsc_channel("image_stats_frac_px_sat", m_which); - address_xN_image_afocus_metric[m_which] = get_xsc_channel("image_afocus_metric", m_which); - - address_xN_image_eq_iplate[m_which] = get_xsc_channel("image_eq_iplate", m_which); - address_xN_image_hor_iplate[m_which] = get_xsc_channel("image_hor_iplate", m_which); - - address_xN_image_eq_ra[m_which] = get_xsc_channel("image_eq_ra", m_which); - address_xN_image_eq_dec[m_which] = get_xsc_channel("image_eq_dec", m_which); - address_xN_image_eq_roll[m_which] = get_xsc_channel("image_eq_roll", m_which); - address_xN_image_eq_sigma_ra[m_which] = get_xsc_channel("image_eq_sigma_ra", m_which); - address_xN_image_eq_sigma_dec[m_which] = get_xsc_channel("image_eq_sigma_dec", m_which); - address_xN_image_eq_sigma_roll[m_which] = get_xsc_channel("image_eq_sigma_roll", m_which); - address_xN_image_eq_sigma_pointing[m_which] = get_xsc_channel("image_eq_sigma_pointing", m_which); - address_xN_image_hor_az[m_which] = get_xsc_channel("image_hor_az", m_which); - address_xN_image_hor_el[m_which] = get_xsc_channel("image_hor_el", m_which); - address_xN_image_hor_roll[m_which] = get_xsc_channel("image_hor_roll", m_which); - address_xN_image_hor_sigma_az[m_which] = get_xsc_channel("image_hor_sigma_az", m_which); - address_xN_image_hor_sigma_el[m_which] = get_xsc_channel("image_hor_sigma_el", m_which); - address_xN_image_hor_sigma_roll[m_which] = get_xsc_channel("image_hor_sigma_roll", m_which); - address_xN_image_hor_sigma_pointing[m_which] = get_xsc_channel("image_hor_sigma_pointing", m_which); - - address_xN_point_az_raw[m_which] = get_xsc_channel("point_az_raw" , m_which); - address_xN_point_el_raw[m_which] = get_xsc_channel("point_el_raw" , m_which); - address_xN_point_az_trim[m_which] = get_xsc_channel("point_az_trim" , m_which); - address_xN_point_el_trim[m_which] = get_xsc_channel("point_el_trim" , m_which); - address_xN_cd_robust_mode[m_which] = get_xsc_channel("cd_robust_mode" , m_which); -// address_xN_num_images_saved[m_which] = get_xsc_channel("num_images_saved" , m_which); - if (m_which == 0) { - address_xN_last_trig_lat = get_xsc_channel("last_trig_lat" , 0); - address_xN_last_trig_lst = get_xsc_channel("last_trig_lst" , 0); - } - } - - SET_SCALED_VALUE(address_xN_image_num_blobs_found[m_which], - XSC_SERVER_DATA(m_which).channels.image_num_blobs_found); - SET_SCALED_VALUE(address_xN_image_num_blobs_matched[m_which], - XSC_SERVER_DATA(m_which).channels.image_num_blobs_matched); - - SET_SCALED_VALUE(address_xN_hk_temp_lens[m_which], XSC_SERVER_DATA(m_which).channels.hk_temp_lens); - SET_SCALED_VALUE(address_xN_hk_temp_comp[m_which], XSC_SERVER_DATA(m_which).channels.hk_temp_comp); - SET_SCALED_VALUE(address_xN_hk_temp_plate[m_which], XSC_SERVER_DATA(m_which).channels.hk_temp_plate); - SET_SCALED_VALUE(address_xN_hk_temp_flange[m_which], XSC_SERVER_DATA(m_which).channels.hk_temp_flange); - SET_SCALED_VALUE(address_xN_hk_pressure[m_which], XSC_SERVER_DATA(m_which).channels.hk_pressure); - SET_SCALED_VALUE(address_xN_hk_disk[m_which], XSC_SERVER_DATA(m_which).channels.hk_disk); - - SET_SCALED_VALUE(address_xN_image_eq_valid[m_which], XSC_SERVER_DATA(m_which).channels.image_eq_valid); - SET_SCALED_VALUE(address_xN_cam_gain_valid[m_which], XSC_SERVER_DATA(m_which).channels.cam_gain_valid); - SET_SCALED_VALUE(address_xN_image_hor_valid[m_which], XSC_SERVER_DATA(m_which).channels.image_hor_valid); - SET_SCALED_VALUE(address_xN_image_afocus_metric_valid[m_which], - XSC_SERVER_DATA(m_which).channels.image_afocus_metric_valid); - - SET_SCALED_VALUE(address_xN_stars_run_time[m_which], XSC_SERVER_DATA(m_which).channels.stars_run_time); - SET_SCALED_VALUE(address_xN_cam_gain_db[m_which], XSC_SERVER_DATA(m_which).channels.cam_gain_db); - SET_SCALED_VALUE(address_xN_lens_focus[m_which], XSC_SERVER_DATA(m_which).channels.lens_focus); - SET_SCALED_VALUE(address_xN_lens_aperture[m_which], XSC_SERVER_DATA(m_which).channels.lens_aperture); - - SET_SCALED_VALUE(address_xN_image_num_exposures[m_which], XSC_SERVER_DATA(m_which).channels.image_num_exposures); - SET_SCALED_VALUE(address_xN_image_stats_mean[m_which], XSC_SERVER_DATA(m_which).channels.image_stats_mean); - SET_SCALED_VALUE(address_xN_image_stats_noise[m_which], XSC_SERVER_DATA(m_which).channels.image_stats_noise); - SET_SCALED_VALUE(address_xN_image_stats_gaindb[m_which], XSC_SERVER_DATA(m_which).channels.image_stats_gaindb); - SET_SCALED_VALUE(address_xN_image_stats_num_px_sat[m_which], - XSC_SERVER_DATA(m_which).channels.image_stats_num_px_sat); - SET_SCALED_VALUE(address_xN_image_stats_frac_px_sat[m_which], - XSC_SERVER_DATA(m_which).channels.image_stats_frac_px_sat); - SET_SCALED_VALUE(address_xN_image_afocus_metric[m_which], XSC_SERVER_DATA(m_which).channels.image_afocus_metric); - - SET_SCALED_VALUE(address_xN_image_eq_iplate[m_which], XSC_SERVER_DATA(m_which).channels.image_eq_iplate); - SET_SCALED_VALUE(address_xN_image_hor_iplate[m_which], XSC_SERVER_DATA(m_which).channels.image_hor_iplate); - - SET_SCALED_VALUE(address_xN_image_eq_ra[m_which], XSC_SERVER_DATA(m_which).channels.image_eq_ra); - SET_SCALED_VALUE(address_xN_image_eq_dec[m_which], XSC_SERVER_DATA(m_which).channels.image_eq_dec); - SET_SCALED_VALUE(address_xN_image_eq_roll[m_which], XSC_SERVER_DATA(m_which).channels.image_eq_roll); - SET_SCALED_VALUE(address_xN_image_eq_sigma_ra[m_which], XSC_SERVER_DATA(m_which).channels.image_eq_sigma_ra); - SET_SCALED_VALUE(address_xN_image_eq_sigma_dec[m_which], XSC_SERVER_DATA(m_which).channels.image_eq_sigma_dec); - SET_SCALED_VALUE(address_xN_image_eq_sigma_roll[m_which], XSC_SERVER_DATA(m_which).channels.image_eq_sigma_roll); - SET_SCALED_VALUE(address_xN_image_eq_sigma_pointing[m_which], - XSC_SERVER_DATA(m_which).channels.image_eq_sigma_pointing); - SET_SCALED_VALUE(address_xN_image_hor_az[m_which], XSC_SERVER_DATA(m_which).channels.image_hor_az); - SET_SCALED_VALUE(address_xN_image_hor_el[m_which], XSC_SERVER_DATA(m_which).channels.image_hor_el); - SET_SCALED_VALUE(address_xN_image_hor_roll[m_which], XSC_SERVER_DATA(m_which).channels.image_hor_roll); - SET_SCALED_VALUE(address_xN_image_hor_sigma_az[m_which], XSC_SERVER_DATA(m_which).channels.image_hor_sigma_az); - SET_SCALED_VALUE(address_xN_image_hor_sigma_el[m_which], XSC_SERVER_DATA(m_which).channels.image_hor_sigma_el); - SET_SCALED_VALUE(address_xN_image_hor_sigma_roll[m_which], XSC_SERVER_DATA(m_which).channels.image_hor_sigma_roll); - SET_SCALED_VALUE(address_xN_image_hor_sigma_pointing[m_which], - XSC_SERVER_DATA(m_which).channels.image_hor_sigma_pointing); - - SET_SCALED_VALUE(address_xN_point_az_raw[m_which] , xsc_pointing_state[m_which].az); - SET_SCALED_VALUE(address_xN_point_el_raw[m_which] , xsc_pointing_state[m_which].el); - SET_SCALED_VALUE(address_xN_point_az_trim[m_which], CommandData.XSC[m_which].cross_el_trim); - SET_SCALED_VALUE(address_xN_point_el_trim[m_which], CommandData.XSC[m_which].el_trim); - SET_SCALED_VALUE(address_xN_cd_robust_mode[m_which], CommandData.XSC[m_which].net.solver.robust_mode_enabled); - -// SET_SCALED_VALUE(address_xN_num_images_saved[m_which], images_num_saved[m_which]); - if (m_which == 0) { - SET_SCALED_VALUE(address_xN_last_trig_lat , xsc_pointing_state[m_which].last_trigger.lat); - SET_VALUE(address_xN_last_trig_lst , xsc_pointing_state[m_which].last_trigger.lst*SEC2LI); - } -} - - -/** - * @brief Stores the 100Hz star camera data to the frame - * - * @param which which star camera to store the data from - */ -void store_100hz_xsc(int which) -{ - static bool firsttime[2] = {true, true}; - static int last_blob_counter_stars[2] = {-1, -1}; - static int last_blob_i[2] = {1000, 1000}; - static int intermediate_frame_counter[2] = {0, 0}; - - static channel_t* address_xN_ctr_stars[2]; - static channel_t* address_xN_image_ctr_mcp[2]; - static channel_t* address_xN_image_ctr_stars[2]; - - static channel_t* address_xN_ctr_mcp; - static channel_t* address_xN_last_trig_age_cs; - static channel_t* address_xN_last_trig_ctr_mcp; - static channel_t* address_xN_last_trig_ctr_stars[2]; - static channel_t* address_xN_predicted_streaking_px[2]; - static channel_t* address_xN_image_blobn_x[2]; - static channel_t* address_xN_image_blobn_y[2]; - static channel_t* address_xN_image_blobn_flux[2]; - static channel_t* address_xN_image_blobn_peak_to_flux[2]; - - if (firsttime[which]) { - firsttime[which] = false; - - if (which == 0) { - address_xN_ctr_mcp = get_xsc_channel("ctr_mcp", 0); - address_xN_last_trig_age_cs = get_xsc_channel("last_trig_age_cs", 0); - address_xN_last_trig_ctr_mcp = get_xsc_channel("last_trig_ctr_mcp", 0); - } - address_xN_predicted_streaking_px[which] = get_xsc_channel("predicted_streaking_px", which); - address_xN_ctr_stars[which] = get_xsc_channel("ctr_stars", which); - address_xN_image_ctr_stars[which] = get_xsc_channel("image_ctr_stars", which); - address_xN_image_ctr_mcp[which] = get_xsc_channel("image_ctr_mcp", which); - address_xN_last_trig_ctr_stars[which] = get_xsc_channel("last_trig_ctr_stars", which); - address_xN_image_blobn_x[which] = get_xsc_channel("image_blobn_x", which); - address_xN_image_blobn_y[which] = get_xsc_channel("image_blobn_y", which); - address_xN_image_blobn_flux[which] = get_xsc_channel("image_blobn_flux", which); - address_xN_image_blobn_peak_to_flux[which] = get_xsc_channel("image_blobn_peak_to_flux", which); - } - - if (which == 0) { - SET_SCALED_VALUE(address_xN_ctr_mcp, xsc_pointing_state[which].counter_mcp); - SET_SCALED_VALUE(address_xN_last_trig_age_cs, xsc_pointing_state[which].last_trigger.trigger_time); - SET_SCALED_VALUE(address_xN_last_trig_ctr_mcp, xsc_pointing_state[which].last_trigger.counter_mcp); - } - - - SET_SCALED_VALUE(address_xN_predicted_streaking_px[which], xsc_pointing_state[which].predicted_streaking_px); - SET_INT32(address_xN_ctr_stars[which], XSC_SERVER_DATA(which).channels.ctr_stars); - SET_INT32(address_xN_image_ctr_stars[which], XSC_SERVER_DATA(which).channels.image_ctr_stars); - SET_INT32(address_xN_image_ctr_mcp[which], XSC_SERVER_DATA(which).channels.image_ctr_mcp); - SET_SCALED_VALUE(address_xN_last_trig_ctr_stars[which], - xsc_pointing_state[which].last_trigger.counter_stars); - - if (XSC_SERVER_DATA(which).blobs.counter_stars != last_blob_counter_stars[which] && - XSC_SERVER_DATA(which).blobs.counter_stars > 0) { - last_blob_counter_stars[which] = XSC_SERVER_DATA(which).blobs.counter_stars; - last_blob_i[which] = 0; - } - if (intermediate_frame_counter[which] == 0) { - if (last_blob_i[which] < XSC_SERVER_DATA(which).blobs.num_blobs - && last_blob_i[which] < XSC_BLOBS_ARRAY_SIZE) { - SET_SCALED_VALUE(address_xN_image_blobn_x[which], - XSC_SERVER_DATA(which).blobs.blobs[last_blob_i[which]].x); - SET_SCALED_VALUE(address_xN_image_blobn_y[which], - XSC_SERVER_DATA(which).blobs.blobs[last_blob_i[which]].y); - SET_SCALED_VALUE(address_xN_image_blobn_flux[which], - XSC_SERVER_DATA(which).blobs.blobs[last_blob_i[which]].flux); - SET_SCALED_VALUE(address_xN_image_blobn_peak_to_flux[which], - XSC_SERVER_DATA(which).blobs.blobs[last_blob_i[which]].peak_to_flux); - last_blob_i[which]++; - } else if (last_blob_i[which] == XSC_SERVER_DATA(which).blobs.num_blobs) { - SET_SCALED_VALUE(address_xN_image_blobn_x[which], 0); - SET_SCALED_VALUE(address_xN_image_blobn_y[which], 0); - SET_SCALED_VALUE(address_xN_image_blobn_flux[which], 0); - SET_SCALED_VALUE(address_xN_image_blobn_peak_to_flux[which], 0); - } - } - - intermediate_frame_counter[which] = (intermediate_frame_counter[which]+1) % 3; -} - /** * @brief Stores the 5Hz attitude control system (ACS) diff --git a/mcp/sensors/socket_utils.c b/mcp/sensors/socket_utils.c index c51a3cf4b..4ce336867 100644 --- a/mcp/sensors/socket_utils.c +++ b/mcp/sensors/socket_utils.c @@ -1,5 +1,5 @@ /* - * socket_utils.c: + * socket_utils.c: moved from individual files to a superfile that others can access * * This software is copyright (C) 2024 University of Arizona * diff --git a/mcp/tx.c b/mcp/tx.c index fc0648ad2..6fd09ccfe 100644 --- a/mcp/tx.c +++ b/mcp/tx.c @@ -72,8 +72,6 @@ void PhaseControl(void); /* in sched.c */ void DoSched(); -/* in xystage.c */ -// void StoreStageBus(int index); /* this is provided to let the various controls know that we're doing our * initial control writes -- there's no input data yet */ From 65f1a8d1b8510498c4c3e3cb2b3864dc4078dde6 Mon Sep 17 00:00:00 2001 From: Ian Lowe Date: Wed, 15 Jul 2026 11:17:47 -0600 Subject: [PATCH 3/3] fixed error with cached includes that prevents building on git actions --- mcp/mcp.c | 2 -- mcp/pointing/pointing.c | 2 -- mcp/sensors/acs.c | 1 - 3 files changed, 5 deletions(-) diff --git a/mcp/mcp.c b/mcp/mcp.c index 7a86205e4..65e9672b4 100644 --- a/mcp/mcp.c +++ b/mcp/mcp.c @@ -89,8 +89,6 @@ #include "motors.h" #include "store_data.h" #include "watchdog.h" -#include "xsc_network.h" -#include "xsc_pointing.h" #include "sip.h" #include "scheduler_tng.h" #include "inner_frame_power.h" diff --git a/mcp/pointing/pointing.c b/mcp/pointing/pointing.c index 76256fc6d..7653331d3 100644 --- a/mcp/pointing/pointing.c +++ b/mcp/pointing/pointing.c @@ -55,8 +55,6 @@ #include "geomag.h" #include "angles.h" #include "framing.h" -#include "xsc_network.h" -#include "xsc_pointing.h" #include "star_camera_solutions.h" #include "star_camera_trigger.h" #include "conversions.h" diff --git a/mcp/sensors/acs.c b/mcp/sensors/acs.c index 68efef330..4a7ec91cd 100644 --- a/mcp/sensors/acs.c +++ b/mcp/sensors/acs.c @@ -43,7 +43,6 @@ #include "sip.h" #include "tim_gps.h" #include "csbf_dgps.h" -#include "xsc_network.h" #define MAG_ACS_CONV_FACTOR 15000.0