-
-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added cartesian gps coords relative home point as additional computed…
… fields (#773) * added gps coords transform module gps_transform.js * Added computed fields for coords in cartesian system * added coords values at curves legend * The home distance id added as computed field * added friendly names for gps cartesian coords * added using of gps home points altitude if it exists in log file * gps coord names are changed * Added example graphs for GPS Cartesian coords data * code issues are resolved * code issues are resolved * code issues are resolved * code style improvement * Field name is improved Co-authored-by: Mark Haslinghuis <[email protected]> * Code style improvement Co-authored-by: Mark Haslinghuis <[email protected]> * Code style improvement Co-authored-by: Mark Haslinghuis <[email protected]> * Code style improvement Co-authored-by: Mark Haslinghuis <[email protected]> * Code style improvement Co-authored-by: Mark Haslinghuis <[email protected]> * Code style improvement Co-authored-by: Mark Haslinghuis <[email protected]> * Update gps_transform.js * Code style improvement * Code style improvement * Code style improvement --------- Co-authored-by: Mark Haslinghuis <[email protected]>
- Loading branch information
1 parent
f3b680b
commit 62978cc
Showing
4 changed files
with
125 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
export function GPS_transform(Lat0, Lon0, H0, Heading) { | ||
|
||
function deg2rad(deg) { | ||
return deg * Math.PI / 180.0; | ||
} | ||
|
||
Lat0 = deg2rad(Lat0); | ||
Lon0 = deg2rad(Lon0); | ||
const Semimajor = 6378137.0, | ||
Flat = 1.0 / 298.257223563, | ||
Ecc_2 = Flat * (2 - Flat), | ||
SinB = Math.sin(Lat0), | ||
CosB = Math.cos(Lat0), | ||
SinL = Math.sin(Lon0), | ||
CosL = Math.cos(Lon0), | ||
N = Semimajor / Math.sqrt(1.0 - Ecc_2 * SinB * SinB), | ||
|
||
a11 = -SinB * CosL, | ||
a12 = -SinB * SinL, | ||
a13 = CosB, | ||
a21 = -SinL, | ||
a22 = CosL, | ||
a23 = 0, | ||
a31 = CosL * CosB, | ||
a32 = CosB * SinL, | ||
a33 = SinB, | ||
|
||
X0 = (N + H0) * CosB * CosL, | ||
Y0 = (N + H0) * CosB * SinL, | ||
Z0 = (N + H0 - Ecc_2 * N) * SinB, | ||
c11 = Math.cos( deg2rad(Heading) ), | ||
c12 = Math.sin( deg2rad(Heading) ), | ||
c21 = -c12, | ||
c22 = c11; | ||
|
||
this.WGS_ECEF = function (Lat, Lon, H) { | ||
Lat = deg2rad(Lat); | ||
Lon = deg2rad(Lon); | ||
const | ||
SinB = Math.sin(Lat), | ||
CosB = Math.cos(Lat), | ||
SinL = Math.sin(Lon), | ||
CosL = Math.cos(Lon), | ||
N = Semimajor / Math.sqrt(1 - Ecc_2 * SinB * SinB); | ||
|
||
return { | ||
x: (N + H) * CosB * CosL, | ||
y: (N + H) * CosB * SinL, | ||
z: (N + H - Ecc_2 * N) * SinB, | ||
}; | ||
}; | ||
|
||
this.ECEF_BS = function (pos) { | ||
const PosX1= a11 * (pos.x - X0) + a12 * (pos.y - Y0) + a13 * (pos.z - Z0); | ||
const PosZ1= a21 * (pos.x - X0) + a22 * (pos.y - Y0) + a23 * (pos.z - Z0); | ||
|
||
return { | ||
x: c11 * PosX1 + c12 * PosZ1, | ||
y: a31 * (pos.x - X0) + a32 * (pos.y - Y0) + a33 * (pos.z - Z0), | ||
z: c21 * PosX1 + c22 * PosZ1, | ||
}; | ||
}; | ||
|
||
this.WGS_BS = function (Lat, Lon, H) { | ||
return this.ECEF_BS(this.WGS_ECEF(Lat, Lon, H)); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters