added legacy gpr

This commit is contained in:
Ayzen
2026-05-06 11:54:59 +03:00
parent e86f30023e
commit 1b7d9e417d
16 changed files with 2697 additions and 1335 deletions
@@ -13,6 +13,12 @@ enum class HistoryCommand {
ClearAll,
};
enum class GprAlgorithm {
Backprojection,
LegacyPoint,
LegacyExtended,
};
struct ProcessingLiveConfig {
std::string processor_mode = "pass_through";
std::string pass_through_channel = "s21";
@@ -26,12 +32,18 @@ struct ProcessingLiveConfig {
float bscan_gain = 1.0F;
float bscan_start_freq_mhz = 100.0F;
float bscan_stop_freq_mhz = 8800.0F;
GprAlgorithm gpr_algorithm = GprAlgorithm::Backprojection;
std::vector<std::uint32_t> gpr_input_positions{};
std::vector<std::uint32_t> gpr_output_positions{};
float gpr_min_depth_m = 2.0F;
float gpr_max_depth_m = 14.0F;
float gpr_range_comp_power = 0.28F;
float gpr_angle_comp_power = 0.10F;
float gpr_comp_power = 0.2F;
float gpr_speed_m_s = 0.0F;
float gpr_look_angle_deg = 0.0F;
float gpr_snr_thresh = 4.5F;
float gpr_snr_comp_max = 25.0F;
float gpr_start_freq_mhz = 3000.0F;
float gpr_stop_freq_mhz = 6000.0F;
bool gpr_background_subtract_enabled = true;
@@ -31,6 +31,21 @@ using Json = nlohmann::json;
throw std::runtime_error("processing.history_command must be one of: none, remove_last, clear_all");
}
[[nodiscard]] auto parse_gpr_algorithm(const std::string& value) -> GprAlgorithm {
if (value == "backprojection") {
return GprAlgorithm::Backprojection;
}
if (value == "legacy_point") {
return GprAlgorithm::LegacyPoint;
}
if (value == "legacy_extended") {
return GprAlgorithm::LegacyExtended;
}
throw std::runtime_error(
"processing.gpr_algorithm must be one of: backprojection, legacy_point, legacy_extended"
);
}
[[nodiscard]] auto parse_s_parameter_channel(const std::string& value, const std::string& field_name) -> std::string {
if (value == "s21" || value == "s11") {
return value;
@@ -164,6 +179,12 @@ using Json = nlohmann::json;
}
config.bscan_stop_freq_mhz = static_cast<float>(found->get<double>());
}
if (const auto found = root.find("gpr_algorithm"); found != root.end()) {
if (!found->is_string()) {
throw std::runtime_error("processing.gpr_algorithm must be string");
}
config.gpr_algorithm = parse_gpr_algorithm(found->get<std::string>());
}
if (const auto found = root.find("gpr_input_positions"); found != root.end()) {
config.gpr_input_positions = parse_u32_array(*found, "processing.gpr_input_positions");
}
@@ -194,6 +215,36 @@ using Json = nlohmann::json;
}
config.gpr_angle_comp_power = static_cast<float>(found->get<double>());
}
if (const auto found = root.find("gpr_comp_power"); found != root.end()) {
if (!found->is_number()) {
throw std::runtime_error("processing.gpr_comp_power must be number");
}
config.gpr_comp_power = static_cast<float>(found->get<double>());
}
if (const auto found = root.find("gpr_speed_m_s"); found != root.end()) {
if (!found->is_number()) {
throw std::runtime_error("processing.gpr_speed_m_s must be number");
}
config.gpr_speed_m_s = static_cast<float>(found->get<double>());
}
if (const auto found = root.find("gpr_look_angle_deg"); found != root.end()) {
if (!found->is_number()) {
throw std::runtime_error("processing.gpr_look_angle_deg must be number");
}
config.gpr_look_angle_deg = static_cast<float>(found->get<double>());
}
if (const auto found = root.find("gpr_snr_thresh"); found != root.end()) {
if (!found->is_number()) {
throw std::runtime_error("processing.gpr_snr_thresh must be number");
}
config.gpr_snr_thresh = static_cast<float>(found->get<double>());
}
if (const auto found = root.find("gpr_snr_comp_max"); found != root.end()) {
if (!found->is_number()) {
throw std::runtime_error("processing.gpr_snr_comp_max must be number");
}
config.gpr_snr_comp_max = static_cast<float>(found->get<double>());
}
if (const auto found = root.find("gpr_start_freq_mhz"); found != root.end()) {
if (!found->is_number()) {
throw std::runtime_error("processing.gpr_start_freq_mhz must be number");