2021-03-07 12:46:25 +01:00
|
|
|
/**********************************************************************
|
2022-03-20 20:56:32 +01:00
|
|
|
* This file is used for testing random stuff without running the
|
2021-03-07 12:46:25 +01:00
|
|
|
* whole of SatDump, which comes in handy for debugging individual
|
|
|
|
|
* elements before putting them all together in modules...
|
2022-03-20 20:56:32 +01:00
|
|
|
*
|
|
|
|
|
* If you are an user, ignore this file which will not be built by
|
2021-05-12 21:16:53 +02:00
|
|
|
* default, and if you're a developper in need of doing stuff here...
|
2021-03-07 12:46:25 +01:00
|
|
|
* Go ahead!
|
2022-03-20 20:56:32 +01:00
|
|
|
*
|
2021-03-07 12:46:25 +01:00
|
|
|
* Don't judge the code you might see in there! :)
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
2023-10-11 00:54:06 +02:00
|
|
|
#include "init.h"
|
2022-03-28 11:51:13 +02:00
|
|
|
#include "logger.h"
|
2023-10-11 00:54:06 +02:00
|
|
|
#include "common/tracking/tle.h"
|
|
|
|
|
#include "libs/predict/predict.h"
|
|
|
|
|
#include "common/geodetic/geodetic_coordinates.h"
|
|
|
|
|
#include "common/geodetic/euler_raytrace.h"
|
|
|
|
|
#include <unistd.h>
|
2023-09-07 08:37:08 +02:00
|
|
|
|
2023-09-08 22:47:06 +02:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
initLogger();
|
2023-10-11 00:54:06 +02:00
|
|
|
|
|
|
|
|
// We don't wanna spam with init this time around
|
|
|
|
|
logger->set_level(slog::LOG_OFF);
|
|
|
|
|
satdump::initSatdump();
|
|
|
|
|
logger->set_level(slog::LOG_TRACE);
|
|
|
|
|
|
|
|
|
|
predict_orbital_elements_t *satellite_object;
|
|
|
|
|
predict_position satellite_orbit;
|
|
|
|
|
|
|
|
|
|
auto tle = satdump::general_tle_registry.get_from_norad(40069).value();
|
|
|
|
|
|
|
|
|
|
satellite_object = predict_parse_tle(tle.line1.c_str(), tle.line2.c_str());
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
time_t utc_time = time(0);
|
|
|
|
|
|
|
|
|
|
auto utc_jul = predict_to_julian_double(utc_time);
|
|
|
|
|
predict_orbit(satellite_object, &satellite_orbit, utc_jul);
|
|
|
|
|
|
|
|
|
|
auto position = geodetic::geodetic_coords_t(satellite_orbit.latitude, satellite_orbit.longitude, satellite_orbit.altitude, true).toDegs();
|
|
|
|
|
|
|
|
|
|
geodetic::geodetic_coords_t earth_point, earth_point2;
|
|
|
|
|
|
2023-10-11 13:54:14 +02:00
|
|
|
geodetic::raytrace_to_earth_old(position, {50, 0, 0}, earth_point);
|
2023-10-11 00:54:06 +02:00
|
|
|
earth_point.toDegs();
|
|
|
|
|
|
2023-10-11 13:54:14 +02:00
|
|
|
geodetic::raytrace_to_earth(utc_jul, satellite_orbit.position, satellite_orbit.velocity, {50, 0, 0}, earth_point2);
|
2023-10-11 00:54:06 +02:00
|
|
|
|
|
|
|
|
logger->info("%f %f ---- %f %f ---- %f %f",
|
|
|
|
|
position.lon, position.lat,
|
|
|
|
|
earth_point.lon, earth_point.lat,
|
|
|
|
|
earth_point2.lon, earth_point2.lat);
|
|
|
|
|
|
|
|
|
|
sleep(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
predict_destroy_orbital_elements(satellite_object);
|
2023-07-23 23:13:13 +02:00
|
|
|
}
|