From a43acae9ffb633fb240da6d8edbe210fd45011eb Mon Sep 17 00:00:00 2001 From: Daniel Warner Date: Sun, 13 Nov 2022 11:09:27 +0000 Subject: [PATCH] Resolve #19 (#26) Co-authored-by: Dan Warner --- libsgp4/CoordGeodetic.h | 5 ++ libsgp4/CoordTopocentric.h | 5 ++ libsgp4/DateTime.cc | 8 ++-- libsgp4/DateTime.h | 4 ++ libsgp4/DecayedException.h | 5 ++ libsgp4/Eci.cc | 7 ++- libsgp4/Eci.h | 5 ++ libsgp4/Globals.h | 6 ++- libsgp4/Observer.cc | 6 ++- libsgp4/Observer.h | 6 ++- libsgp4/OrbitalElements.cc | 4 ++ libsgp4/OrbitalElements.h | 5 ++ libsgp4/SGP4.cc | 5 ++ libsgp4/SGP4.h | 5 ++ libsgp4/SatelliteException.h | 5 ++ libsgp4/SolarPosition.cc | 5 ++ libsgp4/SolarPosition.h | 5 ++ libsgp4/TimeSpan.h | 5 ++ libsgp4/Tle.cc | 6 ++- libsgp4/Tle.h | 5 ++ libsgp4/TleException.h | 5 ++ libsgp4/Util.cc | 5 +- libsgp4/Util.h | 10 ++-- libsgp4/Vector.h | 5 ++ passpredict/passpredict.cc | 89 ++++++++++++++++++------------------ runtest/runtest.cc | 34 +++++++------- sattrack/sattrack.cc | 14 +++--- 27 files changed, 187 insertions(+), 82 deletions(-) diff --git a/libsgp4/CoordGeodetic.h b/libsgp4/CoordGeodetic.h index 8ab7d8c..9b4127e 100644 --- a/libsgp4/CoordGeodetic.h +++ b/libsgp4/CoordGeodetic.h @@ -24,6 +24,9 @@ #include #include +namespace libsgp4 +{ + /** * @brief Stores a geodetic location (latitude, longitude, altitude). * @@ -126,4 +129,6 @@ inline std::ostream& operator<<(std::ostream& strm, const CoordGeodetic& g) return strm << g.ToString(); } +} // namespace libsgp4 + #endif diff --git a/libsgp4/CoordTopocentric.h b/libsgp4/CoordTopocentric.h index f9fb798..c5a7fbb 100644 --- a/libsgp4/CoordTopocentric.h +++ b/libsgp4/CoordTopocentric.h @@ -24,6 +24,9 @@ #include #include +namespace libsgp4 +{ + /** * @brief Stores a topocentric location (azimuth, elevation, range and range * rate). @@ -123,4 +126,6 @@ inline std::ostream& operator<<(std::ostream& strm, const CoordTopocentric& t) return strm << t.ToString(); } +} // namespace libsgp4 + #endif diff --git a/libsgp4/DateTime.cc b/libsgp4/DateTime.cc index 707b2de..e056208 100644 --- a/libsgp4/DateTime.cc +++ b/libsgp4/DateTime.cc @@ -80,7 +80,7 @@ int main() std::cout << "F " << dt.Microsecond() << " " << microsecond << std::endl; return 0; } - + if (!jd_dmy(dt.Julian() + 0.5, year, month, day)) { std::cout << "julian" << std::endl; @@ -89,7 +89,7 @@ int main() } } } - + for (int hour = 1; hour < 24; hour++) { std::cout << hour << std::endl; @@ -127,7 +127,7 @@ int main() } } } - + jd_dmy(1721425.5, 0, 0, 0); DateTime d1(1000, 1, 1); @@ -142,7 +142,7 @@ int main() std::cout << d3.Julian() << std::endl; std::cout << d4.Julian() << std::endl; std::cout << d5.Julian() << std::endl; - + return 0; } diff --git a/libsgp4/DateTime.h b/libsgp4/DateTime.h index 9c98301..6778d5a 100644 --- a/libsgp4/DateTime.h +++ b/libsgp4/DateTime.h @@ -27,6 +27,8 @@ #include "TimeSpan.h" #include "Util.h" +namespace libsgp4 +{ namespace { static int daysInMonth[2][13] = { @@ -702,4 +704,6 @@ inline bool operator<=(const DateTime& dt1, const DateTime& dt2) return (dt1.Compare(dt2) <= 0); } +} // namespace libsgp4 + #endif diff --git a/libsgp4/DecayedException.h b/libsgp4/DecayedException.h index b7c769f..275e8c1 100644 --- a/libsgp4/DecayedException.h +++ b/libsgp4/DecayedException.h @@ -24,6 +24,9 @@ #include #include +namespace libsgp4 +{ + /** * @brief The exception that the SGP4 class throws when a satellite decays. */ @@ -74,4 +77,6 @@ private: Vector _vel; }; +} // namespace libsgp4 + #endif diff --git a/libsgp4/Eci.cc b/libsgp4/Eci.cc index eee586b..61d24bc 100644 --- a/libsgp4/Eci.cc +++ b/libsgp4/Eci.cc @@ -20,6 +20,9 @@ #include "Globals.h" #include "Util.h" +namespace libsgp4 +{ + /** * Converts a DateTime and Geodetic position to Eci coordinates * @param[in] dt the date @@ -82,7 +85,7 @@ CoordGeodetic Eci::ToGeodetic() const const double r = sqrt((m_position.x * m_position.x) + (m_position.y * m_position.y)); - + static const double e2 = kF * (2.0 - kF); double lat = Util::AcTan(m_position.z, r); @@ -104,3 +107,5 @@ CoordGeodetic Eci::ToGeodetic() const return CoordGeodetic(lat, lon, alt, true); } + +} // namespace libsgp4 diff --git a/libsgp4/Eci.h b/libsgp4/Eci.h index 1a6bd71..550733d 100644 --- a/libsgp4/Eci.h +++ b/libsgp4/Eci.h @@ -22,6 +22,9 @@ #include "Vector.h" #include "DateTime.h" +namespace libsgp4 +{ + /** * @brief Stores an Earth-centered inertial position for a particular time. */ @@ -141,4 +144,6 @@ private: Vector m_velocity; }; +} // namespace libsgp4 + #endif diff --git a/libsgp4/Globals.h b/libsgp4/Globals.h index c31fd80..cec3157 100644 --- a/libsgp4/Globals.h +++ b/libsgp4/Globals.h @@ -20,6 +20,9 @@ #include +namespace libsgp4 +{ + const double kAE = 1.0; const double kQ0 = 120.0; const double kS0 = 78.0; @@ -72,5 +75,6 @@ const double kHOURS_PER_DAY = 24.0; const double kA3OVK2 = -kXJ3 / kCK2 * kAE * kAE * kAE; -#endif +} // namespace libsgp4 +#endif diff --git a/libsgp4/Observer.cc b/libsgp4/Observer.cc index 7461d92..2065eef 100644 --- a/libsgp4/Observer.cc +++ b/libsgp4/Observer.cc @@ -16,9 +16,11 @@ #include "Observer.h" - #include "CoordTopocentric.h" +namespace libsgp4 +{ + /* * calculate lookangle between the observer and the passed in Eci object */ @@ -80,3 +82,5 @@ CoordTopocentric Observer::GetLookAngle(const Eci &eci) range.w, rate); } + +} // namespace libsgp4 diff --git a/libsgp4/Observer.h b/libsgp4/Observer.h index 16238f4..8f67210 100644 --- a/libsgp4/Observer.h +++ b/libsgp4/Observer.h @@ -21,6 +21,9 @@ #include "CoordGeodetic.h" #include "Eci.h" +namespace libsgp4 +{ + class DateTime; struct CoordTopocentric; @@ -98,5 +101,6 @@ private: Eci m_eci; }; -#endif +} // namespace libsgp4 +#endif diff --git a/libsgp4/OrbitalElements.cc b/libsgp4/OrbitalElements.cc index 0254e2d..7e85720 100644 --- a/libsgp4/OrbitalElements.cc +++ b/libsgp4/OrbitalElements.cc @@ -19,6 +19,9 @@ #include "Tle.h" +namespace libsgp4 +{ + OrbitalElements::OrbitalElements(const Tle& tle) { /* @@ -64,3 +67,4 @@ OrbitalElements::OrbitalElements(const Tle& tle) period_ = kTWOPI / RecoveredMeanMotion(); } +} // namespace libsgp4 diff --git a/libsgp4/OrbitalElements.h b/libsgp4/OrbitalElements.h index e11e2c6..baf51ec 100644 --- a/libsgp4/OrbitalElements.h +++ b/libsgp4/OrbitalElements.h @@ -21,6 +21,9 @@ #include "Util.h" #include "DateTime.h" +namespace libsgp4 +{ + class Tle; /** @@ -142,4 +145,6 @@ private: DateTime epoch_; }; +} // namespace libsgp4 + #endif diff --git a/libsgp4/SGP4.cc b/libsgp4/SGP4.cc index 705fc7e..ecd9026 100644 --- a/libsgp4/SGP4.cc +++ b/libsgp4/SGP4.cc @@ -26,6 +26,9 @@ #include #include +namespace libsgp4 +{ + void SGP4::SetTle(const Tle& tle) { /* @@ -1346,3 +1349,5 @@ void SGP4::Reset() std::memset(&deepspace_consts_, 0, sizeof(deepspace_consts_)); std::memset(&integrator_params_, 0, sizeof(integrator_params_)); } + +} // namespace libsgp4 diff --git a/libsgp4/SGP4.h b/libsgp4/SGP4.h index 4cb68ea..9485143 100644 --- a/libsgp4/SGP4.h +++ b/libsgp4/SGP4.h @@ -24,6 +24,9 @@ #include "SatelliteException.h" #include "DecayedException.h" +namespace libsgp4 +{ + /** * @mainpage * @@ -255,4 +258,6 @@ private: bool use_deep_space_; }; +} // namespace libsgp4 + #endif diff --git a/libsgp4/SatelliteException.h b/libsgp4/SatelliteException.h index a771a75..ba4a081 100644 --- a/libsgp4/SatelliteException.h +++ b/libsgp4/SatelliteException.h @@ -21,6 +21,9 @@ #include #include +namespace libsgp4 +{ + /** * @brief The exception that the SGP4 class throws upon an error. */ @@ -33,4 +36,6 @@ public: } }; +} // namespace libsgp4 + #endif diff --git a/libsgp4/SolarPosition.cc b/libsgp4/SolarPosition.cc index 1ddad9b..cb6bbeb 100644 --- a/libsgp4/SolarPosition.cc +++ b/libsgp4/SolarPosition.cc @@ -22,6 +22,9 @@ #include +namespace libsgp4 +{ + Eci SolarPosition::FindPosition(const DateTime& dt) { const double mjd = dt.ToJ2000(); @@ -61,3 +64,5 @@ double SolarPosition::Delta_ET(double year) const return 26.465 + 0.747622 * (year - 1950) + 1.886913 * sin(kTWOPI * (year - 1975) / 33); } + +} // namespace libsgp4 diff --git a/libsgp4/SolarPosition.h b/libsgp4/SolarPosition.h index e74c548..050f83f 100644 --- a/libsgp4/SolarPosition.h +++ b/libsgp4/SolarPosition.h @@ -21,6 +21,9 @@ #include "DateTime.h" #include "Eci.h" +namespace libsgp4 +{ + /** * @brief Find the position of the sun */ @@ -37,4 +40,6 @@ private: double Delta_ET(double year) const; }; +} // namespace libsgp4 + #endif diff --git a/libsgp4/TimeSpan.h b/libsgp4/TimeSpan.h index 21edeff..742432a 100644 --- a/libsgp4/TimeSpan.h +++ b/libsgp4/TimeSpan.h @@ -24,6 +24,9 @@ #include #include +namespace libsgp4 +{ + namespace { static const int64_t TicksPerDay = 86400000000LL; @@ -254,4 +257,6 @@ inline bool operator<=(const TimeSpan& ts1, const TimeSpan& ts2) return (ts1.Compare(ts2) <= 0); } +} // namespace libsgp4 + #endif diff --git a/libsgp4/Tle.cc b/libsgp4/Tle.cc index 07f62b6..2616039 100644 --- a/libsgp4/Tle.cc +++ b/libsgp4/Tle.cc @@ -17,8 +17,10 @@ #include "Tle.h" -#include +#include +namespace libsgp4 +{ namespace { static const unsigned int TLE1_COL_NORADNUM = 2; @@ -366,3 +368,5 @@ void Tle::ExtractExponential(const std::string& str, double& val) throw TleException("Failed to convert value to double"); } } + +} // namespace libsgp4 diff --git a/libsgp4/Tle.h b/libsgp4/Tle.h index 60122bc..db46842 100644 --- a/libsgp4/Tle.h +++ b/libsgp4/Tle.h @@ -22,6 +22,9 @@ #include "DateTime.h" #include "TleException.h" +namespace libsgp4 +{ + /** * @brief Processes a two-line element set used to convey OrbitalElements. * @@ -339,4 +342,6 @@ inline std::ostream& operator<<(std::ostream& strm, const Tle& t) return strm << t.ToString(); } +} // namespace libsgp4 + #endif diff --git a/libsgp4/TleException.h b/libsgp4/TleException.h index 5393792..4c75b44 100644 --- a/libsgp4/TleException.h +++ b/libsgp4/TleException.h @@ -21,6 +21,9 @@ #include #include +namespace libsgp4 +{ + /** * @brief The exception that the Tle class throws on an error. * @@ -39,4 +42,6 @@ public: } }; +} // namespace libsgp4 + #endif diff --git a/libsgp4/Util.cc b/libsgp4/Util.cc index 2e9ee3d..47f1546 100644 --- a/libsgp4/Util.cc +++ b/libsgp4/Util.cc @@ -21,6 +21,8 @@ #include #include +namespace libsgp4 +{ namespace Util { namespace @@ -51,4 +53,5 @@ namespace Util TrimLeft(s); TrimRight(s); } -} +} // namespace Util +} // namespace libsgp4 diff --git a/libsgp4/Util.h b/libsgp4/Util.h index fd79bc6..57ec650 100644 --- a/libsgp4/Util.h +++ b/libsgp4/Util.h @@ -22,6 +22,8 @@ #include +namespace libsgp4 +{ namespace Util { template @@ -50,7 +52,7 @@ namespace Util { return Mod(a + kPI, kTWOPI) - kPI; } - + inline double WrapTwoPI(const double a) { return Mod(a, kTWOPI); @@ -101,10 +103,12 @@ namespace Util } } } - + void TrimLeft(std::string& s); void TrimRight(std::string& s); void Trim(std::string& s); -} + +} // namespace Util +} // namespace libsgp4 #endif diff --git a/libsgp4/Vector.h b/libsgp4/Vector.h index 111c5a7..c50de56 100644 --- a/libsgp4/Vector.h +++ b/libsgp4/Vector.h @@ -23,6 +23,9 @@ #include #include +namespace libsgp4 +{ + /** * @brief Generic vector * @@ -158,4 +161,6 @@ inline std::ostream& operator<<(std::ostream& strm, const Vector& v) return strm << v.ToString(); } +} // namespace libsgp4 + #endif diff --git a/passpredict/passpredict.cc b/passpredict/passpredict.cc index b4e7b81..db6131e 100644 --- a/passpredict/passpredict.cc +++ b/passpredict/passpredict.cc @@ -27,25 +27,25 @@ struct PassDetails { - DateTime aos; - DateTime los; + libsgp4::DateTime aos; + libsgp4::DateTime los; double max_elevation; }; double FindMaxElevation( - const CoordGeodetic& user_geo, - SGP4& sgp4, - const DateTime& aos, - const DateTime& los) + const libsgp4::CoordGeodetic& user_geo, + libsgp4::SGP4& sgp4, + const libsgp4::DateTime& aos, + const libsgp4::DateTime& los) { - Observer obs(user_geo); + libsgp4::Observer obs(user_geo); bool running; double time_step = (los - aos).TotalSeconds() / 9.0; - DateTime current_time(aos); //! current time - DateTime time1(aos); //! start time of search period - DateTime time2(los); //! end time of search period + libsgp4::DateTime current_time(aos); //! current time + libsgp4::DateTime time1(aos); //! start time of search period + libsgp4::DateTime time2(los); //! end time of search period double max_elevation; //! max elevation running = true; @@ -59,8 +59,8 @@ double FindMaxElevation( /* * find position */ - Eci eci = sgp4.FindPosition(current_time); - CoordTopocentric topo = obs.GetLookAngle(eci); + libsgp4::Eci eci = sgp4.FindPosition(current_time); + libsgp4::CoordTopocentric topo = obs.GetLookAngle(eci); if (topo.elevation > max_elevation) { @@ -111,21 +111,21 @@ double FindMaxElevation( return max_elevation; } -DateTime FindCrossingPoint( - const CoordGeodetic& user_geo, - SGP4& sgp4, - const DateTime& initial_time1, - const DateTime& initial_time2, +libsgp4::DateTime FindCrossingPoint( + const libsgp4::CoordGeodetic& user_geo, + libsgp4::SGP4& sgp4, + const libsgp4::DateTime& initial_time1, + const libsgp4::DateTime& initial_time2, bool finding_aos) { - Observer obs(user_geo); + libsgp4::Observer obs(user_geo); bool running; int cnt; - DateTime time1(initial_time1); - DateTime time2(initial_time2); - DateTime middle_time; + libsgp4::DateTime time1(initial_time1); + libsgp4::DateTime time2(initial_time2); + libsgp4::DateTime middle_time; running = true; cnt = 0; @@ -135,8 +135,8 @@ DateTime FindCrossingPoint( /* * calculate satellite position */ - Eci eci = sgp4.FindPosition(middle_time); - CoordTopocentric topo = obs.GetLookAngle(eci); + libsgp4::Eci eci = sgp4.FindPosition(middle_time); + libsgp4::CoordTopocentric topo = obs.GetLookAngle(eci); if (topo.elevation > 0.0) { @@ -189,8 +189,8 @@ DateTime FindCrossingPoint( cnt = 0; while (running && cnt++ < 6) { - Eci eci = sgp4.FindPosition(middle_time); - CoordTopocentric topo = obs.GetLookAngle(eci); + libsgp4::Eci eci = sgp4.FindPosition(middle_time); + libsgp4::CoordTopocentric topo = obs.GetLookAngle(eci); if (topo.elevation > 0) { middle_time = middle_time.AddSeconds(finding_aos ? -1 : 1); @@ -205,23 +205,23 @@ DateTime FindCrossingPoint( } std::list GeneratePassList( - const CoordGeodetic& user_geo, - SGP4& sgp4, - const DateTime& start_time, - const DateTime& end_time, + const libsgp4::CoordGeodetic& user_geo, + libsgp4::SGP4& sgp4, + const libsgp4::DateTime& start_time, + const libsgp4::DateTime& end_time, const int time_step) { std::list pass_list; - Observer obs(user_geo); + libsgp4::Observer obs(user_geo); - DateTime aos_time; - DateTime los_time; + libsgp4::DateTime aos_time; + libsgp4::DateTime los_time; bool found_aos = false; - DateTime previous_time(start_time); - DateTime current_time(start_time); + libsgp4::DateTime previous_time(start_time); + libsgp4::DateTime current_time(start_time); while (current_time < end_time) { @@ -230,8 +230,8 @@ std::list GeneratePassList( /* * calculate satellite position */ - Eci eci = sgp4.FindPosition(current_time); - CoordTopocentric topo = obs.GetLookAngle(eci); + libsgp4::Eci eci = sgp4.FindPosition(current_time); + libsgp4::CoordTopocentric topo = obs.GetLookAngle(eci); if (!found_aos && topo.elevation > 0.0) { @@ -301,14 +301,14 @@ std::list GeneratePassList( /* * at the end of the pass move the time along by 30mins */ - current_time = current_time + TimeSpan(0, 30, 0); + current_time = current_time + libsgp4::TimeSpan(0, 30, 0); } else { /* * move the time along by the time step value */ - current_time = current_time + TimeSpan(0, 0, time_step); + current_time = current_time + libsgp4::TimeSpan(0, 0, time_step); } if (current_time > end_time) @@ -330,7 +330,6 @@ std::list GeneratePassList( pd.aos = aos_time; pd.los = end_time; pd.max_elevation = FindMaxElevation(user_geo, sgp4, aos_time, end_time); - pass_list.push_back(pd); } @@ -339,19 +338,19 @@ std::list GeneratePassList( int main() { - CoordGeodetic geo(51.507406923983446, -0.12773752212524414, 0.05); - Tle tle("GALILEO-PFM (GSAT0101) ", + libsgp4::CoordGeodetic geo(51.507406923983446, -0.12773752212524414, 0.05); + libsgp4::Tle tle("GALILEO-PFM (GSAT0101) ", "1 37846U 11060A 12293.53312491 .00000049 00000-0 00000-0 0 1435", "2 37846 54.7963 119.5777 0000994 319.0618 40.9779 1.70474628 6204"); - SGP4 sgp4(tle); + libsgp4::SGP4 sgp4(tle); std::cout << tle << std::endl; /* * generate 7 day schedule */ - DateTime start_date = DateTime::Now(true); - DateTime end_date(start_date.AddDays(7.0)); + libsgp4::DateTime start_date = libsgp4::DateTime::Now(true); + libsgp4::DateTime end_date(start_date.AddDays(7.0)); std::list pass_list; @@ -378,7 +377,7 @@ int main() { ss << "AOS: " << itr->aos << ", LOS: " << itr->los - << ", Max El: " << std::setw(4) << Util::RadiansToDegrees(itr->max_elevation) + << ", Max El: " << std::setw(4) << libsgp4::Util::RadiansToDegrees(itr->max_elevation) << ", Duration: " << (itr->los - itr->aos) << std::endl; } diff --git a/runtest/runtest.cc b/runtest/runtest.cc index 6ec6ba6..c3676a8 100644 --- a/runtest/runtest.cc +++ b/runtest/runtest.cc @@ -29,10 +29,10 @@ #include #include -void RunTle(Tle tle, double start, double end, double inc) +void RunTle(libsgp4::Tle tle, double start, double end, double inc) { double current = start; - SGP4 model(tle); + libsgp4::SGP4 model(tle); bool running = true; bool first_run = true; @@ -42,13 +42,13 @@ void RunTle(Tle tle, double start, double end, double inc) while (running) { bool error = false; - Vector position; - Vector velocity; + libsgp4::Vector position; + libsgp4::Vector velocity; double tsince; try { - if (first_run && current != 0.0) + if (first_run && current != 0.0) { /* * make sure first run is always as zero @@ -63,17 +63,17 @@ void RunTle(Tle tle, double start, double end, double inc) tsince = current; } - Eci eci = model.FindPosition(tsince); + libsgp4::Eci eci = model.FindPosition(tsince); position = eci.Position(); velocity = eci.Velocity(); } - catch (SatelliteException& e) + catch (libsgp4::SatelliteException& e) { std::cerr << e.what() << std::endl; error = true; running = false; } - catch (DecayedException& e) + catch (libsgp4::DecayedException& e) { std::cerr << e.what() << std::endl; @@ -181,7 +181,7 @@ void RunTest(const char* infile) std::string line; std::getline(file, line); - Util::Trim(line); + libsgp4::Util::Trim(line); /* * skip blank lines or lines starting with # @@ -199,7 +199,7 @@ void RunTest(const char* infile) { try { - if (line.length() >= Tle::LineLength()) + if (line.length() >= libsgp4::Tle::LineLength()) { //Tle::IsValidLine(line.substr(0, Tle::LineLength()), 1); /* @@ -209,7 +209,7 @@ void RunTest(const char* infile) line1 = line; } } - catch (TleException& e) + catch (libsgp4::TleException& e) { std::cerr << "Error: " << e.what() << std::endl; std::cerr << line << std::endl; @@ -225,15 +225,15 @@ void RunTest(const char* infile) * split line, first 69 is the second line of the tle * the rest is the test parameters, if there is any */ - line2 = line.substr(0, Tle::LineLength()); + line2 = line.substr(0, libsgp4::Tle::LineLength()); double start = 0.0; double end = 1440.0; double inc = 120.0; if (line.length() > 69) { std::vector tokens; - parameters = line.substr(Tle::LineLength() + 1, - line.length() - Tle::LineLength()); + parameters = line.substr(libsgp4::Tle::LineLength() + 1, + line.length() - libsgp4::Tle::LineLength()); tokenize(parameters, tokens); if (tokens.size() >= 3) { @@ -248,14 +248,14 @@ void RunTest(const char* infile) */ try { - if (line.length() >= Tle::LineLength()) + if (line.length() >= libsgp4::Tle::LineLength()) { //Tle::IsValidLine(line.substr(0, Tle::LineLength()), 2); - Tle tle("Test", line1, line2); + libsgp4::Tle tle("Test", line1, line2); RunTle(tle, start, end, inc); } } - catch (TleException& e) + catch (libsgp4::TleException& e) { std::cerr << "Error: " << e.what() << std::endl; std::cerr << line << std::endl; diff --git a/sattrack/sattrack.cc b/sattrack/sattrack.cc index 461f899..60c3548 100644 --- a/sattrack/sattrack.cc +++ b/sattrack/sattrack.cc @@ -24,29 +24,29 @@ int main() { - Observer obs(51.507406923983446, -0.12773752212524414, 0.05); - Tle tle = Tle("UK-DMC 2 ", + libsgp4::Observer obs(51.507406923983446, -0.12773752212524414, 0.05); + libsgp4::Tle tle = libsgp4::Tle("UK-DMC 2 ", "1 35683U 09041C 12289.23158813 .00000484 00000-0 89219-4 0 5863", "2 35683 98.0221 185.3682 0001499 100.5295 259.6088 14.69819587172294"); - SGP4 sgp4(tle); + libsgp4::SGP4 sgp4(tle); std::cout << tle << std::endl; for (int i = 0; i < 10; ++i) { - DateTime dt = tle.Epoch().AddMinutes(i * 10); + libsgp4::DateTime dt = tle.Epoch().AddMinutes(i * 10); /* * calculate satellite position */ - Eci eci = sgp4.FindPosition(dt); + libsgp4::Eci eci = sgp4.FindPosition(dt); /* * get look angle for observer to satellite */ - CoordTopocentric topo = obs.GetLookAngle(eci); + libsgp4::CoordTopocentric topo = obs.GetLookAngle(eci); /* * convert satellite position to geodetic coordinates */ - CoordGeodetic geo = eci.ToGeodetic(); + libsgp4::CoordGeodetic geo = eci.ToGeodetic(); std::cout << dt << " " << topo << " " << geo << std::endl; };