diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 279543f86a2a6ba9646bbdd06ad0be900f12af2e..4e8142104b7f1ff8f05d2cdfcb506540dd529344 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,7 +2,7 @@ SET(sources asterx1_gps.cpp stream_gps.cpp asterx1exceptions.cpp) # application header files -SET(headers asterx1_gps.h stream_gps.h asterx1exceptions.h) +SET(headers asterx1_gps.h stream_gps.h asterx1exceptions.h gps_types.h) # locate the the necessary dependencies FIND_PACKAGE(iriutils) diff --git a/src/asterx1_gps.cpp b/src/asterx1_gps.cpp index e86f097b9e527a1c6760c021bb8cbec5287a91d0..8db8c9dea0ca0ac6e0d5048bcd0642272901c4de 100644 --- a/src/asterx1_gps.cpp +++ b/src/asterx1_gps.cpp @@ -667,7 +667,14 @@ void CasteRx1::process_meas_epoch(unsigned char *data,unsigned short int length) this->current_meas_epoch.gps_timestamp.wnc=gps_meas_epoch.timestamp.wnc; this->current_meas_epoch.gps_timestamp.tow=gps_meas_epoch.timestamp.tow; this->current_meas_epoch.local_timestamp=this->local_time.getTimeInSeconds(); - this->current_meas_epoch.flags=gps_meas_epoch.common_flags; + if(gps_meas_epoch.common_flags&multipath_mitigation) + this->current_meas_epoch.multipath_mitigation=true; + else + this->current_meas_epoch.multipath_mitigation=false; + if(gps_meas_epoch.common_flags&smoothing_of_code) + this->current_meas_epoch.smoothing_of_code=true; + else + this->current_meas_epoch.smoothing_of_code=false; this->current_meas_epoch.type1_data.clear(); for(i=0;i<gps_meas_epoch.num_type1;i++) { diff --git a/src/examples/testasterx1.cpp b/src/examples/testasterx1.cpp index a4d601c9eb845a57a34116726b6bfcaeadda2486..b71fc0255e84129ceb7ce4d174990db594463078 100644 --- a/src/examples/testasterx1.cpp +++ b/src/examples/testasterx1.cpp @@ -105,102 +105,5 @@ int main(int argc, char **argv) std::cout << e.what() << std::endl; } - //cout << "acqPeriodValues[ONCHANGE]: " << acqPeriodValues[ONCHANGE] << endl; - - // Argument management -/* while ((opt = getopt(argc, argv, "u:n:r:h?"))!= -1) - { - switch (opt) - { - case 'u': // change USB device - serial_device = optarg; - break; - case 'n': - nIterations = atoi(optarg); - break; - case 'r': - rate = atoi(optarg); - break; - case '?': // help - case 'h': - default: - cout << " USAGE" << endl - << " " << argv[0] << " [options]" << endl - << " OPTIONS" << endl - << " -u SERIAL_DEVICE (default: " << serial_device << ")" << endl - << " -n NUMBER OF ITERATIONS (default: " << nIterations << ")" << endl - << " -r ACQUISITION RATE: (default: " << rate << ")" << endl; - for (ii=0; ii<10; ii++) - { - cout << " " << ii << ": " << acqPeriodValues[ii] << endl; - } - cout << endl; - return 1; - } - } - - myGps = new CasteRx1(serial_device,rate); - - myGps->setMapOrigin(41.388595, 2.113133, 120, 44.2); //sets map origin for coordinate transformation - //myGps->printTM(); //prints to stdout the transformation matrix - - retValue = myGps->openDevice();//open device comm's - - retValue = myGps->closeDevice();//close device comm's (stressing tests ...) - retValue = myGps->openDevice();//open device comm's, again - - myGps->setPortName("/dev/ttyS1"); //checking that when device is open, port configuration can't be achieved - myGps->setAcquisitionRate(56); //checking that when invalid rate indexes prdouces an error and don't change the rate - myGps->setAcquisitionRate(SEC2); //checking that when device is open rate configuration can be achieved - myGps->setAcquisitionRate(rate); //checking that when device is open rate configuration can be achieved - - if ( retValue == BASIC_SUCCESS ) - { - retValue = myGps->startAcquisition();//start data acquisition - retValue = myGps->stopAcquisition();//stop data acquisition (stressing tests ...) - retValue = myGps->startAcquisition();//start data acquisition, again - if ( retValue == BASIC_SUCCESS ) - { - for (ii=0; ii<nIterations; ii++) - { - cout << endl; - myGps->readDataFromDevice(); - //myGps->printData(cout); //prints to cout all current data in a single row. (cout can be repolaced by another ostream object reference) - cout << "Status = " << myGps->getStatus() << endl; - tsDigits=cout.precision(12); - cout << "TimeStamp = " << myGps->getTimeStamp() << endl; - cout.precision(tsDigits); - cout << "PVT error = " << myGps->getPVTerror() << endl; - cout << "TOW = " << myGps->getTow() << endl; - - if ( myGps->getStatus() == ALL_OK ) - { - cout << "Num Of Satellites = " << myGps->getNumSatellites() << endl; - tsDigits=cout.precision(12); - cout << "lat = " << myGps->getLat(inDEGREES) << endl; - cout << "lon = " << myGps->getLon(inDEGREES) << endl; - cout.precision(tsDigits); - cout << "alt = " << myGps->getAlt() << endl; - cout << "xWgs = " << myGps->getXWgs() << endl; - cout << "yWgs = " << myGps->getYWgs() << endl; - cout << "zWgs = " << myGps->getZWgs() << endl; - cout << "xMap = " << myGps->getXMap() << endl; - cout << "yMap = " << myGps->getYMap() << endl; - cout << "zMap = " << myGps->getZMap() << endl; - cout << "vxMap = " << myGps->getVxMap() << endl; - cout << "vyMap = " << myGps->getVyMap() << endl; - cout << "vzMap = " << myGps->getVzMap() << endl; - cout << "PDOP = " << myGps->getPDOP() << endl; - } - } - - retValue = myGps->stopAcquisition(); - } - - retValue = myGps->closeDevice(); - } - - delete myGps;*/ - return 0; } diff --git a/src/gps_types.h b/src/gps_types.h index cb53834830f51bbf6b582af5f46d16cd5ca785d6..1a70bc7c3255feeab5eea0bb47b28544eba19234 100644 --- a/src/gps_types.h +++ b/src/gps_types.h @@ -157,7 +157,8 @@ enum {multipath_mitigation=0x01,smoothing_of_code=0x02}; typedef struct{ TBlockTimeStamp gps_timestamp; double local_timestamp; - unsigned int flags; + bool multipath_mitigation; + bool smoothing_of_code; std::vector<TMeasEpochType1> type1_data; }TMeasEpoch; diff --git a/src/stream_gps.cpp b/src/stream_gps.cpp index f9a7dd4a20bff0adc403348ba751261d487721ca..447ba142da6057959f46e89c54928c951f7ed3cc 100644 --- a/src/stream_gps.cpp +++ b/src/stream_gps.cpp @@ -6,11 +6,11 @@ std::ostream& operator<< (std::ostream& out, TMeasEpoch &meas_epoch) unsigned int i,j; out << "Common flags: " << std::endl; - if(meas_epoch.flags&multipath_mitigation) + if(meas_epoch.multipath_mitigation) out << " Multipath mitigation enabled" << std::endl; else out << " Multipath mitigation disabled" << std::endl; - if(meas_epoch.flags&smoothing_of_code) + if(meas_epoch.smoothing_of_code) out << " At least one of the code measurements is smoothed" << std::endl; else out << " None of the code measurements are smoothed" << std::endl;