Compare commits

...

1 Commits

10 changed files with 241 additions and 30 deletions

View File

@ -1,6 +1,6 @@
CFLAGS = -O3 -Wall -ggdb
CXXFLAGS:= -std=gnu++17 -Wall -O3 -ggdb -MMD -MP -fno-omit-frame-pointer -Iext/CLI11 \
CXXFLAGS:= -std=gnu++17 -Wall -O0 -ggdb -MMD -MP -fno-omit-frame-pointer -Iext/CLI11 \
-Iext/fmt-6.1.2/include/ -Iext/powerblog/ext/simplesocket -Iext/powerblog/ext/ \
-I/usr/local/opt/openssl/include/ \
-Iext/sgp4/libsgp4/ \
@ -27,6 +27,8 @@ CHEAT_ARG := $(shell ./update-git-hash-if-necessary)
PROGRAMS = navparse ubxtool navnexus navcat navrecv navdump testrunner navdisplay tlecatch reporter sp3feed \
galmonmon rinreport rinjoin rtcmtool gndate septool navmerge
PROGRAMS_d = ubxtool
all: navmon.pb.cc $(PROGRAMS)
-include Makefile.local

View File

@ -25,6 +25,11 @@ bool getTOWFromInav(std::basic_string_view<uint8_t> inav, uint32_t *satTOW, uint
return false;
}
bool getTOWFromFnav(std::basic_string_view<uint8_t> fnav, uint32_t *satTOW, uint16_t *wn)
{
return false;
}
int GalileoMessage::parseFnav(std::basic_string_view<uint8_t> page)
{
const uint8_t* ptr = &page[0];

View File

@ -7,6 +7,7 @@
#include "bits.hh"
bool getTOWFromInav(std::basic_string_view<uint8_t> inav, uint32_t *satTOW, uint16_t *wn);
bool getTOWFromFnav(std::basic_string_view<uint8_t> fnav, uint32_t *satTOW, uint16_t *wn);
struct GalileoMessage : GPSLikeEphemeris
{

View File

@ -61,7 +61,7 @@ function maketable(str, arr)
else if(row["gnssid"] == 6)
img='ext/glo.png';
ret.value = '<img width="16" height="16" src="https://berthub.eu/tmp/'+ img +'"/>';
ret.value = '<img width="16" height="16" src="https://gpsmon.us/'+ img +'"/>';
// ret.value="";
ret.value += "&nbsp;<a href='sv.html?gnssid="+row.gnssid+"&sv="+row.svid+"&sigid="+row.sigid+"'>"+row.sv+"</a>";
}
@ -303,6 +303,8 @@ function updateSats()
wantIt = true;
if(d3.select("#GPSL2C").property("checked") && arr[n].gnssid==0 && arr[n].sigid == 4)
wantIt = true;
if(d3.select("#GPSL5").property("checked") && arr[n].gnssid==0 && arr[n].sigid == 6)
wantIt = true;
if(d3.select("#BeiDouB1I").property("checked") && arr[n].gnssid==3 && arr[n].sigid == 0)
wantIt = true;
if(d3.select("#BeiDouB2I").property("checked") && arr[n].gnssid==3 && arr[n].sigid == 2)
@ -311,6 +313,10 @@ function updateSats()
wantIt = true;
if(d3.select("#GlonassL2").property("checked") && arr[n].gnssid==6 && arr[n].sigid == 2)
wantIt = true;
if(d3.select("#NAVICL5").property("checked") && arr[n].gnssid==98 && arr[n].sigid == 6)
wantIt = true;
if(d3.select("#QZSSL5").property("checked") && arr[n].gnssid==99 && arr[n].sigid == 6)
wantIt = true;
if(!wantIt)
continue;
@ -383,7 +389,7 @@ function setButtonSetting(name)
localStorage.setItem("want"+name, d3.select("#"+name).property("checked"));
}
var modes=["GalE1", "GalE5b", "GPSL1CA", "GPSL2C", "BeiDouB1I", "BeiDouB2I", "GlonassL1", "GlonassL2"];
var modes=["GalE1", "GalE5b", "GalE5a", "GPSL1CA", "GPSL2C", "GPSL5", "BeiDouB1I", "BeiDouB2I", "GlonassL1", "GlonassL2", "NAVICL5", "QZSSL5"];
function setButtonSettings()
{

View File

@ -18,6 +18,9 @@
<input type="checkbox" id="GlonassL2" onclick="updateSats();"> <label for="GlonassL2">Glonass L2</label> &nbsp;&nbsp;
<input type="checkbox" id="GPSL1CA" onclick="updateSats();"> <label for="GPSL1CA">GPS L1C/A</label> &nbsp;&nbsp;
<input type="checkbox" id="GPSL2C" onclick="updateSats();"> <label for="GPSL2C">GPS L2C</label>
<input type="checkbox" id="GPSL5" onclick="updateSats();"> <label for="GPSL5">GPS L5</label>
<input type="checkbox" id="NAVICL5" onclick="updateSats();"> <label for="NAVICL5">NavIC L5</label>
<input type="checkbox" id="QZSSL5" onclick="updateSats();"> <label for="QZSSL5">QZSS L5</label>
</div>
<hr/>
<table id="svs"></table>

View File

@ -154,7 +154,7 @@ int main(int argc, char** argv)
CLI::App app(program);
string localAddress("127.0.0.1");
int hours = 4;
int hours = 1;
app.add_flag("--version", doVERSION, "show program version and copyright");
app.add_option("--bind,-b", localAddress, "Address:port to bind to");
app.add_option("--storage,-s", g_storage, "Location of storage files");

View File

@ -39,6 +39,8 @@
#include "version.hh"
//#include "nequick.hh"
bool doDEBUG{true};
static char program[]="navparse";
using namespace std;
@ -818,6 +820,7 @@ try
item["hna"] = ae.second.second.hna;
item["observed"] = false;
// ptudor glonass
for(uint32_t sigid : {0,1,2}) { // XXX SIGIDS
if(auto iter = svstats.find({6, (uint32_t)ae.first, sigid}); iter != svstats.end()) {
if(time(0) - nanoTime(6, iter->second.wn(), iter->second.tow())/1000000000 < 300) {
@ -872,7 +875,8 @@ try
item["observed"] = false;
for(uint32_t sigid : {0,1,5}) {
// ptudor gal
for(uint32_t sigid : {0,1,5,6}) {
if(auto iter = svstats.find({2, (uint32_t)ae.first, sigid}); iter != svstats.end()) {
if(iter->second.completeIOD()) {
@ -937,7 +941,8 @@ try
item["eph-latitude"]= 180*longlat.second/M_PI;
item["observed"] = false;
for(uint32_t sigid : {0,1,4}) {
// ptudor gps
for(uint32_t sigid : {0,1,4,6}) {
if(auto iter = svstats.find({0, (uint32_t)ae.first, sigid}); iter != svstats.end()) {
if(time(0) - nanoTime(0, iter->second.wn(), iter->second.tow())/1000000000 < 300)
item["observed"] = true;
@ -1928,6 +1933,12 @@ try
int sigid = nmm.rd().sigid();
if(gnssid==2 && sigid == 0)
sigid = 1;
// ptudor E5a testing
if(gnssid==2 && sigid == 4)
sigid = 3;
// testing the brain hurts section
// if(gnssid==0 && sigid == 7)
// sigid = 6;
SatID id{(uint32_t)gnssid, (uint32_t)sv, (uint32_t)sigid};
auto& perrecv = g_svstats[id].perrecv[nmm.sourceid()];
@ -2774,7 +2785,19 @@ try
}
else if(nmm.type()== NavMonMessage::GPSCnavType) {
// brain hurts section
// if(gnssid ==0) {
// if(sigid==3) // L2C is sent as '4' and '3', but the '4' numbers here are bogus
// sigid=4; // if we see 3, use it, and change number to 4 to be consistent
// if(sigid==7) // L5-CNAV is sent as '6' and '7', but the '7' numbers here are bogus
// sigid=6; // if we see 7, use it, and change number to 6 to be consistent
// else if(sigid != 0) // sigid 0 = 0
// continue; // ignore the rest
// }
//SatID id={2,(uint32_t)sv,6}; // E5a
SatID id{nmm.gpsc().gnssid(), nmm.gpsc().gnsssv(), nmm.gpsc().sigid()};
//hardcoding doesn't change results because data is fine. SatID id={0,nmm.gpsc().gnsssv(),6}; // GPS L5 ptudor brain
g_svstats[id].perrecv[nmm.sourceid()].t = nmm.localutcseconds();
auto& svstat = g_svstats[id];
@ -2785,7 +2808,8 @@ try
std::basic_string<uint8_t>((uint8_t*)nmm.gpsc().contents().c_str(),
nmm.gpsc().contents().size()),
gcns);
// cout<<"Got a message from "<<makeSatIDName(id)<<endl;
// ptudor
if (doDEBUG) { cerr<<humanTimeNow()<<" Received a message with "<<makeSatIDName(id)<<endl; }
// XXX conversion possibly vital
// svstat.tow = nmm.gpsc().gnsstow();

12
ubx.cc
View File

@ -163,3 +163,15 @@ basic_string<uint8_t> getSBASFromSFRBXMsg(std::basic_string_view<uint8_t> msg)
return payload;
}
basic_string<uint8_t> getFnavFromSFRBXMsg(std::basic_string_view<uint8_t> msg)
{
// byte order adjustment
std::basic_string<uint8_t> payload;
for(unsigned int i = 0 ; i < (msg.size() - 8) / 4; ++i)
for(int j=1; j <= 4; ++j)
payload.append(1, msg[8 + (i+1) * 4 -j]);
return payload;
}

1
ubx.hh
View File

@ -17,6 +17,7 @@ std::basic_string<uint8_t> getGPSFromSFRBXMsg(std::basic_string_view<uint8_t> ms
std::basic_string<uint8_t> getGlonassFromSFRBXMsg(std::basic_string_view<uint8_t> msg);
std::basic_string<uint8_t> getBeidouFromSFRBXMsg(std::basic_string_view<uint8_t> msg);
std::basic_string<uint8_t> getSBASFromSFRBXMsg(std::basic_string_view<uint8_t> msg);
std::basic_string<uint8_t> getFnavFromSFRBXMsg(std::basic_string_view<uint8_t> msg);
struct CRCMismatch{};
struct TrkSatStat

View File

@ -39,6 +39,7 @@
static char program[]="ubxtool";
bool doDEBUG{false};
bool doDEBUGplus{true};
bool doLOGFILE{false};
bool doVERSION{false};
@ -56,6 +57,8 @@ static int getBaudrate(int baud)
{
if(baud==115200)
return B115200;
else if(baud==460800)
return B460800;
else if(baud==57600)
return B57600;
else if(baud==38400)
@ -72,6 +75,8 @@ static int getBaudrateFromSymbol(int baud)
{
if(baud==B115200)
return 115200;
else if(baud==B460800)
return 460800;
else if(baud==B57600)
return 57600;
else if(baud==B38400)
@ -293,13 +298,14 @@ bool sendAndWaitForUBXAckNack(int fd, int seconds, basic_string_view<uint8_t> ms
bool version9 = false;
bool version9_L2_E5b = false;
bool version9_L5_E5a = false;
void enableUBXMessageOnPort(int fd, uint8_t ubxClass, uint8_t ubxType, uint8_t port, uint8_t rate=1)
{
for(int n=0 ; n < 5; ++n) {
try {
basic_string<uint8_t> payload;
if(version9) {
if(version9_L2_E5b || version9_L5_E5a) {
payload= basic_string<uint8_t>({ubxClass, ubxType, rate});
}
else {
@ -503,6 +509,7 @@ int main(int argc, char** argv)
bool doGPS{true}, doGalileo{true}, doGlonass{false}, doBeidou{false}, doReset{false}, doWait{true}, doRTSCTS{true}, doSBAS{false};
bool doQZSS(false), doNAVIC(false);
bool doFakeFix{false};
bool doKeepNMEA{false};
bool doSTDOUT=false;
@ -528,6 +535,9 @@ int main(int argc, char** argv)
app.add_flag("--glonass,-r", doGlonass, "Enable Glonass reception");
app.add_flag("--galileo,-e", doGalileo, "Enable Galileo reception");
app.add_flag("--sbas,-s", doSBAS, "Enable SBAS (EGNOS/WAAS/etc) reception");
app.add_flag("--zed-e5a", version9_L5_E5a, "Enable uBlox ZED F9T-10B support for L5 signals");
app.add_flag("--navic", doNAVIC, "Enable NAVIC reception");
app.add_flag("--qzss", doQZSS, "Enable QZSS reception");
app.add_option("--rtscts", doRTSCTS, "Set hardware handshaking");
app.add_flag("--stdout", doSTDOUT, "Emit output to stdout");
auto pn = app.add_option("--port,-p", portName, "Device or file to read serial from");
@ -592,8 +602,9 @@ int main(int argc, char** argv)
if(!baudrate)
baudrate = getBaudrateFromSymbol(g_baudval);
// ptudor @warning
if(doFakeFix) // hack
version9 = true;
version9_L2_E5b = true;
bool m8t = false;
string hwversion;
@ -646,8 +657,12 @@ int main(int argc, char** argv)
string line = (const char*)um1.getPayload().c_str() + 40 +30*n;
cerr<<humanTimeNow()<<" Extended info: "<<line <<endl;
// see also ptudor @warning
if(line.find("F9") != string::npos)
version9=true;
// ptudor: command line L5 argument can override auto-default L2 module
if (!version9_L5_E5a) {
version9_L2_E5b=true;
}
if(line.find("M8T") != string::npos) {
m8t=true;
@ -667,8 +682,10 @@ int main(int argc, char** argv)
cerr<<humanTimeNow()<<" Serial number "<< serialno <<endl;
if(version9)
if(version9_L2_E5b)
cerr<<humanTimeNow()<<" Detected version U-Blox 9"<<endl;
if(version9_L5_E5a)
cerr<<humanTimeNow()<<" Detected version U-Blox 9 on ZED F9T 10B with L5 signals"<<endl;
usleep(50000);
if (doDEBUG) { cerr<<humanTimeNow()<<" Sending GNSS query"<<endl; }
msg = buildUbxMessage(0x06, 0x3e, {});
@ -689,7 +706,8 @@ int main(int argc, char** argv)
}catch(...) {
cerr<<"Got timeout waiting for ack of poll, no problem"<<endl;
}
if(!version9) {
// ptudor reminder for where defaults are established
if(!version9_L2_E5b && !version9_L5_E5a) {
// ver RO maxch cfgs
msg = buildUbxMessage(0x06, 0x3e, {0x00, 0x00, 0xff, 0x06,
// GPS min max res x1 x2 x3, x4
@ -718,6 +736,61 @@ int main(int argc, char** argv)
exit(-1);
}
}
else if(version9_L5_E5a) {
// UBX-CFG-VALSET
// vers ram res res
/*
* compat
B5 62 06 8A 63
00 01 05 00 00
-
01 00 31 10 01 //signal Gps L1C
04 00 31 10 00 //signal GPS L5
05 00 31 10 00 //signal SBAS L1C
07 00 31 10 01 //sig GAL E1
09 00 31 10 00 //sig GAL E5a
0D 00 31 10 01 //sig BDS B1
0F 00 31 10 01 //sig BDS B1c
12 00 31 10 01 //sig QZSS L1C/A
17 00 31 10 00 //sig QZSS L5
18 00 31 10 01 //sig GLO L1
1D 00 31 10 01 //sig NAVIC L5
1F 00 31 10 01 //enable GPS
20 00 31 10 00 //enable SBAS
21 00 31 10 01 //enable GAL
22 00 31 10 01 //enable BDS
24 00 31 10 00 //sig GLO L1 part two? dunno
25 00 31 10 01 //enable GLO
26 00 31 10 00 //enable NAVIC
28 00 31 10 01 //sig BDS B2a
33 73
*/
bool doCrashFast = false;
msg = buildUbxMessage(0x06, 0x8a,
{0x01,0x01,0x00,0x00, // intro stanza ptudor blindly copied
0x01,0x00,0x31,0x10, doGPS, // signal gps L1C/A
0x04,0x00,0x31,0x10, doGPS, // signal gps L5
0x1f,0x00,0x31,0x10, doGPS, // enable GPS
0x21,0x00,0x31,0x10, doGalileo, //enable
0x07,0x00,0x31,0x10, doGalileo, // signal E1
// getting CRC errors on E5a
0x09,0x00,0x31,0x10, doGalileo, //signal E5a
0x0d,0x00,0x31,0x10, doBeidou, // BDS B1
// getting a nack from this one
//0x0f,0x00,0x31,0x10, doBeidou, // BDS B1C
// getting an immediate crash with this one
//0x28,0x00,0x31,0x10, doBeidou, // BDS B2a
0x28,0x00,0x31,0x10, doCrashFast, // BDS B2a
0x22,0x00,0x31,0x10, doBeidou, // BDS enable
0x25,0x00,0x31,0x10, doGlonass, //enable GLO
0x18,0x00,0x31,0x10, doGlonass, // GLO L1
0x24,0x00,0x31,0x10, doGlonass //Glo part 2
});
}
else { // UBX-CFG-VALSET
// vers ram res res
msg = buildUbxMessage(0x06, 0x8a, {0x00, 0x01, 0x00, 0x00,
@ -737,15 +810,17 @@ int main(int argc, char** argv)
0x18,0x00,0x31,0x10, doGlonass,
0x1a,0x00,0x31,0x10, doGlonass
});
if (doDEBUG) { cerr<<humanTimeNow()<<" Sending F9P GNSS setting, GPS: "<<doGPS<<", Galileo: "<<doGalileo<<", BeiDou: "<<doBeidou<<", GLONASS: "<<doGlonass<<", SBAS: "<<doSBAS<<endl; }
}
if(version9_L2_E5b || version9_L5_E5a) {
if (doDEBUG) { cerr<<humanTimeNow()<<" Sending F9P GNSS setting, GPS: "<<doGPS<<", Galileo: "<<doGalileo<<", BeiDou: "<<doBeidou<<", GLONASS: "<<doGlonass<<", SBAS: "<<doSBAS<<", QZSS: "<<doQZSS<<", NAVIC: "<<doNAVIC<<endl; }
if(sendAndWaitForUBXAckNack(fd, 2, msg, 0x06, 0x8a)) { // GNSS setting, F9 stylee
if (doDEBUG) { cerr<<humanTimeNow()<<" Got ack on F9P GNSS setting"<<endl; }
}
else {
cerr<<humanTimeNow()<<" Got nack on F9P GNSS setting"<<endl;
exit(-1);
//ptudor
exit(-1);
}
/* VALSET
0x20 91 02 32 =
@ -809,7 +884,7 @@ int main(int argc, char** argv)
uint8_t* ptrSeconds = (uint8_t*)&minSecondsVal, *ptrCent= (uint8_t*)&minCentimetersVal;
uint8_t cmd;
std::basic_string<uint8_t> msg;
if(version9) {
if(version9_L2_E5b) {
cmd = 0x8a;
msg = buildUbxMessage(0x06, cmd, {0x00, 0x01, 0x00, 0x00,
0x01,0x00,0x03,0x20, 1, // survey in mode
@ -930,12 +1005,15 @@ int main(int argc, char** argv)
if (doDEBUG) { cerr<<humanTimeNow()<<" Enabling UBX-MON-HW"<<endl; }
enableUBXMessageOnPort(fd, 0x0A, 0x09, ubxport, 16); // UBX-MON-HW
if(version9) {
// ptudor
/*
if(version9_L2_E5b) {
if (doDEBUG) { cerr<<humanTimeNow()<<" Enabling UBX-NAV-SVIN"<<endl; } // Survey-in results
enableUBXMessageOnPort(fd, 0x01, 0x3b, ubxport, 2);
}
else if(m8t) {
*/
if(m8t) {
if (doDEBUG) { cerr<<humanTimeNow()<<" Enabling UBX-TIM-SVIN"<<endl; } // Survey-in results
enableUBXMessageOnPort(fd, 0x0d, 0x04, ubxport, 2);
}
@ -964,7 +1042,7 @@ int main(int argc, char** argv)
}
}
if(!version9 && !m8t && !fuzzPositionMeters) {
if(!version9_L2_E5b && !m8t && !fuzzPositionMeters) {
if (doDEBUG) { cerr<<humanTimeNow()<<" Enabling debugging data"<<endl; } // RF doppler
enableUBXMessageOnPort(fd, 0x03, 0x10, ubxport, 4);
}
@ -977,7 +1055,8 @@ int main(int argc, char** argv)
if (doDEBUG) { cerr<<humanTimeNow()<<" Enabling UBX-NAV-POSECEF"<<endl; } // position
enableUBXMessageOnPort(fd, 0x01, 0x01, ubxport, 8); // POSECEF
if(version9) {
// ptudor
if(version9_L2_E5b || version9_L5_E5a) {
if (doDEBUG) { cerr<<humanTimeNow()<<" Enabling UBX-NAV-SIG"<<endl; } // satellite reception details
enableUBXMessageOnPort(fd, 0x01, 0x43, ubxport, 8); // NAV-SIG
/*
@ -1216,17 +1295,31 @@ int main(int argc, char** argv)
int gnssid = payload[36+32*n];
int sv = payload[37+32*n];
int sigid=0;
if(version9) {
// ptudor
if(version9_L2_E5b || version9_L5_E5a) {
sigid = payload[38+32*n];
// ptudor next two
if(gnssid == 2 && sigid ==4) // they separate out I and Q, but the rest of UBX doesn't
sigid = 3; // so map it back
if(gnssid == 2 && sigid ==6) // they separate out I and Q, but the rest of UBX doesn't
sigid = 5; // so map it back
if(gnssid == 2 && sigid ==0) // they separate out I and Q, but the rest of UBX doesn't
sigid = 1; // so map it back
if(gnssid ==0) {
if(sigid==3) // L2C is sent as '4' and '3', but the '4' numbers here are bogus
sigid=4; // if we see 3, use it, and change number to 4 to be consistent
if(sigid==7) // L5-CNAV is sent as '6' and '7', but the '7' numbers here are bogus
sigid=6; // if we see 7, use it, and change number to 6 to be consistent
else if(sigid != 0) // sigid 0 = 0
continue; // ignore the rest
}
}
else if(gnssid==2) { // version 8 defaults galileo to E1B
sigid = 1;
}
if(doDEBUG)
cerr<<humanTimeNow()<<" sigidhackresult "<< gnssid << "@" << sigid <<endl;
uint16_t locktimems;
memcpy(&locktimems, &payload[40+32*n], 2);
@ -1357,7 +1450,10 @@ int main(int argc, char** argv)
ns.emitNMM( nmm);
continue;
}
if(id.first == 0 && sigid) { // new GPS
//ptudor
//if(id.first == 0 && sigid == 0) { // new GPS but not L5
if(id.first == 0 && sigid) { // "The L5-CNAV is modulated onto L5I signal component, containing basically the same information data as L2-CNAV. The message structure is exactly the same but its content may vary slightly.
if (doDEBUG) { cerr<<humanTimeNow()<<" SFRBX from GPS L2C or L5-CNAV "<<id.second<<" @ signal "<<sigid<<", msg of "<<(int)payload[4]<< " words"<<endl; }
auto cnav = getGPSFromSFRBXMsg(payload);
static int wn, tow;
@ -1384,7 +1480,11 @@ int main(int argc, char** argv)
nmm.mutable_gpsc()->set_contents(string((char*)cnav.c_str(), cnav.size()));
ns.emitNMM( nmm);
}
// else if(id.first == 0 && sigid == 6) { // GPS L5 placeholder
//// if (doDEBUGplus) { cerr<<humanTimeNow()<<" GPS-L5 " <<endl; }
// }
else if(id.first ==2) { // GALILEO
if(sigid == 1 || sigid == 5) {
basic_string<uint8_t> reserved1, reserved2, sar, spare, crc;
auto inav = getInavFromSFRBXMsg(payload, reserved1, reserved2, sar, spare, crc);
unsigned int wtype = getbitu(&inav[0], 0, 6);
@ -1392,14 +1492,20 @@ int main(int argc, char** argv)
uint32_t satTOW;
int msgTOW{0};
if(getTOWFromInav(inav, &satTOW, &g_galwn)) { // 0, 6, 5
// if (doDEBUG) { cerr<<humanTimeNow()<<" "<<wtype<<" sv "<<id.second<<" tow "<<satTOW << " % 30 = "<< satTOW % 30<<", implied start of cycle: "<<(satTOW - (satTOW %30)) <<endl; }
// ptudor
//if (doDEBUGplus) { cerr<<humanTimeNow()<<" "<<wtype<<" sv "<<id.second<<" tow "<<satTOW << " % 30 = "<< satTOW % 30<<", implied start of cycle: "<<(satTOW - (satTOW %30)) <<endl; }
msgTOW = satTOW;
curCycleTOW = satTOW - (satTOW %30);
}
else {
if(curCycleTOW < 0) // did not yet have a start of cycle
continue;
// if (doDEBUG) { cerr<<humanTimeNow()<<" "<<wtype<<" sv "<<id.second<<" tow "; }
// ptudor
//if (doDEBUGplus) { cerr<<humanTimeNow()<<" "<<wtype<<" sv "<<id.second<<" tow "; }
// if(sigid != 5) {
//if (doDEBUGplus) { cerr<<humanTimeNow()<<" GAL-E5a "<<sigid<<" sigidthree "<<endl; }
//}
//if(sigid == 5 || sigid == 3) {
if(sigid == 5) {
if(wtype == 2) {
msgTOW = curCycleTOW + 20;
@ -1454,6 +1560,7 @@ int main(int argc, char** argv)
}
}
// ptudor note galileo magic here
NavMonMessage nmm;
nmm.set_sourceid(g_srcid);
nmm.set_type(NavMonMessage::GalileoInavType);
@ -1474,6 +1581,43 @@ int main(int argc, char** argv)
nmm.mutable_gi()->set_spare((const char*)&spare[0], spare.size());
ns.emitNMM( nmm);
}
// ptudor GAL E5a sigidthree
else if(sigid == 3) {
auto fnav = getFnavFromSFRBXMsg(payload);
uint32_t satTOW;
int msgTOW{0};
if(getTOWFromFnav(fnav, &satTOW, &g_galwn)) { // 0, 6, 5
// ptudor
//if (doDEBUGplus) { cerr<<humanTimeNow()<<" "<<wtype<<" sv "<<id.second<<" tow "<<satTOW << " % 30 = "<< satTOW % 30<<", implied start of cycle: "<<(satTOW - (satTOW %30)) <<endl; }
msgTOW = satTOW;
curCycleTOW = satTOW - (satTOW %30);
}
if (doDEBUG) { cerr<<humanTimeNow()<<" SFRBX from GAL E5a "<<id.second<<" @ signal "<<sigid<<", msg of "<<(int)payload[4]<< " words"<<endl; }
auto gstr = getFnavFromSFRBXMsg(payload);
NavMonMessage nmm;
nmm.set_localutcseconds(g_gnssutc.tv_sec);
nmm.set_localutcnanoseconds(g_gnssutc.tv_nsec);
nmm.set_sourceid(g_srcid);
nmm.set_type(NavMonMessage::GalileoFnavType);
//nmm.mutable_gf()->set_freq(payload[3]);
nmm.mutable_gf()->set_gnssid(id.first);
nmm.mutable_gf()->set_gnsssv(id.second);
nmm.mutable_gf()->set_sigid(sigid);
nmm.mutable_gf()->set_contents(string((char*)gstr.c_str(), gstr.size()));
//gf.gnssWN, gf.gnssTOW
nmm.mutable_gf()->set_gnsswn(g_galwn);
nmm.mutable_gf()->set_gnsstow(msgTOW);
//sep nmm.mutable_gf()->set_gnsswn(sf.wn - 1024);
//sep nmm.mutable_gf()->set_gnsstow(sf.towMsec/1000.0);
ns.emitNMM( nmm);
//sep nmm.mutable_gf()->set_contents((const char*)&payload[0], payload.size());
}
}
else if(id.first==3) {
auto gstr = getGlonassFromSFRBXMsg(payload);
@ -1571,7 +1715,9 @@ int main(int argc, char** argv)
}
else if(msg.getClass() == 1 && msg.getType() == 0x35) { // UBX-NAV-SAT
if(version9) // we have UBX-NAV-SIG
//if(version9_L2_E5b) // we have UBX-NAV-SIG
// ptudor
if(version9_L2_E5b || version9_L5_E5a)
continue;
// if (doDEBUG) { cerr<<humanTimeNow()<<" Info for "<<(int) payload[5]<<" svs: \n"; }
for(unsigned int n = 0 ; n < payload[5]; ++n) {
@ -1580,6 +1726,7 @@ int main(int argc, char** argv)
auto el = (int)(char)payload[11+12*n];
auto azi = ((int)payload[13+12*n]*256 + payload[12+12*n]);
// auto db one
auto db = (int)payload[10+12*n];
// if (doDEBUG) { cerr<<"gnssid "<<gnssid<<" sv "<<sv<<" el "<<el<<endl; }
NavMonMessage nmm;
@ -1600,7 +1747,7 @@ int main(int argc, char** argv)
nmm.mutable_rd()->set_qi(status & 7);
nmm.mutable_rd()->set_used(status & 8);
/*
/*
if (doDEBUG) {
cerr<<humanTimeNow()<<" "<<gnssid<<","<<sv<<":";
cerr<<" used " << ((status & 8) == 8);
@ -1614,7 +1761,7 @@ int main(int argc, char** argv)
cerr<<" alm-avail " << !!(status & (1<<12));
cerr<<endl;
}
*/
*/
ns.emitNMM( nmm);
}
}
@ -1627,15 +1774,24 @@ int main(int argc, char** argv)
memcpy(&sigflags, &payload[18+16*n], 2);
int sigid = 0;
if(version9) { // we only use this on version9 right now tho
// ptudor anothersigidhack
if(version9_L2_E5b || version9_L5_E5a) { // we only use this on version9_L2_E5b right now tho
sigid = payload[10+16*n];
// sigId 3 = E5aI; sigId 4 = e5aQ; sigId 5 = e5bI ; sigId 6 = E5bQ
if(gnssid == 2 && sigid ==4) // they separate out I and Q, but the rest of UBX doesn't
sigid = 3; // so map it back
if(gnssid == 2 && sigid ==6) // they separate out I and Q, but the rest of UBX doesn't
sigid = 5; // so map it back
// reset 3 to 6 after 6 becomes 5 and 4 becomes 3. my brain hurts. see page 19 UBX-21048598
if(gnssid == 2 && sigid ==3) // they separate out I and Q, but the rest of UBX doesn't
sigid = 6; // so map it back
if(gnssid == 2 && sigid ==0)
sigid = 1;
if(gnssid ==0) {
if(sigid==3) // L2C is sent as '4' and '3', but the '4' numbers here are bogus
sigid=4; // if we see 3, use it, and change number to 4 to be consistent
if(sigid==7) // L5-CNAV is sent as '6' and '7', but the '7' numbers here are bogus
sigid=6; // if we see 7, use it, and change number to 6 to be consistent
else if(sigid != 0) // sigid 0 = 0
continue; // ignore the rest
}
@ -1644,8 +1800,9 @@ int main(int argc, char** argv)
sigid = 1;
}
// auto db two
auto db = (int)payload[14+16*n];
// if (doDEBUG) { cerr<<"gnssid "<<gnssid<<" sv "<<sv<<" el "<<el<<endl; }
if (doDEBUGplus) { cerr<<"UBX-NAV-SIG: gnssid "<<gnssid<<" sv "<<sv<<" sigid "<<sigid<<" qi "<<qi<<" db "<<db<<endl; }
NavMonMessage nmm;
nmm.set_sourceid(g_srcid);
nmm.set_localutcseconds(g_gnssutc.tv_sec);