Commit 57ea8cf5 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Made available the GPS RAW subframes needed to compute the Ephemeris.

parent 166b8896
......@@ -700,7 +700,7 @@ void CasteRx1::process_gps_raw_ca(unsigned char *data,unsigned short int length)
for(i=0;i<10;i++)
new_frame.frame_bits[i]=gps_raw_ca.nav_bits[i];
this->gps_raw_frames.push(new_frame);
this->event_server->set_event(new_gps_raw_block_event_id);
this->event_server->set_event(this->new_gps_raw_block_event_id);
this->nav_access.exit();
}
......
......@@ -64,8 +64,19 @@ void CAsteRx1Process::generate_gps_nav(gpstk::EngEphemeris &ephemeris,TGPSNav &g
}
}
unsigned int CAsteRx1Process::get_subframe_id(TGPSFrame &frame)
{
unsigned long int SFword2=(unsigned long int)frame.frame_bits[1];
SFword2&=0x00000700;// Strip all but three bit subframe ID
SFword2>>=8;// Right shift to move to lsbs;
return SFword2;
}
void CAsteRx1Process::add_subframe(TGPSFrame &frame)
{
TGPSFrames gps_frames;
unsigned int i=0,j=0;
TGPSNav gps_nav;
try{
......@@ -87,7 +98,16 @@ void CAsteRx1Process::add_subframe(TGPSFrame &frame)
// process the data and build a GPSNav structure
this->generate_gps_nav(this->ephemeris_data[frame.sat_id].ephemeris,gps_nav);
gps_nav.local_timestamp=frame.local_timestamp;
gps_frames.wn=this->ephemeris_data[frame.sat_id].ephemeris.weeknum;
gps_frames.sat_id=this->ephemeris_data[frame.sat_id].ephemeris.PRNID;
gps_frames.track_id=this->ephemeris_data[frame.sat_id].ephemeris.tracker;
for(i=0;i<3;i++)
{
for(j=0;j<10;j++)
gps_frames.subframes[i][j]=this->ephemeris_data[frame.sat_id].ephemeris.subframeStore[i][j];
}
this->gps_nav_data.push(gps_nav);
this->gps_raw_data.push(gps_frames);
}
}
}catch(gpstk::InvalidParameter &e){
......@@ -107,12 +127,14 @@ bool CAsteRx1Process::is_new_gps_nav_data_available(void)
return false;
}
void CAsteRx1Process::get_gps_nav_data(TGPSNav &gps_nav)
void CAsteRx1Process::get_gps_nav_data(TGPSNav &gps_nav,TGPSFrames &frames)
{
if(this->gps_nav_data.size()>0)
{
gps_nav=this->gps_nav_data.front();
this->gps_nav_data.pop();
frames=this->gps_raw_data.front();
this->gps_raw_data.pop();
}
}
......
......@@ -16,13 +16,15 @@ class CAsteRx1Process
private:
std::vector<TEphemerisData> ephemeris_data;
std::queue<TGPSNav> gps_nav_data;
std::queue<TGPSFrames> gps_raw_data;
protected:
void generate_gps_nav(gpstk::EngEphemeris &ephemeris,TGPSNav &gps_nav);
public:
CAsteRx1Process();
static unsigned int get_subframe_id(TGPSFrame &frame);
void add_subframe(TGPSFrame &frame);
bool is_new_gps_nav_data_available(void);
void get_gps_nav_data(TGPSNav &gps_nav);
void get_gps_nav_data(TGPSNav &gps_nav,TGPSFrames &frames);
~CAsteRx1Process();
};
......
......@@ -40,6 +40,7 @@ int main(int argc, char **argv)
#ifdef HAVE_GPSTK
CAsteRx1Process gps_process;
TGPSFrame gps_frame;
TGPSFrames gps_frames;
TGPSNav gps_nav;
#else
TGPSNav gps_nav;
......@@ -81,7 +82,7 @@ int main(int argc, char **argv)
gps_process.add_subframe(gps_frame);
if(gps_process.is_new_gps_nav_data_available())
{
gps_process.get_gps_nav_data(gps_nav);
gps_process.get_gps_nav_data(gps_nav,gps_frames);
std::cout << gps_nav << std::endl;
}
}
......
......@@ -2,12 +2,12 @@
#define _GPS_TYPES_H
// global satellite information
typedef struct{
typedef struct {
unsigned int tow;
unsigned short int wnc;
}TBlockTimeStamp;
typedef struct{
typedef struct {
TBlockTimeStamp gps_timestamp;
double local_timestamp;
long int frame_bits[10];
......@@ -16,6 +16,13 @@ typedef struct{
short int track_id;
}TGPSFrame;
typedef struct {
long int subframes[3][10];
int wn;
short int sat_id;
short int track_id;
}TGPSFrames;
// User data structures
typedef enum {elev_setting=0,elev_rising=1,elev_unknown=3} rise_set_t;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment