Skip to content

Commit 94ec154

Browse files
committed
ubxtool.cc: Add dynamic model configuration.
1 parent 93e459d commit 94ec154

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

ubxtool.cc

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ int main(int argc, char** argv)
586586
unsigned int fuzzPositionMeters=0;
587587
string owner;
588588
string remark;
589+
int dynamicModel=-1;
589590

590591
app.add_option("--destination,-d", destinations, "Send output to this IPv4/v6 address");
591592
app.add_flag("--wait", doWait, "Wait a bit, do not try to read init messages");
@@ -606,6 +607,7 @@ int main(int argc, char** argv)
606607
app.add_option("--fuzz-position,-f", fuzzPositionMeters, "Fuzz position by this many meters");
607608
app.add_option("--owner,-o", owner, "Name/handle/nick of owner/operator");
608609
app.add_option("--remark", remark, "Remark for this station");
610+
app.add_option("--dynamic-model,-m", dynamicModel, "Dynamic platform model");
609611

610612
int surveyMinSeconds = 0;
611613
int surveyMinCM = 0;
@@ -922,6 +924,53 @@ int main(int argc, char** argv)
922924
exit(-1);
923925
}
924926
}
927+
928+
if(dynamicModel != -1) {
929+
/* Check dynamic model ID */
930+
if(dynamicModel != 0 /* Portable */
931+
&& dynamicModel != 2 /* Stationary */
932+
&& dynamicModel != 3 /* Pedestrian */
933+
&& dynamicModel != 4 /* Automotive */
934+
&& dynamicModel != 5 /* Sea */
935+
&& dynamicModel != 6 /* Airborne <1g */
936+
&& dynamicModel != 7 /* Airborne <2g */
937+
&& dynamicModel != 8 /* Airborne <4g */
938+
&& dynamicModel != 9 /* Wrist Watch */
939+
&& dynamicModel != 10 /* Bike */ ) {
940+
cerr<<humanTimeNow()<<" Dynamic Model id is not valid, not configuring."<<endl;
941+
}
942+
else {
943+
/* UBX-CFG-NAV5 */
944+
msg = buildUbxMessage(0x06, 0x24, {
945+
0x01, 0x00, /* Bitmask of settings to apply: bit 0 = dynamic model only */
946+
(unsigned char)((dynamicModel) & 0xFF), /* Dynamic Model */
947+
0x00, /* Fix Type */
948+
0x00, 0x00, 0x00, 0x00, /* 2D Altitude Value */
949+
0x00, 0x00, 0x00, 0x00, /* 2D Altitude Variance */
950+
0x00, /* Minimum GNSS Satellite Elevation */
951+
0x00, /* Reserved */
952+
0x00, 0x00, /* Position DOP Mask */
953+
0x00, 0x00, /* Time DOP Mask */
954+
0x00, 0x00, /* Position Accuracy Mask */
955+
0x00, 0x00, /* Time Accuracy Mask */
956+
0x00, /* Static hold threshold */
957+
0x00, /* DGNSS Timeout */
958+
0x00, /* Min Satellites for Fix */
959+
0x00, /* Min C/N0 Threshold for Satellites */
960+
0x00, 0x00, /* Reserved */
961+
0x00, 0x00, /* Static Hold Distance Threshold */
962+
0x00, /* UTC Standard (Automatic) */
963+
0x00, 0x00, 0x00, 0x00, 0x00, /* Reserved */
964+
});
965+
966+
if(sendAndWaitForUBXAckNack(fd, 10, msg, 0x06, 0x24)) {
967+
cerr<<humanTimeNow()<<" Configured Dynamic Model successfully"<<endl;
968+
}
969+
else {
970+
cerr<<humanTimeNow()<<" Got NACK setting Dynamic Model"<<endl;
971+
}
972+
}
973+
}
925974

926975

927976
if(!doKeepNMEA) {

0 commit comments

Comments
 (0)