mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-07-06 03:52:56 +00:00
Add more control when accessing Pvt_Solution members
This commit is contained in:
parent
6a2fe514d0
commit
2ca252c4d4
@ -652,63 +652,172 @@ void Pvt_Solution::set_num_valid_observations(int num)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Pvt_Solution::set_visible_satellites_ID(size_t index, unsigned int prn)
|
bool Pvt_Solution::set_visible_satellites_ID(size_t index, unsigned int prn)
|
||||||
{
|
{
|
||||||
d_visible_satellites_IDs[index] = prn;
|
if(index >= PVT_MAX_CHANNELS)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Setting sat ID to channel " << index << " (the maximum is " << PVT_MAX_CHANNELS << ")";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(prn >= PVT_MAX_PRN)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Setting to channel " << index << " a PRN of " << prn << " (the maximum is " << PVT_MAX_PRN << ")";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_visible_satellites_IDs[index] = prn;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int Pvt_Solution::get_visible_satellites_ID(size_t index) const
|
unsigned int Pvt_Solution::get_visible_satellites_ID(size_t index) const
|
||||||
{
|
{
|
||||||
return d_visible_satellites_IDs[index];
|
if(index >= PVT_MAX_CHANNELS)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Getting sat ID for channel " << index << " (the maximum is " << PVT_MAX_CHANNELS << ")";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return d_visible_satellites_IDs[index];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Pvt_Solution::set_visible_satellites_El(size_t index, double el)
|
bool Pvt_Solution::set_visible_satellites_El(size_t index, double el)
|
||||||
{
|
{
|
||||||
d_visible_satellites_El[index] = el;
|
if(index >= PVT_MAX_CHANNELS)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Setting sat elevation for channel " << index << " (the maximum is " << PVT_MAX_CHANNELS << ")";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(el > 90.0)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Setting a sat elevation > 90 [degrees]. Saturating to 90";
|
||||||
|
d_visible_satellites_El[index] = 90.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(el < -90.0)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Setting a sat elevation < -90 [degrees]. Saturating to -90";
|
||||||
|
d_visible_satellites_El[index] = -90.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_visible_satellites_El[index] = el;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double Pvt_Solution::get_visible_satellites_El(size_t index) const
|
double Pvt_Solution::get_visible_satellites_El(size_t index) const
|
||||||
{
|
{
|
||||||
return d_visible_satellites_El[index];
|
if(index >= PVT_MAX_CHANNELS)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Getting sat elevation for channel " << index << " (the maximum is " << PVT_MAX_CHANNELS << ")";
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return d_visible_satellites_El[index];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Pvt_Solution::set_visible_satellites_Az(size_t index, double az)
|
bool Pvt_Solution::set_visible_satellites_Az(size_t index, double az)
|
||||||
{
|
{
|
||||||
d_visible_satellites_Az[index] = az;
|
if(index >= PVT_MAX_CHANNELS)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Getting sat azimuth for channel " << index << " (the maximum is " << PVT_MAX_CHANNELS << ")";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_visible_satellites_Az[index] = az;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double Pvt_Solution::get_visible_satellites_Az(size_t index) const
|
double Pvt_Solution::get_visible_satellites_Az(size_t index) const
|
||||||
{
|
{
|
||||||
return d_visible_satellites_Az[index];
|
if(index >= PVT_MAX_CHANNELS)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Getting sat azimuth for channel " << index << " (the maximum is " << PVT_MAX_CHANNELS << ")";
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return d_visible_satellites_Az[index];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Pvt_Solution::set_visible_satellites_Distance(size_t index, double dist)
|
bool Pvt_Solution::set_visible_satellites_Distance(size_t index, double dist)
|
||||||
{
|
{
|
||||||
d_visible_satellites_Distance[index] = dist;
|
if(index >= PVT_MAX_CHANNELS)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Setting sat distance for channel " << index << " (the maximum is " << PVT_MAX_CHANNELS << ")";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_visible_satellites_Distance[index] = dist;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double Pvt_Solution::get_visible_satellites_Distance(size_t index) const
|
double Pvt_Solution::get_visible_satellites_Distance(size_t index) const
|
||||||
{
|
{
|
||||||
return d_visible_satellites_Distance[index];
|
if(index >= PVT_MAX_CHANNELS)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Getting sat distance for channel " << index << " (the maximum is " << PVT_MAX_CHANNELS << ")";
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return d_visible_satellites_Distance[index];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Pvt_Solution::set_visible_satellites_CN0_dB(size_t index, double cn0)
|
bool Pvt_Solution::set_visible_satellites_CN0_dB(size_t index, double cn0)
|
||||||
{
|
{
|
||||||
d_visible_satellites_CN0_dB[index] = cn0;
|
if(index >= PVT_MAX_CHANNELS)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Setting sat Cn0 for channel " << index << " (the maximum is " << PVT_MAX_CHANNELS << ")";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_visible_satellites_CN0_dB[index] = cn0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double Pvt_Solution::get_visible_satellites_CN0_dB(size_t index) const
|
double Pvt_Solution::get_visible_satellites_CN0_dB(size_t index) const
|
||||||
{
|
{
|
||||||
return d_visible_satellites_CN0_dB[index];
|
if(index >= PVT_MAX_CHANNELS)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Getting received CN0 for channel " << index << " (the maximum is " << PVT_MAX_CHANNELS << ")";
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return d_visible_satellites_CN0_dB[index];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,7 +37,8 @@
|
|||||||
#include <armadillo>
|
#include <armadillo>
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
|
|
||||||
#define PVT_MAX_CHANNELS 24
|
const unsigned int PVT_MAX_CHANNELS = 24;
|
||||||
|
const unsigned int PVT_MAX_PRN = 127; // 126 is SBAS
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Base class for a PVT solution
|
* \brief Base class for a PVT solution
|
||||||
@ -69,8 +70,6 @@ private:
|
|||||||
boost::posix_time::ptime d_position_UTC_time;
|
boost::posix_time::ptime d_position_UTC_time;
|
||||||
int d_valid_observations;
|
int d_valid_observations;
|
||||||
|
|
||||||
int d_visible_satellites_IDs[PVT_MAX_CHANNELS] = {}; // Array with the IDs of the valid satellites
|
|
||||||
|
|
||||||
arma::mat d_Q;
|
arma::mat d_Q;
|
||||||
double d_GDOP;
|
double d_GDOP;
|
||||||
double d_PDOP;
|
double d_PDOP;
|
||||||
@ -78,6 +77,7 @@ private:
|
|||||||
double d_VDOP;
|
double d_VDOP;
|
||||||
double d_TDOP;
|
double d_TDOP;
|
||||||
|
|
||||||
|
int d_visible_satellites_IDs[PVT_MAX_CHANNELS] = {}; // Array with the IDs of the valid satellites
|
||||||
double d_visible_satellites_El[PVT_MAX_CHANNELS] = {}; // Array with the LOS Elevation of the valid satellites
|
double d_visible_satellites_El[PVT_MAX_CHANNELS] = {}; // Array with the LOS Elevation of the valid satellites
|
||||||
double d_visible_satellites_Az[PVT_MAX_CHANNELS] = {}; // Array with the LOS Azimuth of the valid satellites
|
double d_visible_satellites_Az[PVT_MAX_CHANNELS] = {}; // Array with the LOS Azimuth of the valid satellites
|
||||||
double d_visible_satellites_Distance[PVT_MAX_CHANNELS] = {}; // Array with the LOS Distance of the valid satellites
|
double d_visible_satellites_Distance[PVT_MAX_CHANNELS] = {}; // Array with the LOS Distance of the valid satellites
|
||||||
@ -109,19 +109,19 @@ public:
|
|||||||
int get_num_valid_observations() const; //!< Get the number of valid pseudorange observations (valid satellites)
|
int get_num_valid_observations() const; //!< Get the number of valid pseudorange observations (valid satellites)
|
||||||
void set_num_valid_observations(int num); //!< Set the number of valid pseudorange observations (valid satellites)
|
void set_num_valid_observations(int num); //!< Set the number of valid pseudorange observations (valid satellites)
|
||||||
|
|
||||||
void set_visible_satellites_ID(size_t index, unsigned int prn); //!< Set the ID of the visible satellite index channel
|
bool set_visible_satellites_ID(size_t index, unsigned int prn); //!< Set the ID of the visible satellite index channel
|
||||||
unsigned int get_visible_satellites_ID(size_t index) const; //!< Get the ID of the visible satellite index channel
|
unsigned int get_visible_satellites_ID(size_t index) const; //!< Get the ID of the visible satellite index channel
|
||||||
|
|
||||||
void set_visible_satellites_El(size_t index, double el); //!< Set the LOS Elevation of the visible satellite index channel
|
bool set_visible_satellites_El(size_t index, double el); //!< Set the LOS Elevation, in degrees, of the visible satellite index channel
|
||||||
double get_visible_satellites_El(size_t index) const; //!< Get the LOS Elevation of the visible satellite index channel
|
double get_visible_satellites_El(size_t index) const; //!< Get the LOS Elevation, in degrees, of the visible satellite index channel
|
||||||
|
|
||||||
void set_visible_satellites_Az(size_t index, double az); //!< Set the LOS Azimuth of the visible satellite index channel
|
bool set_visible_satellites_Az(size_t index, double az); //!< Set the LOS Azimuth, in degrees, of the visible satellite index channel
|
||||||
double get_visible_satellites_Az(size_t index) const; //!< Get the LOS Azimuth of the visible satellite index channel
|
double get_visible_satellites_Az(size_t index) const; //!< Get the LOS Azimuth, in degrees, of the visible satellite index channel
|
||||||
|
|
||||||
void set_visible_satellites_Distance(size_t index, double dist); //!< Set the LOS Distance of the visible satellite index channel
|
bool set_visible_satellites_Distance(size_t index, double dist); //!< Set the LOS Distance of the visible satellite index channel
|
||||||
double get_visible_satellites_Distance(size_t index) const; //!< Get the LOS Distance of the visible satellite index channel
|
double get_visible_satellites_Distance(size_t index) const; //!< Get the LOS Distance of the visible satellite index channel
|
||||||
|
|
||||||
void set_visible_satellites_CN0_dB(size_t index, double cn0); //!< Set the CN0 in dB of the visible satellite index channel
|
bool set_visible_satellites_CN0_dB(size_t index, double cn0); //!< Set the CN0 in dB of the visible satellite index channel
|
||||||
double get_visible_satellites_CN0_dB(size_t index) const; //!< Get the CN0 in dB of the visible satellite index channel
|
double get_visible_satellites_CN0_dB(size_t index) const; //!< Get the CN0 in dB of the visible satellite index channel
|
||||||
|
|
||||||
//averaging
|
//averaging
|
||||||
|
Loading…
x
Reference in New Issue
Block a user