mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 04:30:33 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next
This commit is contained in:
commit
dfdac8fb57
@ -536,23 +536,31 @@ RtklibPvt::~RtklibPvt()
|
||||
rtkfree(&rtk);
|
||||
}
|
||||
|
||||
std::map<int, Gps_Ephemeris> RtklibPvt::get_gps_ephemeris()
|
||||
|
||||
std::map<int, Gps_Ephemeris> RtklibPvt::get_gps_ephemeris() const
|
||||
{
|
||||
return pvt_->get_gps_ephemeris_map();
|
||||
}
|
||||
std::map<int, Galileo_Ephemeris> RtklibPvt::get_galileo_ephemeris()
|
||||
|
||||
|
||||
std::map<int, Galileo_Ephemeris> RtklibPvt::get_galileo_ephemeris() const
|
||||
{
|
||||
return pvt_->get_galileo_ephemeris_map();
|
||||
}
|
||||
std::map<int, Gps_Almanac> RtklibPvt::get_gps_almanac()
|
||||
|
||||
|
||||
std::map<int, Gps_Almanac> RtklibPvt::get_gps_almanac() const
|
||||
{
|
||||
return pvt_->get_gps_almanac_map();
|
||||
}
|
||||
std::map<int, Galileo_Almanac> RtklibPvt::get_galileo_almanac()
|
||||
|
||||
|
||||
std::map<int, Galileo_Almanac> RtklibPvt::get_galileo_almanac() const
|
||||
{
|
||||
return pvt_->get_galileo_almanac_map();
|
||||
}
|
||||
|
||||
|
||||
void RtklibPvt::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if (top_block)
|
||||
|
@ -64,10 +64,10 @@ public:
|
||||
}
|
||||
|
||||
void clear_ephemeris() override;
|
||||
std::map<int, Gps_Ephemeris> get_gps_ephemeris() override;
|
||||
std::map<int, Galileo_Ephemeris> get_galileo_ephemeris() override;
|
||||
std::map<int, Gps_Almanac> get_gps_almanac() override;
|
||||
std::map<int, Galileo_Almanac> get_galileo_almanac() override;
|
||||
std::map<int, Gps_Ephemeris> get_gps_ephemeris() const override;
|
||||
std::map<int, Galileo_Ephemeris> get_galileo_ephemeris() const override;
|
||||
std::map<int, Gps_Almanac> get_gps_almanac() const override;
|
||||
std::map<int, Galileo_Almanac> get_galileo_almanac() const override;
|
||||
|
||||
void connect(gr::top_block_sptr top_block) override;
|
||||
void disconnect(gr::top_block_sptr top_block) override;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -111,8 +111,9 @@ private:
|
||||
bool d_geojson_output_enabled;
|
||||
bool d_gpx_output_enabled;
|
||||
bool d_kml_output_enabled;
|
||||
bool d_nmea_output_file_enabled;
|
||||
|
||||
std::shared_ptr<rtklib_solver> d_ls_pvt;
|
||||
std::shared_ptr<rtklib_solver> d_pvt_solver;
|
||||
|
||||
std::map<int, Gnss_Synchro> gnss_observables_map;
|
||||
bool observables_pairCompare_min(const std::pair<int, Gnss_Synchro>& a, const std::pair<int, Gnss_Synchro>& b);
|
||||
@ -152,13 +153,13 @@ public:
|
||||
* \brief Get latest set of ephemeris from PVT block
|
||||
*
|
||||
*/
|
||||
std::map<int, Gps_Ephemeris> get_gps_ephemeris_map();
|
||||
std::map<int, Gps_Ephemeris> get_gps_ephemeris_map() const;
|
||||
|
||||
std::map<int, Gps_Almanac> get_gps_almanac_map();
|
||||
std::map<int, Gps_Almanac> get_gps_almanac_map() const;
|
||||
|
||||
std::map<int, Galileo_Ephemeris> get_galileo_ephemeris_map();
|
||||
std::map<int, Galileo_Ephemeris> get_galileo_ephemeris_map() const;
|
||||
|
||||
std::map<int, Galileo_Almanac> get_galileo_almanac_map();
|
||||
std::map<int, Galileo_Almanac> get_galileo_almanac_map() const;
|
||||
|
||||
/*!
|
||||
* \brief Clear all ephemeris information and the almanacs for GPS and Galileo
|
||||
@ -166,7 +167,6 @@ public:
|
||||
*/
|
||||
void clear_ephemeris();
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Get the latest Position WGS84 [deg], Ground Velocity, Course over Ground, and UTC Time, if available
|
||||
*/
|
||||
|
@ -338,7 +338,7 @@ bool hybrid_ls_pvt::get_PVT(std::map<int, Gnss_Synchro> gnss_observables_map, do
|
||||
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||
this->set_position_UTC_time(p_time);
|
||||
|
||||
cart2geo(static_cast<double>(rx_position_and_time(0)), static_cast<double>(rx_position_and_time(1)), static_cast<double>(rx_position_and_time(2)), 4);
|
||||
cart_to_geo(static_cast<double>(rx_position_and_time(0)), static_cast<double>(rx_position_and_time(1)), static_cast<double>(rx_position_and_time(2)), 4);
|
||||
|
||||
DLOG(INFO) << "Hybrid Position at " << boost::posix_time::to_simple_string(p_time)
|
||||
<< " is Lat = " << this->get_latitude() << " [deg], Long = " << this->get_longitude()
|
||||
|
@ -87,49 +87,13 @@ arma::vec Pvt_Solution::rotateSatellite(double const traveltime, const arma::vec
|
||||
}
|
||||
|
||||
|
||||
int Pvt_Solution::cart2geo(double X, double Y, double Z, int elipsoid_selection)
|
||||
int Pvt_Solution::cart_to_geo(double X, double Y, double Z, int elipsoid_selection)
|
||||
{
|
||||
/* Conversion of Cartesian coordinates (X,Y,Z) to geographical
|
||||
coordinates (latitude, longitude, h) on a selected reference ellipsoid.
|
||||
|
||||
Choices of Reference Ellipsoid for Geographical Coordinates
|
||||
0. International Ellipsoid 1924
|
||||
1. International Ellipsoid 1967
|
||||
2. World Geodetic System 1972
|
||||
3. Geodetic Reference System 1980
|
||||
4. World Geodetic System 1984
|
||||
*/
|
||||
|
||||
const double a[5] = {6378388.0, 6378160.0, 6378135.0, 6378137.0, 6378137.0};
|
||||
const double f[5] = {1.0 / 297.0, 1.0 / 298.247, 1.0 / 298.26, 1.0 / 298.257222101, 1.0 / 298.257223563};
|
||||
|
||||
double lambda = atan2(Y, X);
|
||||
double ex2 = (2.0 - f[elipsoid_selection]) * f[elipsoid_selection] / ((1.0 - f[elipsoid_selection]) * (1.0 - f[elipsoid_selection]));
|
||||
double c = a[elipsoid_selection] * sqrt(1.0 + ex2);
|
||||
double phi = atan(Z / ((sqrt(X * X + Y * Y) * (1.0 - (2.0 - f[elipsoid_selection])) * f[elipsoid_selection])));
|
||||
|
||||
double h = 0.1;
|
||||
double oldh = 0.0;
|
||||
double N;
|
||||
int iterations = 0;
|
||||
do
|
||||
{
|
||||
oldh = h;
|
||||
N = c / sqrt(1 + ex2 * (cos(phi) * cos(phi)));
|
||||
phi = atan(Z / ((sqrt(X * X + Y * Y) * (1.0 - (2.0 - f[elipsoid_selection]) * f[elipsoid_selection] * N / (N + h)))));
|
||||
h = sqrt(X * X + Y * Y) / cos(phi) - N;
|
||||
iterations = iterations + 1;
|
||||
if (iterations > 100)
|
||||
{
|
||||
DLOG(WARNING) << "Failed to approximate h with desired precision. h-oldh= " << h - oldh;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (std::abs(h - oldh) > 1.0e-12);
|
||||
d_latitude_d = phi * 180.0 / GPS_PI;
|
||||
d_longitude_d = lambda * 180.0 / GPS_PI;
|
||||
d_height_m = h;
|
||||
//todo: refactor this class. Mix of duplicated functions, use either RTKLIB geodetic functions or geofunctions.h
|
||||
arma::vec XYZ = {X, Y, Z};
|
||||
arma::vec LLH = cart2geo(XYZ, elipsoid_selection);
|
||||
d_latitude_d = LLH(0) * 180.0 / GPS_PI;
|
||||
d_longitude_d = LLH(1) * 180.0 / GPS_PI;
|
||||
d_height_m = LLH(2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public:
|
||||
* 4 - World Geodetic System 1984.
|
||||
*
|
||||
*/
|
||||
int cart2geo(double X, double Y, double Z, int elipsoid_selection);
|
||||
int cart_to_geo(double X, double Y, double Z, int elipsoid_selection);
|
||||
|
||||
/*!
|
||||
* \brief Tropospheric correction
|
||||
|
@ -99,6 +99,7 @@ rtklib_solver::rtklib_solver(int nchannels, std::string dump_filename, bool flag
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool rtklib_solver::save_matfile()
|
||||
{
|
||||
// READ DUMP FILE
|
||||
@ -395,6 +396,7 @@ bool rtklib_solver::save_matfile()
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
rtklib_solver::~rtklib_solver()
|
||||
{
|
||||
if (d_dump_file.is_open() == true)
|
||||
@ -868,7 +870,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
p_time = boost::posix_time::from_time_t(rtklib_utc_time.time);
|
||||
p_time += boost::posix_time::microseconds(static_cast<long>(round(rtklib_utc_time.sec * 1e6)));
|
||||
this->set_position_UTC_time(p_time);
|
||||
cart2geo(static_cast<double>(rx_position_and_time(0)), static_cast<double>(rx_position_and_time(1)), static_cast<double>(rx_position_and_time(2)), 4);
|
||||
cart_to_geo(static_cast<double>(rx_position_and_time(0)), static_cast<double>(rx_position_and_time(1)), static_cast<double>(rx_position_and_time(2)), 4);
|
||||
|
||||
DLOG(INFO) << "RTKLIB Position at " << boost::posix_time::to_simple_string(p_time)
|
||||
<< " is Lat = " << this->get_latitude() << " [deg], Long = " << this->get_longitude()
|
||||
|
@ -301,7 +301,7 @@ double mstokph(double MetersPerSeconds)
|
||||
arma::vec CTM_to_Euler(const arma::mat &C)
|
||||
{
|
||||
// Calculate Euler angles using (2.23)
|
||||
arma::mat CTM = C;
|
||||
arma::mat CTM(C);
|
||||
arma::vec eul = arma::zeros(3, 1);
|
||||
eul(0) = atan2(CTM(1, 2), CTM(2, 2)); // roll
|
||||
if (CTM(0, 2) < -1.0) CTM(0, 2) = -1.0;
|
||||
|
@ -57,10 +57,10 @@ class PvtInterface : public GNSSBlockInterface
|
||||
public:
|
||||
virtual void reset() = 0;
|
||||
virtual void clear_ephemeris() = 0;
|
||||
virtual std::map<int, Gps_Ephemeris> get_gps_ephemeris() = 0;
|
||||
virtual std::map<int, Galileo_Ephemeris> get_galileo_ephemeris() = 0;
|
||||
virtual std::map<int, Gps_Almanac> get_gps_almanac() = 0;
|
||||
virtual std::map<int, Galileo_Almanac> get_galileo_almanac() = 0;
|
||||
virtual std::map<int, Gps_Ephemeris> get_gps_ephemeris() const = 0;
|
||||
virtual std::map<int, Galileo_Ephemeris> get_galileo_ephemeris() const = 0;
|
||||
virtual std::map<int, Gps_Almanac> get_gps_almanac() const = 0;
|
||||
virtual std::map<int, Galileo_Almanac> get_galileo_almanac() const = 0;
|
||||
|
||||
virtual bool get_latest_PVT(double* longitude_deg,
|
||||
double* latitude_deg,
|
||||
|
@ -94,6 +94,7 @@ ControlThread::ControlThread(std::shared_ptr<ConfigurationInterface> configurati
|
||||
{
|
||||
configuration_ = configuration;
|
||||
delete_configuration_ = false;
|
||||
restart_ = false;
|
||||
init();
|
||||
}
|
||||
|
||||
@ -112,6 +113,7 @@ void ControlThread::telecommand_listener()
|
||||
cmd_interface_.run_cmd_server(tcp_cmd_port);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Runs the control thread that manages the receiver control plane
|
||||
*
|
||||
@ -164,7 +166,6 @@ int ControlThread::run()
|
||||
cmd_interface_.set_pvt(flowgraph_->get_pvt());
|
||||
cmd_interface_thread_ = boost::thread(&ControlThread::telecommand_listener, this);
|
||||
|
||||
|
||||
bool enable_FPGA = configuration_->property("Channel.enable_FPGA", false);
|
||||
if (enable_FPGA == true)
|
||||
{
|
||||
@ -764,7 +765,8 @@ void ControlThread::apply_action(unsigned int what)
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::pair<int, Gnss_Satellite>> ControlThread::get_visible_sats(time_t rx_utc_time, arma::vec LLH)
|
||||
|
||||
std::vector<std::pair<int, Gnss_Satellite>> ControlThread::get_visible_sats(time_t rx_utc_time, const arma::vec &LLH)
|
||||
{
|
||||
// 1. Compute rx ECEF position from LLH WGS84
|
||||
arma::vec LLH_rad = arma::vec{degtorad(LLH(0)), degtorad(LLH(1)), LLH(2)};
|
||||
@ -779,7 +781,7 @@ std::vector<std::pair<int, Gnss_Satellite>> ControlThread::get_visible_sats(time
|
||||
utc_gtime.sec = 0;
|
||||
gtime_t gps_gtime = utc2gpst(utc_gtime);
|
||||
|
||||
//2. loop throught all the available ephemeris or almanac and compute satellite positions and elevations
|
||||
// 3. loop through all the available ephemeris or almanac and compute satellite positions and elevations
|
||||
// store visible satellites in a vector of pairs <int,Gnss_Satellite> to associate an elevation to the each satellite
|
||||
std::vector<std::pair<int, Gnss_Satellite>> available_satellites;
|
||||
|
||||
|
@ -148,8 +148,8 @@ private:
|
||||
* Compute elevations for the specified time and position for all the available satellites in ephemeris and almanac queues
|
||||
* returns a vector filled with the available satellites ordered from high elevation to low elevation angle.
|
||||
*/
|
||||
std::vector<std::pair<int, Gnss_Satellite>> get_visible_sats(time_t rx_utc_time, const arma::vec& LLH);
|
||||
|
||||
std::vector<std::pair<int, Gnss_Satellite>> get_visible_sats(time_t rx_utc_time, arma::vec LLH);
|
||||
/*
|
||||
* Read initial GNSS assistance from SUPL server or local XML files
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user