More tracking fixes

This commit is contained in:
Aang23 2023-07-20 16:36:16 +02:00
parent cb65ec1e9a
commit 6bec87d69f
3 changed files with 58 additions and 9 deletions

View file

@ -167,6 +167,9 @@ namespace satdump
bool update_global = false;
if (backend_needs_update)
style::beginDisabled();
ImGui::SetNextItemWidth(ImGui::GetWindowContentRegionWidth());
if (horizons_mode)
update_global = update_global || ImGui::Combo("###horizonsselectcombo", &current_horizons, horizonsoptionstr.c_str());
@ -191,19 +194,25 @@ namespace satdump
ImGui::EndTable();
}
if (backend_needs_update)
style::endDisabled();
if (update_global)
backend_needs_update = true;
if (ImGui::BeginTable("##trackingwidgettable", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg))
{
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::Text("Azimuth");
ImGui::TableSetColumnIndex(1);
ImGui::Text("%.2f", current_az);
ImGui::Text("%.3f", current_az);
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::Text("Elevation");
ImGui::TableSetColumnIndex(1);
ImGui::Text("%.2f", current_el);
ImGui::Text("%.3f", current_el);
if (next_aos_time != 0 && next_los_time != 0)
{
@ -248,22 +257,44 @@ namespace satdump
ImGui::EndTable();
}
backend_needs_update = update_global;
ImGui::Spacing();
//////////////////
ImGui::Separator();
ImGui::Spacing();
if (ImGui::BeginTable("##trackingwidgettable", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg))
{
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::Text("Rot Az");
ImGui::TableSetColumnIndex(1);
ImGui::Text("Rot El");
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::InputFloat("##Rot Az", &current_req_rotator_az);
ImGui::TableSetColumnIndex(1);
ImGui::InputFloat("##Rot El", &current_req_rotator_el);
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::Text("%.3f", current_rotator_az);
ImGui::TableSetColumnIndex(1);
ImGui::Text("%.3f", current_rotator_el);
ImGui::EndTable();
}
ImGui::InputFloat("Rot Az", &current_req_rotator_az);
ImGui::InputFloat("Rot El", &current_req_rotator_el);
ImGui::Checkbox("Engage", &rotator_engaged);
ImGui::SameLine();
ImGui::Checkbox("Track", &rotator_tracking);
ImGui::Separator();
rotctld_client.render();
ImGui::Spacing();
// tle_update_mutex.unlock();

View file

@ -25,7 +25,6 @@ namespace satdump
predict_position satellite_orbit;
predict_observer_t *observer_station;
predict_observation observation_pos;
double next_aos_time, next_los_time;
std::string satoptionstr;
int current_satellite = 0;
@ -62,6 +61,10 @@ namespace satdump
std::vector<std::pair<float, float>> upcoming_pass_points;
void updateNextPass();
double next_aos_time, next_los_time;
float next_aos_az = 0, next_aos_el = 0;
private: // Rotator control
bool rotator_engaged = false;
bool rotator_tracking = false;

View file

@ -122,6 +122,8 @@ namespace satdump
if (horizons_data[i].el <= 0)
{
next_aos_time = horizons_data[i].timestamp;
next_aos_az = horizons_data[i].az;
next_aos_el = horizons_data[i].el;
break;
}
}
@ -143,6 +145,8 @@ namespace satdump
if (horizons_data[i].el > 0)
{
next_aos_time = horizons_data[i].timestamp;
next_aos_az = horizons_data[i].az;
next_aos_el = horizons_data[i].el;
aos_iter = i;
break;
}
@ -200,6 +204,9 @@ namespace satdump
next_los_time = predict_from_julian(next_los.time);
next_aos_time = predict_from_julian(next_aos.time);
next_aos_az = next_aos.azimuth * RAD_TO_DEG;
next_aos_el = next_aos.elevation * RAD_TO_DEG;
// Calculate a few points during the pass
predict_position satellite_orbit2;
predict_observation observation_pos2;
@ -310,8 +317,16 @@ namespace satdump
{
if (rotator_tracking)
{
current_req_rotator_az = current_az;
current_req_rotator_el = current_el;
if (current_el > 0)
{
current_req_rotator_az = current_az;
current_req_rotator_el = current_el;
}
else
{
current_req_rotator_az = next_aos_az;
current_req_rotator_el = next_aos_el;
}
}
if (current_req_rotator_el < 0)