Skip to content

Commit 2375900

Browse files
Luick KlippelLuick Klippel
Luick Klippel
authored and
Luick Klippel
committed
fixing ud2
1 parent 110b176 commit 2375900

File tree

12 files changed

+103
-103
lines changed

12 files changed

+103
-103
lines changed

Diff for: bin/coreTest

96 Bytes
Binary file not shown.

Diff for: build/CMakeFiles/CMakeOutput.log

+48-48
Large diffs are not rendered by default.

Diff for: build/include/cc.ublox.commsdsl/comms_champion/CMakeFiles/CMakeOutput.log

+36-36
Large diffs are not rendered by default.

Diff for: build/src/CMakeFiles/SimpleDGps.dir/simpleDGps.cpp.o

4.23 KB
Binary file not shown.

Diff for: build/src/libCommCore.a

0 Bytes
Binary file not shown.

Diff for: build/src/libSimpleDGps.a

4.49 KB
Binary file not shown.

Diff for: build/test/coreTest

96 Bytes
Binary file not shown.

Diff for: include/cc.ublox.commsdsl/output.tmp/cc_plugin/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ function (cc_plugin_all_messages)
66
set (name "${ALL_MESSAGES_LIB}")
77
set (src
88
field/CfgNavx5AopCfg.cpp
9+
field/CfgNavx5Mask2.cpp
910
field/CfgNavx5AopOrbMaxErr.cpp
1011
field/CfgNavx5Mask1.cpp
11-
field/CfgNavx5Mask2.cpp
12-
field/CfgNavx5SigAttenCompMode.cpp
1312
field/GeofenceState.cpp
13+
field/CfgNavx5SigAttenCompMode.cpp
1414
field/CfgNmeaVersion.cpp
1515
field/MsgId.cpp
1616
field/CfgCfgMask.cpp

Diff for: include/cc.ublox.commsdsl/output/cc_plugin/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ function (cc_plugin_all_messages)
66
set (name "${ALL_MESSAGES_LIB}")
77
set (src
88
field/CfgNavx5AopCfg.cpp
9+
field/CfgNavx5Mask2.cpp
910
field/CfgNavx5AopOrbMaxErr.cpp
1011
field/CfgNavx5Mask1.cpp
11-
field/CfgNavx5Mask2.cpp
12-
field/CfgNavx5SigAttenCompMode.cpp
1312
field/GeofenceState.cpp
13+
field/CfgNavx5SigAttenCompMode.cpp
1414
field/CfgNmeaVersion.cpp
1515
field/MsgId.cpp
1616
field/CfgCfgMask.cpp

Diff for: lib/libCommCore.a

0 Bytes
Binary file not shown.

Diff for: lib/libSimpleDGps.a

4.49 KB
Binary file not shown.

Diff for: src/simpleDGps.cpp

+15-15
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static satRanges applyCorrectionOnPseudoRange(satRanges corrRanges, satRanges ps
273273
// dimension of A[][]
274274
static double** getCofactor(double **A, int p, int q, int n)
275275
{
276-
double** temp = 0;
276+
double** temp = new double*[posMTrillatAColumSize];
277277
int i = 0, j = 0;
278278

279279
// Looping for each element of the matrix
@@ -329,7 +329,7 @@ static double clacDeterminant(double **A, int n)
329329
// Function to get adjoint of A[N][N] in adj[N][N].
330330
static double** calcAdjoint(double **A, int matrixArows)
331331
{
332-
double** adj = 0;
332+
double** adj = new double*[matrixArows];
333333
int sign = 0;
334334

335335
for (int i=0; i<matrixArows; i++)
@@ -355,7 +355,7 @@ static double** calcAdjoint(double **A, int matrixArows)
355355
// method assumes that matrices have same dim sizes
356356
static double** multiplyMatrices(double **matrixA, double **matrixB, int matrixArows)
357357
{
358-
double** outputMatrix = 0;
358+
double** outputMatrix = new double*[posMTrillatAColumSize];
359359
int i, j, k;
360360

361361
// Initializing elements of matrix mult to 0.
@@ -385,7 +385,7 @@ static double** multiplyMatrices(double **matrixA, double **matrixB, int matrixA
385385
// method assumes that matrices have same dim sizes
386386
static double** multiplyMatricesND1D(double **matrixA, double **matrixB, int matrixArows)
387387
{
388-
double** outputMatrix = 0;
388+
double** outputMatrix = new double*[posMTrillatAColumSize];
389389
int i, j, k;
390390

391391
// Initializing elements of matrix mult to 0.
@@ -411,12 +411,12 @@ static double** multiplyMatricesND1D(double **matrixA, double **matrixB, int mat
411411
return outputMatrix;
412412
}
413413

414-
static double** transpose2DimMatrix(double **inputArr)
414+
static double** transpose2DimMatrix(double **inputArr, int matrixArows, int transpose2DimMatrix)
415415
{
416-
double **outputArr = 0;
417-
for (int i = 0; i < sizeof(**inputArr)/sizeof(double); ++i)
416+
double **outputArr = new double*[matrixArows];
417+
for (int i = 0; i < matrixArows; ++i)
418418
{
419-
for (int j = 0; j < sizeof(*inputArr[0])/sizeof(double); ++j)
419+
for (int j = 0; j < transpose2DimMatrix; ++j)
420420
{
421421
outputArr[j][i]= inputArr[i][j];
422422
}
@@ -428,7 +428,7 @@ static double** transpose2DimMatrix(double **inputArr)
428428
// matrix is singular by https://www.geeksforgeeks.org/adjoint-inverse-matrix/
429429
static double** calcInverse(double **A, int matrixArows)
430430
{
431-
double** inverse = 0;
431+
double** inverse = new double*[posMTrillatAColumSize];
432432
// Find determinant of A[][]
433433
int det = clacDeterminant(A, posMTrillatAColumSize);
434434
if (det == 0)
@@ -448,9 +448,9 @@ static double** calcInverse(double **A, int matrixArows)
448448
return inverse;
449449
}
450450

451-
static double** leastSquareReg(double **matrixA, double **matrixB, int matrixArows)
451+
static double** leastSquareReg(double **matrixA, double **matrixB, int matrixArows, int matrixAcol)
452452
{
453-
double **matrixATransposed = transpose2DimMatrix(matrixA);
453+
double **matrixATransposed = transpose2DimMatrix(matrixA, matrixArows, matrixAcol);
454454
double **matrixATransposedA = multiplyMatrices(matrixATransposed, matrixA, matrixArows);
455455
double **matrixATransposedAInverse = calcInverse(matrixATransposedA, matrixArows);
456456
double **matrixATransposedAAdd = multiplyMatrices(matrixATransposedAInverse, matrixATransposed, matrixArows);
@@ -463,14 +463,14 @@ ecefPos trillatPosFromRange(satLocation finalSatPos, satRanges finalSatRanges)
463463
{
464464
std::map<int, ecefPos>::iterator it_;
465465
std::map<int, double>::iterator finalSatRangesMap;
466-
int matrixArows,matrixAcol = 0;
466+
int matrixArows, matrixAcol = 0;
467467
double x, y, z;
468468
double Am, Bm, Cm, Dm;
469469
double range;
470470
int nSat = finalSatPos.locations.size();
471471
ecefPos finalPos = { 0.0, 0.0, 0.0 };
472-
double **matrixA = 0;
473-
double **matrixB = 0;
472+
double **matrixA = new double*[3];
473+
double **matrixB = new double*[1];
474474

475475
matrixAcol = posMTrillatAColumSize;
476476
matrixArows = nSat;
@@ -504,7 +504,7 @@ ecefPos trillatPosFromRange(satLocation finalSatPos, satRanges finalSatRanges)
504504
}
505505

506506
// least square regression
507-
double **finalECEF = leastSquareReg(matrixA, matrixB, matrixArows);
507+
double **finalECEF = leastSquareReg(matrixA, matrixB, matrixArows, matrixAcol);
508508

509509
finalPos.x = *finalECEF[0];
510510
finalPos.y = *finalECEF[1];

0 commit comments

Comments
 (0)