Skip to content

Commit e7d61bd

Browse files
Luick KlippelLuick Klippel
Luick Klippel
authored and
Luick Klippel
committed
making final adjustments
1 parent 58df23c commit e7d61bd

18 files changed

+97
-114
lines changed

README.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,29 @@ There are a few technologies available which offer accuracy of up to a few mm, b
1010

1111
The aim of SDGPS is to find a cheap, accurate and easy to implement DGPS C++ lib solution. The accuracy the project is aiming for is 2-1 meters. The used DGPS technique is Code Range DGPS which corrects the pseudo range of each satellite. First the pseudo range correction is calculated by substracting the observed pseudo range from the calculated pseudo range (from ephemeris). If ephemeris data is available and the corrected pseudo range value is calculated, single point positioning is applied, to triangulate the final position.
1212

13-
1413
## Introduction to DGPS
1514

16-
Differential GPS or DGPS makes use of a nearby base station which knows it's true position and calculates the difference in position to send that correction via. any means of communication to it's clients, for example a rover which already has a GPS module on board which is accurate up to a few meters, with the corrections applied it can achieve accuracies of even a quarter of a meter, assuming it's in the range of the basestation.
15+
Differential GPS or DGPS makes use of a nearby base station which knows its true position and calculates the difference in position to send that correction via. any means of communication to its clients. For example a rover which already has a GPS module on board which is accurate up to a few meters. With the corrections applied it can achieve accuracies of even a quarter of a meter, assuming it's in the range of the basestation.
1716

1817
### RTK DGPS
1918

20-
Real Time Kinematic makes use of the phase rotation as an indicator for the pseudo range. The basestation measures the phase rotation and divides it by the satellites carrier frequency which returns a time, which can be used to estimate the the atmospheric error. The achieved accuracy is extremely high.
19+
Real Time Kinematic makes use of the phase rotation as an indicator for the pseudo range. The basestation measures the phase rotation and divides it by the satellites carrier frequency which returns a time, which can be used to estimate the the atmospheric error. The achieved accuracy is very good.
2120

2221
### Position DGPS
2322

2423
Position DGPS just uses the position difference as an correction value, so the basestation compares its lat/ lon to the known true lat/lon and sends the difference as an correction value to the rover.
2524

26-
The only disadvantage is that, if the set of satellites changes, the correction value does not apply anymore. So both, the receiver and the client need the exact same sets of satellites or the result can get even worse.
25+
The only disadvantage is that, if the set of satellites changes, the correction value does not apply anymore. So both, the receiver and the client need the exact same sets of satellites or the result are inaccurate.
2726

2827
### Code Range DGPS
2928

30-
Code Range DGPS takes the difference in pseudo range as correction value, so the basestation compares the difference between the observed pseudo range and actual true pseudo range and takes it as the correction value. As with the RTK DGPS the correction values are calculated for each satellite, which increases the usability dramatically. Another huge advantage is that it does not require any expensive receivers.
29+
Code Range DGPS takes the difference in pseudo range as a correction value, so the basestation compares the difference between the observed pseudo range and actual true pseudo range and uses it as the correction value. As with the RTK DGPS the correction values are calculated for each satellite, which increases the usability dramatically. Another huge advantage is that it does not require any expensive receivers.
3130
The only requirement for the receiver is that it supports raw data output, that can output ephemeris and raw pseudo range data.
3231

3332
## Available Correction algorithms
3433

3534
Most of the GPS receivers already have several correction algorithms applied on there standard output, which mostly because they are relatively easy to calculate and behave linearly.
36-
Corrected biases are, for example the satellite clock bias such as the receiver's clocks bias. Also the ionosphere, troposphere do affect the results. Those values/ corrections are known and can be removed relatively easily, if not removed even state of the art receivers would only have an accuracy of a few meters.
35+
Corrected biases are for example the satellite clock bias, such as the receiver's clocks bias. Also the ionosphere, troposphere do affect the results. Those values/ corrections are known and can be removed relatively easily, if not removed even state of the art receivers would only have an accuracy of a few meters.
3736

3837
# Technical realisation
3938

bin/coreTest

84 KB
Binary file not shown.

build/CMakeFiles/CMakeOutput.log

+36-36
Large diffs are not rendered by default.
Binary file not shown.

build/src/CMakeFiles/CommCore.dir/flags.make

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ CXX_DEFINES =
66

77
CXX_INCLUDES = -I/usr/local/include -I/Users/luickklippel/Documents/projekte/simple-dgps/src/include -I/Users/luickklippel/Documents/projekte/cc.ublox.commsdsl/build/comms_champion/install/include -I/Users/luickklippel/Documents/projekte/cc.ublox.commsdsl/build/output/include
88

9-
CXX_FLAGS = -std=c++11 -O3 -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -std=gnu++11
9+
CXX_FLAGS = -Wall -Wextra -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -std=gnu++11
1010

build/src/CMakeFiles/SimpleDGps.dir/flags.make

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ CXX_DEFINES =
66

77
CXX_INCLUDES = -I/usr/local/include -I/Users/luickklippel/Documents/projekte/simple-dgps/src/include -I/Users/luickklippel/Documents/projekte/cc.ublox.commsdsl/build/comms_champion/install/include -I/Users/luickklippel/Documents/projekte/cc.ublox.commsdsl/build/output/include
88

9-
CXX_FLAGS = -std=c++11 -O3 -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -std=gnu++11
9+
CXX_FLAGS = -Wall -Wextra -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -std=gnu++11
1010

Binary file not shown.

build/src/libCommCore.a

804 KB
Binary file not shown.

build/src/libSimpleDGps.a

20.8 KB
Binary file not shown.
Binary file not shown.

build/test/coreTest

84 KB
Binary file not shown.

lib/libCommCore.a

804 KB
Binary file not shown.

lib/libSimpleDGps.a

20.8 KB
Binary file not shown.

src/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ find_package( Boost 1.40 REQUIRED )
66
message(STATUS "Boost version: ${Boost_VERSION}")
77
include_directories( ${Boost_INCLUDE_DIR} )
88

9+
set (CMAKE_CXX_FLAGS "-Wall -Wextra")
10+
911
include_directories("${CMAKE_SOURCE_DIR}/src/include/")
1012
include_directories("${UBLOX_COMMDSL_PROJECT_PATH}/build/comms_champion/install/include/")
1113
include_directories("${UBLOX_COMMDSL_PROJECT_PATH}/build/output/include/")

src/simpleDGps.cpp

-15
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ double calcTimeFromEpoch(double t, double t_ref)
4848

4949
double calcEccentricAnomaly(ephemeris *ephem, double t_k)
5050
{
51-
// Semi-major axis
52-
int A = ephem->sqrtA*ephem->sqrtA;
53-
5451
// Computed mean motion (rad/sec)
5552
double n_0 = sqrt(ephem->MU/(ephem->A*ephem->A*ephem->A));
5653

@@ -77,7 +74,6 @@ latLonAltPos ecefToLatLonAlt(ecefPos ecef)
7774
latLonAltPos finalLatLonPos = { 0, 0, 0 };
7875
double zp, w2, w, r2, r, s2, c2, s, c, ss;
7976
double g, rg, rf, u, v, m, f, p, x, y, z;
80-
double n, lat, lon, alt;
8177

8278
x = ecef.x;
8379
y = ecef.y;
@@ -129,8 +125,6 @@ latLonAltPos ecefToLatLonAlt(ecefPos ecef)
129125

130126
ecefPos latLonAltToEcef(latLonAltPos latlonAlt)
131127
{
132-
double zp, w2, w, r2, r, s2, c2, s, c, ss;
133-
double g, rg, rf, u, v, m, f, p, x, y, z;
134128
double n, lat, lon, alt;
135129

136130
ecefPos ecef = { 0, 0, 0 };
@@ -340,8 +334,6 @@ double clacDeterminant(double **A, int rows)
340334
// Iterate for each element of first row
341335
for (int f = 0; f < rows; f++)
342336
{
343-
// Getting Cofactor of A[0][f]
344-
double **temp = getCofactor(A, 0, f, rows);
345337
D += sign * A[0][f] * clacDeterminant(A, rows - 1);
346338

347339
// terms are to be added with alternate sign
@@ -361,9 +353,6 @@ double** calcAdjoint(double **A, int matrixArows)
361353
{
362354
for (int j=0; j<posMTrillatASize; j++)
363355
{
364-
// Get cofactor of A[i][j]
365-
double **temp = getCofactor(A, i, j, posMTrillatASize);
366-
367356
// sign of adj[j][i] positive if sum of row
368357
// and column indexes is even.
369358
sign = ((i+j)%2==0)? 1: -1;
@@ -523,9 +512,5 @@ ecefPos trillatPosFromRange(satLocation finalSatPos, satRanges finalSatRanges)
523512
finalPos.y = finalECEF[1];
524513
finalPos.z = finalECEF[2];
525514

526-
for (int i = 0; i < 5; ++i)
527-
{
528-
std::cout << finalECEF[i] << std::endl;
529-
}
530515
return finalPos;
531516
}

test/coreTest.cpp

+52
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,35 @@ int main() {
1818
testMatrixA[2][1] = 8;
1919
testMatrixA[2][2] = 7;
2020

21+
ephemeris eph = {
22+
797;
23+
t_gd;
24+
224;
25+
t_oc;
26+
a_f[2];
27+
26560300;
28+
-2.62555;
29+
IODE2;
30+
87.6875;
31+
dn;
32+
M_0;
33+
C_uc;
34+
e;
35+
C_us;
36+
sqrtA;
37+
t_oe;
38+
C_ic;
39+
OMEGA_0;
40+
OMEGA_E;
41+
C_is;
42+
i_0;
43+
C_rc;
44+
omega;
45+
OMEGA_dot;
46+
IODE3;
47+
IDOT;
48+
};
49+
2150
std::cout << "transpose:" << std::endl;
2251
double **testTranspose = transpose2DimMatrix(testMatrixA, t, t);
2352
for (int i = 0; i < t; ++i)
@@ -72,5 +101,28 @@ int main() {
72101
cout << res.x << endl;
73102
cout << res.y << endl;
74103
cout << res.z << endl;
104+
105+
// basestation correction, required for correction
106+
latLonAltPos baseStationPos;
107+
baseStationPos.lat = 85.934710;
108+
baseStationPos.lon = 17.747955;
109+
baseStationPos.alt = 5;
110+
111+
// calculating range correction set
112+
satRanges correctionRanges = calcSatRangeCorrection(testSatPos, baseStationPos, testPseudoRanges);
113+
// applying correction to measured uncorrected pseudo ranges
114+
satRanges correctedPseudoRanges = applyCorrectionOnPseudoRange(correctionRanges, testPseudoRanges);
115+
116+
// calculating position from corrected pseudo ranges
117+
ecefPos resCorrected = trillatPosFromRange(testSatPos, correctedPseudoRanges);
118+
119+
std::cout << "Test corrected trillat:" << std::endl;
120+
cout << resCorrected.x << endl;
121+
cout << resCorrected.y << endl;
122+
cout << resCorrected.z << endl;
123+
124+
125+
ecefPos satPos = calcSatPos(ephemeris *ephem, double t);
126+
75127
return 0;
76128
}

test/coreTest.h

Whitespace-only changes.

test/dataDrivenTest.cpp

-55
This file was deleted.

0 commit comments

Comments
 (0)