-
-
Notifications
You must be signed in to change notification settings - Fork 152
Added cartesian gps coords relative home point as additional computed fields #773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
a6a419c
added gps coords transform module gps_transform.js
demvlad e24e31c
Added computed fields for coords in cartesian system
demvlad ae42953
added coords values at curves legend
demvlad 7b8640b
The home distance id added as computed field
demvlad 490fa9e
added friendly names for gps cartesian coords
demvlad aaf3488
added using of gps home points altitude if it exists in log file
demvlad b7b9beb
gps coord names are changed
demvlad 0660ea1
Added example graphs for GPS Cartesian coords data
demvlad ab122c0
code issues are resolved
demvlad d0dd773
code issues are resolved
demvlad 3a23761
code issues are resolved
demvlad 026e65f
code style improvement
demvlad 64ff0ae
Field name is improved
demvlad 2bee001
Code style improvement
demvlad 80c78f8
Code style improvement
demvlad 1fcd35a
Code style improvement
demvlad 05d3515
Code style improvement
demvlad 9bb97fa
Code style improvement
demvlad d4b67de
Update gps_transform.js
haslinghuis 39ced34
Code style improvement
demvlad 255d625
Code style improvement
demvlad 26c6a7c
Code style improvement
demvlad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to declare with let before the switch case and assign value here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What result will in this variable with different frames type? We need it for "H" type only.
The SonarCloud shows the issue, but in my opinion, this is more good place to define it.
I've tryed to put this expression in the next code rows directly, without variable. But SonarCloud shows the issue too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sonar won't complain if you wrap the case in brackets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it works.