ethz_satdb_datasource.cpp
Go to the documentation of this file.
1 // SPDX-License-Identifier: BSD-3-Clause
2 // SPDX-FileCopyrightText: Czech Technical University in Prague
3 
4 #include <ctime>
5 #include <list>
6 #include <memory>
7 #include <string>
8 #include <unordered_map>
9 #include <unordered_set>
10 #include <utility>
11 #include <vector>
12 #include CXX_FILESYSTEM_INCLUDE
13 
14 #include <gnsstk/MultiFormatNavDataFactory.hpp>
15 #include <gnsstk/NavDataFactoryStoreCallback.hpp>
16 #include <gnsstk/NavDataFactoryWithStoreFile.hpp>
17 #include <gnsstk/NavLibrary.hpp>
18 #include <gnsstk/OrbitData.hpp>
19 #include <gnsstk/Position.hpp>
20 #include <jsoncpp/json/json.h>
21 
24 #include <gnss_info/cache.h>
25 #include <gnss_info/cache_index.h>
27 #include <gnss_info_msgs/Enums.h>
29 #include <gnsstk_ros/time.h>
30 #include <ros/ros.h>
31 
32 #include "tle.h" // NOLINT
33 
34 namespace fs = CXX_FILESYSTEM_NAMESPACE;
35 
36 namespace gnsstk
37 {
38 
39 class TLEOrbitData : public OrbitData
40 {
41 public:
42  explicit TLEOrbitData(const tled_t& tle) : tle(tle)
43  {
44  }
45 
46  bool isSameData(const NavDataPtr& right) const override
47  {
48  const auto rhs = std::dynamic_pointer_cast<TLEOrbitData>(right);
49  if (rhs == nullptr)
50  return false;
51 
52  return NavData::isSameData(right) &&
53  this->tle.name == rhs->tle.name &&
54  this->tle.alias == rhs->tle.alias &&
55  this->tle.satno == rhs->tle.satno &&
56  this->tle.satclass == rhs->tle.satclass &&
57  this->tle.desig == rhs->tle.desig &&
58  this->tle.epoch.sec == rhs->tle.epoch.sec &&
59  this->tle.epoch.time == rhs->tle.epoch.time &&
60  this->tle.ndot == rhs->tle.ndot &&
61  this->tle.nddot == rhs->tle.nddot &&
62  this->tle.bstar == rhs->tle.bstar &&
63  this->tle.etype == rhs->tle.etype &&
64  this->tle.eleno == rhs->tle.eleno &&
65  this->tle.inc == rhs->tle.inc &&
66  this->tle.OMG == rhs->tle.OMG &&
67  this->tle.ecc == rhs->tle.ecc &&
68  this->tle.omg == rhs->tle.omg &&
69  this->tle.M == rhs->tle.M &&
70  this->tle.n == rhs->tle.n &&
71  this->tle.rev == rhs->tle.rev;
72  }
73 
74  std::list<std::string> compare(const NavDataPtr& right) const override
75  {
76  auto res = NavData::compare(right);
77  const auto rhs = std::dynamic_pointer_cast<TLEOrbitData>(right);
78  if (rhs == nullptr)
79  {
80  res.emplace_back("CLASS");
81  return res;
82  }
83 
84  if (strcmp(this->tle.name, rhs->tle.name) != 0)
85  res.emplace_back("name");
86  if (strcmp(this->tle.alias, rhs->tle.alias) != 0)
87  res.emplace_back("alias");
88  if (strcmp(this->tle.satno, rhs->tle.satno) != 0)
89  res.emplace_back("satno");
90  if (this->tle.satclass != rhs->tle.satclass)
91  res.emplace_back("satclass");
92  if (strcmp(this->tle.desig, rhs->tle.desig) != 0)
93  res.emplace_back("desig");
94  if (this->tle.epoch.sec != rhs->tle.epoch.sec || this->tle.epoch.time != rhs->tle.epoch.time)
95  res.emplace_back("epoch");
96  if (this->tle.ndot != rhs->tle.ndot)
97  res.emplace_back("ndot");
98  if (this->tle.nddot != rhs->tle.nddot)
99  res.emplace_back("nddot");
100  if (this->tle.bstar != rhs->tle.bstar)
101  res.emplace_back("bstar");
102  if (this->tle.etype != rhs->tle.etype)
103  res.emplace_back("etype");
104  if (this->tle.eleno != rhs->tle.eleno)
105  res.emplace_back("eleno");
106  if (this->tle.inc != rhs->tle.inc)
107  res.emplace_back("inc");
108  if (this->tle.OMG != rhs->tle.OMG)
109  res.emplace_back("OMG");
110  if (this->tle.ecc != rhs->tle.ecc)
111  res.emplace_back("ecc");
112  if (this->tle.omg != rhs->tle.omg)
113  res.emplace_back("omg");
114  if (this->tle.M != rhs->tle.M)
115  res.emplace_back("M");
116  if (this->tle.n != rhs->tle.n)
117  res.emplace_back("n");
118  if (this->tle.rev != rhs->tle.rev)
119  res.emplace_back("rev");
120 
121  return res;
122  }
123 
124  NavDataPtr clone() const override
125  {
126  return std::make_shared<TLEOrbitData>(this->tle);
127  }
128 
129  bool validate() const override
130  {
131  return true;
132  }
133 
134  bool getXvt(const CommonTime& when, Xvt& xvt, const ObsID& oid) override
135  {
136  const tle_t tleList{1, 1, &this->tle};
137 
138  double rs[6];
139  const auto rosWhen = gnsstk_ros::convert(when);
140  gtime_t gtime {rosWhen.sec, rosWhen.nsec * 1e-9};
141  if (!tle_pos(utc2gpst(gtime), "", this->tle.satno, "", &tleList, nullptr, rs))
142  {
143  ROS_WARN_THROTTLE(1.0, "Failed to compute ECEF position of satellite %s (%s) at time %s.",
144  this->tle.satno, this->tle.name, cras::to_string(rosWhen).c_str());
145  return false;
146  }
147 
148  Position pos {rs, Position::CoordinateSystem::Cartesian};
149  if (pos.radius() < pos.radiusEarth())
150  {
151  ROS_WARN_THROTTLE(1.0, "Invalid satellite position. Satellite %s (%s) is underground at time %s!",
152  this->tle.satno, this->tle.name, cras::to_string(rosWhen).c_str());
153  return false;
154  }
155 
156  xvt.x = Triple(rs[0], rs[1], rs[2]);
157  xvt.v = Triple(rs[3], rs[4], rs[5]);
159  xvt.health = Xvt::Healthy;
160 
161  return true;
162  }
163 
164 private:
166 };
167 
169 {
170 public:
172  {
174  for (const auto& satSystem : SatelliteSystemIterator())
175  this->supportedSignals.insert(NavSignalID(satSystem, obs, NavType::Any));
176  }
177 
178  static void addSatelliteInfo(const std::unordered_map<uint32_t, gnss_info_msgs::SatelliteInfo>& satelliteInfo)
179  {
181  }
182 
183  bool loadIntoMap(const std::string& filename, NavMessageMap& navMap, NavNearMessageMap& navNearMap,
184  OffsetCvtMap& ofsMap) override
185  {
186  NavDataFactoryStoreCallback cb(this, navMap, navNearMap, ofsMap);
187  return this->process(filename, cb);
188  }
189 
190  bool process(const std::string& filename, NavDataFactoryCallback& cb) override
191  {
192  if (!this->procNavTypes.empty() && this->procNavTypes.count(NavMessageType::Almanac) == 0)
193  return true;
194 
196  return true;
197 
198  tle_t tles{};
199  if (!tle_read(filename.c_str(), &tles))
200  {
201  ROS_ERROR("Failed reading TLE file %s.", filename.c_str());
202  return false;
203  }
204 
205  const std::vector<tled_t> tlesVec(tles.data, tles.data + tles.n);
206  std::free(tles.data);
207 
208  for (const auto& tle : tlesVec)
209  {
210  std::shared_ptr<TLEOrbitData> alm;
211  if (!this->convertToOrbit(tle, alm))
212  return false;
213  if (alm != nullptr && !cb.process(alm))
214  return false;
215  }
216 
217  return true;
218  }
219 
220  std::string getFactoryFormats() const override
221  {
222  if (this->procNavTypes.empty() || this->procNavTypes.count(NavMessageType::Almanac) > 0)
223  return "TLE";
224  return "";
225  }
226 
227  bool convertToOrbit(const tled_t& navIn, std::shared_ptr<TLEOrbitData>& navOut)
228  {
229  try
230  {
231  // Remove leading zeros from satno, otherwise it would be interpreted as octal.
232  auto satno = std::string(navIn.satno);
233  while (!satno.empty() && satno[0] == '0')
234  satno = satno.substr(1);
235  const auto satcatID = cras::parseUInt32(satno);
237  return true;
238 
239  const auto& info = TLENavDataFactory::satelliteInfo[satcatID];
240  const auto satId = gnsstk_ros::satelliteInfoToSatID(info);
241  if (!satId.has_value())
242  return false;
243 
244  navOut = std::make_shared<TLEOrbitData>(navIn);
245  navOut->signal.sat = navOut->signal.xmitSat = *satId;
246  navOut->signal.system = satId->system;
248  navOut->signal.nav = NavType::Any;
249  navOut->signal.messageType = NavMessageType::Almanac;
250  ros::Time epoch(navIn.epoch.time, static_cast<uint32_t>(navIn.epoch.sec * 1e9));
251  navOut->timeStamp = gnsstk_ros::convert(epoch);
252 
253  return true;
254  }
255  catch (const std::invalid_argument&)
256  {
257  return false;
258  }
259  }
260 
261 protected:
262  static std::unordered_map<uint32_t, gnss_info_msgs::SatelliteInfo> satelliteInfo;
263 };
264 
265 std::unordered_map<uint32_t, gnss_info_msgs::SatelliteInfo> TLENavDataFactory::satelliteInfo;
266 
267 }
268 
269 namespace gnss_info
270 {
271 
273 {
274  std::pair<ros::Time, ros::Time> timeRange;
275  std::unordered_set<std::string> constellations;
276  std::unordered_set<DayIndex> loadedDays;
277 
278  std::string urlFormat {"https://satdb.ethz.ch/api/satellitedata/?object-name=%s&"
279  "start-datetime=%sT0000&end-datetime=%sT0000&before=3&after=3&"
280  "without-frequency-data=True"};
281 
282  size_t maxDownloadDays {1000u};
283  fs::path cacheDir;
284 
285  std::unordered_map<std::string, std::string> satdbConstellations {
286  {gnss_info_msgs::Enums::CONSTELLATION_GPS, "NAVSTAR"},
287  {gnss_info_msgs::Enums::CONSTELLATION_GALILEO, "GSAT0"},
288  {gnss_info_msgs::Enums::CONSTELLATION_BEIDOU, "BEIDOU"},
289  {gnss_info_msgs::Enums::CONSTELLATION_GLONASS, "COSMOS"}
290  };
291 
292  fs::path getCacheFile(const DayIndex& day) const;
293  cras::expected<bool, std::string> download(const DayIndex& day);
294 };
295 
297 {
298  const auto filename = cras::format("ethz_satdb_%04u%02u%02u.tle", day.year, day.month, day.day);
299  return this->cacheDir / filename;
300 }
301 
302 cras::expected<bool, std::string> EthzSatdbDataSourcePrivate::download(const DayIndex& day)
303 {
304  const auto startDate = cras::format("%04u%02u%02u", day.year, day.month, day.day);
305  const DayIndex endDay(static_cast<ros::Time>(day) + ros::Duration::DAY);
306  const auto endDate = cras::format("%04u%02u%02u", endDay.year, endDay.month, endDay.day);
307 
308  const auto cacheFile = this->getCacheFile(day);
309  if (isCacheFileValid(cacheFile))
310  return true;
311 
312  std::stringstream ss;
313  size_t numSatellites {0u};
314  for (const auto& [constallation, prefix] : this->satdbConstellations)
315  {
316  const auto url = cras::format(this->urlFormat, prefix.c_str(), startDate.c_str(), endDate.c_str());
317  ROS_INFO("Downloading orbits from %s.", url.c_str());
318  auto maybeReadBuffer = gnss_info::download(url);
319 
320  if (!maybeReadBuffer.has_value())
321  return cras::make_unexpected(maybeReadBuffer.error());
322 
323  auto& readBuffer = *maybeReadBuffer;
324  Json::Value root;
325  Json::Reader reader;
326  if (!reader.parse(readBuffer, root))
327  {
328  return cras::make_unexpected(cras::format("Error parsing data downloaded from URL %s: %s.",
329  url.c_str(), reader.getFormattedErrorMessages().c_str()));
330  }
331 
332  const auto& results = root["results"];
333  for (int index = 0; index < results.size(); ++index)
334  ss << cras::replace(results[index]["norad_str"].asString(), "\\n", "\n") << std::endl;
335  numSatellites++;
336  }
337 
338  if (numSatellites == 0)
339  return cras::make_unexpected("Determining satellite orbits failed.");
340 
341  try
342  {
343  std::ofstream outFile;
344  outFile.open(cacheFile.c_str());
345  outFile << ss.rdbuf();
346  }
347  catch (const std::exception& e)
348  {
349  return cras::make_unexpected(e.what());
350  }
351 
352  ROS_DEBUG("Saved orbits to %s.", cacheFile.c_str());
353  return true;
354 }
355 
357  const std::unordered_map<uint32_t, gnss_info_msgs::SatelliteInfo>& satelliteInfo) :
359 {
360  this->data->timeRange = std::make_pair(static_cast<ros::Time>(DayIndex(2023, 2, 10)), ros::Time::MAX);
361 
362  this->data->constellations =
363  {
364  gnss_info_msgs::Enums::CONSTELLATION_GPS,
365  gnss_info_msgs::Enums::CONSTELLATION_GLONASS,
366  gnss_info_msgs::Enums::CONSTELLATION_GALILEO,
367  gnss_info_msgs::Enums::CONSTELLATION_BEIDOU,
368  };
369 
370  this->data->cacheDir = getCacheDir();
371 
373  static auto registered {false};
374  if (!registered)
375  {
376  gnsstk::NavDataFactoryPtr factory = std::make_shared<gnsstk::TLENavDataFactory>();
378  registered = true;
379  }
380 }
381 
383 
384 std::pair<ros::Time, ros::Time> EthzSatdbDataSource::getTimeRange() const
385 {
386  return this->data->timeRange;
387 }
388 
389 std::unordered_set<std::string> EthzSatdbDataSource::getConstellations() const
390 {
391  return this->data->constellations;
392 }
393 
395 {
396  return this->load(time, time + ros::Duration::DAY, cb);
397 }
398 
399 bool EthzSatdbDataSource::load(const ros::Time& startTime, const ros::Time& endTime, const DataSourceLoadCb& cb)
400 {
401  auto endTime2 = endTime;
402  if (endTime == ros::Time::MAX || (endTime - startTime) < ros::Duration::DAY)
403  endTime2 = startTime + ros::Duration::DAY;
404 
405  std::list<DayIndex> days;
406  for (auto time = startTime; time <= endTime2; time += ros::Duration::DAY)
407  days.emplace_back(time);
408  days.remove_if([this](const auto& day) {return this->data->loadedDays.count(day) > 0;});
409 
410  if (days.empty())
411  return true;
412 
413  const auto numDays = days.size();
414  if (numDays > 2 * this->data->maxDownloadDays)
415  {
416  ROS_ERROR("Not loading %zu orbits, it is too much.", numDays);
417  return false;
418  }
419 
420  size_t numToDownload {0u};
421  for (const auto& day : days)
422  {
423  const auto file = this->data->getCacheFile(day);
424  if (!isCacheFileValid(file))
425  numToDownload++;
426  }
427 
428  if (numToDownload > this->data->maxDownloadDays)
429  {
430  ROS_ERROR("Not downloading %zu orbits, it is too much.", numToDownload);
431  return false;
432  }
433 
434  if (numToDownload > 0)
435  {
436  const auto logLevel = (numToDownload < 10 ? ros::console::levels::Info : (
438  ROS_LOG(logLevel, ROSCONSOLE_DEFAULT_NAME, "Satellite orbits for %zu day(s) are about to be downloaded.",
439  numToDownload);
440  }
441  else
442  {
443  const auto logLevel = (numDays < 10 ? ros::console::levels::Info : (
445  ROS_LOG(logLevel, ROSCONSOLE_DEFAULT_NAME, "Satellite orbits for %zu day(s) are about to be loaded.",
446  numDays);
447  }
448 
449  auto hadError {false};
450  size_t numLoaded {0u};
451  for (const auto& day : days)
452  {
453  const auto file = this->data->getCacheFile(day);
454  if (!isCacheFileValid(file))
455  {
456  const auto maybeDownloaded = this->data->download(day);
457  if (!maybeDownloaded.has_value())
458  {
459  ROS_ERROR("%s", maybeDownloaded.error().c_str());
460  hadError = true;
461  continue;
462  }
463  }
464 
465  if (!cb(file.string()))
466  {
467  ROS_ERROR("Error processing TLE data file %s.", file.c_str());
468  hadError = true;
469  continue;
470  }
471 
472  numLoaded++;
473  this->data->loadedDays.insert(day);
474  }
475 
476  ROS_INFO("Successfully loaded orbits for %zu days.", numLoaded);
477  return !hadError;
478 }
479 
481 {
482  return false;
483 }
484 
486 {
487  return true;
488 }
489 
490 std::string EthzSatdbDataSource::getName() const
491 {
492  return "ETH Zurich Satellite DB";
493 }
494 
495 }
tled_t::OMG
double OMG
Definition: tle.h:93
gnss_info::EthzSatdbDataSource::isApproximate
bool isApproximate() const override
Return whether this datasource works with approximate orbit data.
Definition: ethz_satdb_datasource.cpp:485
gnsstk::NavDataPtr
std::shared_ptr< NavData > NavDataPtr
tle_read
int tle_read(const char *file, tle_t *tle)
Definition: tle.c:686
gnsstk::TLENavDataFactory::satelliteInfo
static std::unordered_map< uint32_t, gnss_info_msgs::SatelliteInfo > satelliteInfo
Definition: ethz_satdb_datasource.cpp:262
gnss_info::EthzSatdbDataSource::getName
std::string getName() const override
Get human-readable name of the data source.
Definition: ethz_satdb_datasource.cpp:490
ros::console::levels::Error
Error
gnsstk::TLEOrbitData::compare
std::list< std::string > compare(const NavDataPtr &right) const override
Definition: ethz_satdb_datasource.cpp:74
file
page HOWTO subpage DoxygenGuide Documenting Your Code page DoxygenGuide Documenting Your Code todo Flesh out this document section doctips Tips for Documenting When defining make sure that the prototype is identical between the cpp and hpp file
day
day
tled_t::alias
char alias[32]
Definition: tle.h:82
gnsstk::NavDataFactoryCallback::process
virtual bool process(const NavDataPtr &navOut)
gnsstk::TLENavDataFactory::convertToOrbit
bool convertToOrbit(const tled_t &navIn, std::shared_ptr< TLEOrbitData > &navOut)
Definition: ethz_satdb_datasource.cpp:227
gnss_info::EthzSatdbDataSourcePrivate::urlFormat
std::string urlFormat
Definition: ethz_satdb_datasource.cpp:278
gnsstk::NavData::compare
virtual std::list< std::string > compare(const NavDataPtr &right) const
gnss_info::EthzSatdbDataSourcePrivate
Definition: ethz_satdb_datasource.cpp:272
tled_t::ecc
double ecc
Definition: tle.h:94
gnss_info::EthzSatdbDataSource::isPrecise
bool isPrecise() const override
Return whether this datasource works with precise orbit data.
Definition: ethz_satdb_datasource.cpp:480
gnsstk::TLENavDataFactory::addSatelliteInfo
static void addSatelliteInfo(const std::unordered_map< uint32_t, gnss_info_msgs::SatelliteInfo > &satelliteInfo)
Definition: ethz_satdb_datasource.cpp:178
tle.h
gnsstk::NavDataFactoryWithStore::OffsetCvtMap
std::map< TimeCvtKey, OffsetEpochMap > OffsetCvtMap
gnsstk::TLEOrbitData::isSameData
bool isSameData(const NavDataPtr &right) const override
Definition: ethz_satdb_datasource.cpp:46
gnsstk::NavMessageMap
std::map< NavMessageType, NavSatMap > NavMessageMap
tled_t::eleno
int eleno
Definition: tle.h:91
ROS_WARN_THROTTLE
#define ROS_WARN_THROTTLE(period,...)
ros.h
tle_t
Definition: tle.h:101
gnsstk::Xvt::Healthy
Healthy
time.h
gnss_info::EthzSatdbDataSource::getConstellations
std::unordered_set< std::string > getConstellations() const override
Get the constellations handled by this data source.
Definition: ethz_satdb_datasource.cpp:389
DurationBase< Duration >::DAY
static const Duration DAY
gnsstk_ros::satelliteInfoToSatID
cras::optional< gnsstk::SatID > satelliteInfoToSatID(const gnss_info_msgs::SatelliteInfo &info)
gnsstk::MultiFormatNavDataFactory::addFactory
static bool addFactory(NavDataFactoryPtr &fact)
gnsstk_ros::convert
gnsstk::Position convert(const geographic_msgs::GeoPoint &position)
gnsstk::RefFrameRlz::WGS84G0
@ WGS84G0
tled_t::bstar
double bstar
Definition: tle.h:89
gnsstk::CarrierBand::Any
@ Any
gnsstk::Xvt::frame
RefFrame frame
gnsstk::NavMessageType::Almanac
@ Almanac
gtime_t::sec
double sec
Definition: tle.h:64
constellations.h
utc2gpst
gtime_t utc2gpst(gtime_t t)
Definition: tle.c:179
tled_t::rev
int rev
Definition: tle.h:98
gnsstk::Xvt::v
Triple v
gnss_info::EthzSatdbDataSource::data
std::unique_ptr< EthzSatdbDataSourcePrivate > data
Private implementation data (PIMPL).
Definition: ethz_satdb_datasource.h:42
tled_t::M
double M
Definition: tle.h:96
gnss_info::EthzSatdbDataSourcePrivate::download
cras::expected< bool, std::string > download(const DayIndex &day)
Definition: ethz_satdb_datasource.cpp:302
gnsstk::Triple
gtime_t::time
time_t time
Definition: tle.h:63
TimeBase< Time, Duration >::MAX
static const Time MAX
gnsstk
data
data
gnsstk::TLEOrbitData::clone
NavDataPtr clone() const override
Definition: ethz_satdb_datasource.cpp:124
gnsstk::NavDataFactoryWithStoreFile
gnss_info::DayIndex::day
uint8_t day
Day (starting with 1).
Definition: cache_index.h:20
gnsstk::NavDataFactoryPtr
std::shared_ptr< NavDataFactory > NavDataFactoryPtr
gnsstk::TLENavDataFactory::TLENavDataFactory
TLENavDataFactory()
Definition: ethz_satdb_datasource.cpp:171
gnsstk::TLEOrbitData::tle
tled_t tle
Definition: ethz_satdb_datasource.cpp:165
gnsstk::NavDataFactoryCallback
tled_t::omg
double omg
Definition: tle.h:95
gnsstk::TLENavDataFactory
Definition: ethz_satdb_datasource.cpp:168
gnsstk::ObservationType::NavMsg
@ NavMsg
gnsstk::NavType::Any
@ Any
gnss_info::DayIndex
Object that can be used as an index into a cache and assigns all times from the same day the same cac...
Definition: cache_index.h:16
string_utils.hpp
gnsstk::TLEOrbitData
Definition: ethz_satdb_datasource.cpp:39
tled_t::nddot
double nddot
Definition: tle.h:88
gnsstk::Xvt::x
Triple x
gnsstk::NavDataFactoryStoreCallback
tle_pos
int tle_pos(gtime_t time, const char *name, const char *satno, const char *desig, const tle_t *tle, const erp_t *erp, double *rs)
Definition: tle.c:739
cras::replace
void replace(::std::string &str, const ::std::string &from, const ::std::string &to, const ::cras::ReplacePosition &where=::cras::ReplacePosition::EVERYWHERE)
ROS_DEBUG
#define ROS_DEBUG(...)
gnsstk::NavDataFactory::navValidity
NavValidityType navValidity
gtime_t
Definition: tle.h:62
gnss_info::isCacheFileValid
bool isCacheFileValid(const std::string &file)
Return whether the given cache file can be used.
Definition: cache.cpp:76
gnss_info::EthzSatdbDataSource::EthzSatdbDataSource
EthzSatdbDataSource(const std::unordered_map< uint32_t, gnss_info_msgs::SatelliteInfo > &satelliteInfo)
Definition: ethz_satdb_datasource.cpp:356
time
time
gnsstk::ObsID
gnss_info::EthzSatdbDataSourcePrivate::timeRange
std::pair< ros::Time, ros::Time > timeRange
Definition: ethz_satdb_datasource.cpp:274
gnss_info::DayIndex::month
uint8_t month
Month (starting with 1).
Definition: cache_index.h:19
ethz_satdb_datasource.h
gnsstk::CommonTime
gnsstk::SatelliteSystemIterator
EnumIterator< SatelliteSystem, SatelliteSystem::Unknown, SatelliteSystem::Last > SatelliteSystemIterator
epoch
epoch
gnss_info::EthzSatdbDataSource::~EthzSatdbDataSource
~EthzSatdbDataSource() override
gnss_info::DayIndex::year
uint16_t year
Year.
Definition: cache_index.h:18
gnss_info::EthzSatdbDataSourcePrivate::constellations
std::unordered_set< std::string > constellations
Definition: ethz_satdb_datasource.cpp:275
tled_t::satno
char satno[16]
Definition: tle.h:83
gnsstk::Xvt
gnss_info::EthzSatdbDataSource::getTimeRange
std::pair< ros::Time, ros::Time > getTimeRange() const override
Get the time range in which this datasource can provide information.
Definition: ethz_satdb_datasource.cpp:384
gnss_info
Definition: cache.h:15
gnss_info::getCacheDir
std::string getCacheDir()
Return path to a directory where cache files should be stored. Also make sure the directory exists.
Definition: cache.cpp:20
gnsstk::TLENavDataFactory::getFactoryFormats
std::string getFactoryFormats() const override
Definition: ethz_satdb_datasource.cpp:220
ROS_LOG
#define ROS_LOG(level, name,...)
ros::console::levels::Info
Info
tled_t::ndot
double ndot
Definition: tle.h:87
tled_t::n
double n
Definition: tle.h:97
pos
pos
gnss_info::EthzSatdbDataSourcePrivate::satdbConstellations
std::unordered_map< std::string, std::string > satdbConstellations
Definition: ethz_satdb_datasource.cpp:285
gnss_info::EthzSatdbDataSourcePrivate::loadedDays
std::unordered_set< DayIndex > loadedDays
Definition: ethz_satdb_datasource.cpp:276
tled_t::epoch
gtime_t epoch
Definition: tle.h:86
cache.h
gnsstk::Xvt::health
HealthStatus health
gnsstk::TLEOrbitData::TLEOrbitData
TLEOrbitData(const tled_t &tle)
Definition: ethz_satdb_datasource.cpp:42
gnsstk::NavDataFactoryWithStore::find
bool find(const NavMessageID &nmid, const CommonTime &when, NavDataPtr &navOut, SVHealth xmitHealth, NavValidityType valid, NavSearchOrder order) override
expected.hpp
tled_t::inc
double inc
Definition: tle.h:92
gnsstk::NavSignalID
gnsstk::TLEOrbitData::validate
bool validate() const override
Definition: ethz_satdb_datasource.cpp:129
gnss_info::NavLibraryDataSource::DataSourceLoadCb
std::function< bool(const std::string &file)> DataSourceLoadCb
Callback to be called when a new source file is introduced.
Definition: nav_library_data_source.h:28
ros::Time
gnsstk::TLENavDataFactory::loadIntoMap
bool loadIntoMap(const std::string &filename, NavMessageMap &navMap, NavNearMessageMap &navNearMap, OffsetCvtMap &ofsMap) override
Definition: ethz_satdb_datasource.cpp:183
gnsstk::TLEOrbitData::getXvt
bool getXvt(const CommonTime &when, Xvt &xvt, const ObsID &oid) override
Definition: ethz_satdb_datasource.cpp:134
tled_t::satclass
char satclass
Definition: tle.h:84
gnss_info::EthzSatdbDataSource::load
bool load(const ros::Time &time, const DataSourceLoadCb &cb) override
Load data for the given time instant.
Definition: ethz_satdb_datasource.cpp:394
tled_t::desig
char desig[16]
Definition: tle.h:85
gnss_info::download
cras::expected< std::stringstream, std::string > download(const std::string &url, const std::function< void(CURL *)> &curlOptions={})
Download the given URL to a stringstream.
Definition: cache.cpp:50
ROS_ERROR
#define ROS_ERROR(...)
gnsstk::Position
ros::console::levels::Warn
Warn
gnsstk::OrbitData
cras::parseUInt32
uint32_t parseUInt32(const char *string)
gnsstk::NavDataFactory::supportedSignals
NavSignalSet supportedSignals
gnsstk::TLENavDataFactory::process
bool process(const std::string &filename, NavDataFactoryCallback &cb) override
Definition: ethz_satdb_datasource.cpp:190
cras::format
inline ::std::string format(::std::string format, ::va_list args)
ROSCONSOLE_DEFAULT_NAME
#define ROSCONSOLE_DEFAULT_NAME
tled_t::etype
int etype
Definition: tle.h:90
gnsstk::NavValidityType::InvalidOnly
@ InvalidOnly
gnsstk::NavNearMessageMap
std::map< NavMessageType, NavNearSatMap > NavNearMessageMap
gnsstk::NavDataFactory::procNavTypes
NavMessageTypeSet procNavTypes
ROS_INFO
#define ROS_INFO(...)
gnsstk::NavData::isSameData
virtual bool isSameData(const NavDataPtr &right) const
cache_index.h
gnsstk::TrackingCode::Any
@ Any
asString
std::string asString(AngleType e) noexcept
tled_t::name
char name[32]
Definition: tle.h:81
gnss_info::EthzSatdbDataSourcePrivate::cacheDir
fs::path cacheDir
Definition: ethz_satdb_datasource.cpp:283
tled_t
Definition: tle.h:80
cras::to_string
inline ::std::string to_string(char *value)
gnss_info::EthzSatdbDataSourcePrivate::maxDownloadDays
size_t maxDownloadDays
Definition: ethz_satdb_datasource.cpp:282
gnss_info::EthzSatdbDataSourcePrivate::getCacheFile
fs::path getCacheFile(const DayIndex &day) const
Definition: ethz_satdb_datasource.cpp:296


gnss_info
Author(s): Martin Pecka
autogenerated on Fri Nov 24 2023 03:50:35