-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gnss_info: Refactored out NavLibraryOrbitalDataProvider.
- Loading branch information
Showing
12 changed files
with
585 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// SPDX-FileCopyrightText: Czech Technical University in Prague | ||
|
||
#pragma once | ||
|
||
#include <memory> | ||
#include <string> | ||
#include <unordered_map> | ||
#include <unordered_set> | ||
#include <utility> | ||
|
||
#include <gnss_info/nav_library_data_source.h> | ||
#include <gnss_info_msgs/SatelliteInfo.h> | ||
|
||
#include <ros/time.h> | ||
|
||
namespace gnss_info | ||
{ | ||
|
||
struct EthzSatdbDataSourcePrivate; | ||
|
||
/** | ||
* \brief GNSSTk NavLibrary data source downloading TLE data from ETHZ Satellite Database. | ||
*/ | ||
class EthzSatdbDataSource : public NavLibraryDataSource | ||
{ | ||
public: | ||
explicit EthzSatdbDataSource(const std::unordered_map<uint32_t, gnss_info_msgs::SatelliteInfo>& satelliteInfo); | ||
~EthzSatdbDataSource() override; | ||
|
||
std::string getName() const override; | ||
bool isPrecise() const override; | ||
bool isApproximate() const override; | ||
|
||
std::pair<ros::Time, ros::Time> getTimeRange() const override; | ||
std::unordered_set<std::string> getConstellations() const override; | ||
|
||
bool load(const ros::Time& time, const DataSourceLoadCb& cb) override; | ||
bool load(const ros::Time& startTime, const ros::Time& endTime, const DataSourceLoadCb& cb) override; | ||
|
||
private: | ||
std::unique_ptr<EthzSatdbDataSourcePrivate> data; //!< Private implementation data (PIMPL). | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// SPDX-FileCopyrightText: Czech Technical University in Prague | ||
|
||
#pragma once | ||
|
||
#include <functional> | ||
#include <string> | ||
#include <unordered_set> | ||
#include <utility> | ||
|
||
#include <ros/time.h> | ||
|
||
|
||
namespace gnss_info | ||
{ | ||
|
||
/** | ||
* \brief Generic interface for various data sources for gnsstk::NavLibrary. | ||
*/ | ||
class NavLibraryDataSource | ||
{ | ||
public: | ||
/** | ||
* \brief Callback to be called when a new source file is introduced. | ||
* \param[in] file Path to the source file. | ||
* \return Whether reading the source file succeeded. | ||
*/ | ||
typedef std::function<bool(const std::string& file)> DataSourceLoadCb; | ||
|
||
/** | ||
* \brief Construct the data source. | ||
* | ||
* Also make sure the data source is registered via gnsstk::MultiFormatNavDataFactory::addFactory() (but only once). | ||
*/ | ||
NavLibraryDataSource() = default; | ||
|
||
virtual ~NavLibraryDataSource() = default; | ||
|
||
/** | ||
* \brief Get human-readable name of the data source. | ||
* \return The name. | ||
*/ | ||
virtual std::string getName() const = 0; | ||
|
||
/** | ||
* \brief Return whether this datasource works with precise orbit data. | ||
* \return Whether this datasource works with precise orbit data. | ||
*/ | ||
virtual bool isPrecise() const = 0; | ||
|
||
/** | ||
* \brief Return whether this datasource works with approximate orbit data. | ||
* \return Whether this datasource works with approximate orbit data. | ||
*/ | ||
virtual bool isApproximate() const = 0; | ||
|
||
/** | ||
* \brief Get the time range in which this datasource can provide information. | ||
* \return The time range (first, latest). | ||
*/ | ||
virtual std::pair<ros::Time, ros::Time> getTimeRange() const = 0; | ||
|
||
/** | ||
* \brief Get the constellations handled by this data source. | ||
* \return The constellations. | ||
*/ | ||
virtual std::unordered_set<std::string> getConstellations() const = 0; | ||
|
||
/** | ||
* \brief Load data for the given time instant. | ||
* \param[in] time The time to load at. | ||
* \param[in] cb Callback to call for each found and downloaded data file. | ||
* \return Whether loading succeeded. | ||
*/ | ||
virtual bool load(const ros::Time& time, const DataSourceLoadCb& cb) = 0; | ||
|
||
/** | ||
* \brief Load data for the given time interval. | ||
* \param[in] startTime The time to start loading at. | ||
* \param[in] endTime The time to stop loading at. | ||
* \param[in] cb Callback to call for each found and downloaded data file. | ||
* \return Whether loading succeeded. | ||
*/ | ||
virtual bool load(const ros::Time& startTime, const ros::Time& endTime, const DataSourceLoadCb& cb) = 0; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.