mirror of
https://github.com/SatDump/SatDump
synced 2026-08-13 17:47:30 -04:00
More tracking work, pull all Horizons objects
This commit is contained in:
parent
f62de15079
commit
03ace46bb7
3 changed files with 109 additions and 12 deletions
|
|
@ -28,13 +28,10 @@ namespace satdump
|
|||
has_tle = true;
|
||||
|
||||
for (auto &tle : general_tle_registry)
|
||||
satoptionstr += tle.name + '\0';
|
||||
satoptions.push_back(tle.name);
|
||||
|
||||
observer_station = predict_create_observer("Main", qth_lat * DEG_TO_RAD, qth_lon * DEG_TO_RAD, qth_alt);
|
||||
|
||||
for (auto &hid : horizons_ids)
|
||||
horizonsoptionstr += hid + '\0';
|
||||
|
||||
// Updates on registry updates
|
||||
eventBus->register_handler<TLEsUpdatedEvent>([this](TLEsUpdatedEvent)
|
||||
{
|
||||
|
|
@ -43,9 +40,9 @@ namespace satdump
|
|||
if (general_tle_registry.size() > 0)
|
||||
has_tle = true;
|
||||
|
||||
satoptionstr = "";
|
||||
satoptions.clear();
|
||||
for (auto &tle : general_tle_registry)
|
||||
satoptionstr += tle.name + '\0';
|
||||
satoptions.push_back(tle.name);
|
||||
|
||||
tle_update_mutex.unlock(); });
|
||||
|
||||
|
|
@ -176,9 +173,49 @@ namespace satdump
|
|||
|
||||
ImGui::SetNextItemWidth(ImGui::GetWindowContentRegionWidth());
|
||||
if (horizons_mode)
|
||||
update_global = update_global || ImGui::Combo("###horizonsselectcombo", ¤t_horizons, horizonsoptionstr.c_str());
|
||||
{
|
||||
if (ImGui::BeginCombo("###horizonsselectcombo", horizonsoptions[current_horizons].second.c_str()))
|
||||
{
|
||||
ImGui::InputTextWithHint("##horizonssatellitetracking", u8"\uf422 Search", &horizonssearchstr);
|
||||
for (int i = 0; i < horizonsoptions.size(); i++)
|
||||
{
|
||||
bool show = true;
|
||||
if (horizonssearchstr.size() != 0)
|
||||
show = isStringPresent(horizonsoptions[i].second, horizonssearchstr);
|
||||
if (show)
|
||||
{
|
||||
if (ImGui::Selectable(horizonsoptions[i].second.c_str(), i == current_horizons))
|
||||
{
|
||||
current_horizons = i;
|
||||
update_global = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
}
|
||||
else
|
||||
update_global = update_global || ImGui::Combo("###satelliteselectcombo", ¤t_satellite, satoptionstr.c_str());
|
||||
{
|
||||
if (ImGui::BeginCombo("###satelliteselectcombo", satoptions[current_satellite].c_str()))
|
||||
{
|
||||
ImGui::InputTextWithHint("##searchsatellitetracking", u8"\uf422 Search", &satsearchstr);
|
||||
for (int i = 0; i < satoptions.size(); i++)
|
||||
{
|
||||
bool show = true;
|
||||
if (satsearchstr.size() != 0)
|
||||
show = isStringPresent(satoptions[i], satsearchstr);
|
||||
if (show)
|
||||
{
|
||||
if (ImGui::Selectable(satoptions[i].c_str(), i == current_satellite))
|
||||
{
|
||||
current_satellite = i;
|
||||
update_global = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::BeginTable("##trackingradiotable", 2, NULL))
|
||||
{
|
||||
|
|
@ -192,6 +229,8 @@ namespace satdump
|
|||
ImGui::TableSetColumnIndex(1);
|
||||
if (ImGui::RadioButton("Horizons", horizons_mode))
|
||||
{
|
||||
if (horizonsoptions.size() == 1)
|
||||
horizonsoptions = pullHorizonsList();
|
||||
horizons_mode = true;
|
||||
update_global = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,9 @@ namespace satdump
|
|||
predict_observer_t *observer_station;
|
||||
predict_observation observation_pos;
|
||||
|
||||
std::string satoptionstr;
|
||||
std::vector<std::string> satoptions;
|
||||
int current_satellite = 0;
|
||||
std::string satsearchstr;
|
||||
|
||||
double getTime();
|
||||
|
||||
|
|
@ -40,10 +41,12 @@ namespace satdump
|
|||
float az, el;
|
||||
};
|
||||
|
||||
std::vector<std::string> horizons_ids = {"STEREO-A", "STEREO-B", "JUICE", "JWST", "SOHO", "Sun", "CH-3", "New Horizons"};
|
||||
std::string horizonsoptionstr;
|
||||
std::vector<std::pair<int, std::string>> horizonsoptions = {{-234, "STEREO-A"}};
|
||||
int current_horizons = 0;
|
||||
std::vector<HorizonsV> horizons_data;
|
||||
std::string horizonssearchstr;
|
||||
|
||||
std::vector<std::pair<int, std::string>> pullHorizonsList();
|
||||
|
||||
void loadHorizons();
|
||||
|
||||
|
|
|
|||
|
|
@ -187,7 +187,11 @@ namespace satdump
|
|||
else
|
||||
{
|
||||
if (predict_is_geosynchronous(satellite_object))
|
||||
{
|
||||
next_aos_time = 0;
|
||||
next_los_time = std::numeric_limits<double>::max();
|
||||
return;
|
||||
}
|
||||
|
||||
upcoming_passes_mtx.lock();
|
||||
|
||||
|
|
@ -237,7 +241,7 @@ namespace satdump
|
|||
std::string cmd = (std::string) "https://ssd.jpl.nasa.gov/api/horizons.api?format=text" +
|
||||
"&OBJ_DATA=NO" +
|
||||
"&MAKE_EPHEM=YES" +
|
||||
"&COMMAND=" + horizons_ids[current_horizons] +
|
||||
"&COMMAND=" + std::to_string(horizonsoptions[current_horizons].first) +
|
||||
"&CAL_FORMAT=JD" +
|
||||
"&EPHEM_TYPE=OBSERVER" +
|
||||
"&CENTER='coord@399'" +
|
||||
|
|
@ -308,6 +312,56 @@ namespace satdump
|
|||
logger->trace("Done pulling Horizons data...");
|
||||
}
|
||||
|
||||
std::vector<std::pair<int, std::string>> TrackingWidget::pullHorizonsList()
|
||||
{
|
||||
std::vector<std::pair<int, std::string>> vv;
|
||||
|
||||
logger->trace("Pulling object list from Horizons...");
|
||||
|
||||
std::string url = "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND='*'";
|
||||
std::string req_result;
|
||||
perform_http_request(url, req_result);
|
||||
|
||||
std::istringstream req_results(req_result);
|
||||
std::string line;
|
||||
|
||||
bool got_start = false;
|
||||
while (getline(req_results, line))
|
||||
{
|
||||
if (line.find(" ------- ---------------------------------- ----------- ------------------- ") != std::string::npos)
|
||||
{
|
||||
got_start = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!got_start)
|
||||
continue;
|
||||
|
||||
try
|
||||
{
|
||||
std::string numid = line.substr(0, 9);
|
||||
std::string name = line.substr(11, 35);
|
||||
std::string desig = line.substr(45, 13);
|
||||
std::string iauo = line.substr(59, 21);
|
||||
|
||||
int id = std::stoi(numid);
|
||||
|
||||
bool is_valid = false;
|
||||
for (auto &c : name)
|
||||
if (c != ' ')
|
||||
is_valid = true;
|
||||
|
||||
if (is_valid && name.find("simulation") == std::string::npos)
|
||||
vv.push_back({id, name});
|
||||
}
|
||||
catch (std::exception &e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return vv;
|
||||
}
|
||||
|
||||
void TrackingWidget::updateRotator()
|
||||
{
|
||||
// logger->info("Rot update!");
|
||||
|
|
@ -338,4 +392,5 @@ namespace satdump
|
|||
logger->error("Error setting rotator position %f %f!", current_req_rotator_az, current_req_rotator_el);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue