Compute distance between points on a general celestial body#434
Compute distance between points on a general celestial body#434adityapande-1995 merged 32 commits intomainfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## main #434 +/- ##
==========================================
- Coverage 99.69% 99.65% -0.05%
==========================================
Files 73 73
Lines 6567 6641 +74
==========================================
+ Hits 6547 6618 +71
- Misses 20 23 +3
Continue to review full report at Codecov.
|
Signed-off-by: Aditya <aditya050995@gmail.com>
Signed-off-by: Aditya <aditya050995@gmail.com>
Signed-off-by: Aditya <aditya050995@gmail.com>
5c81107 to
4d68400
Compare
|
Making changes to the Latitude and logitudinal references can be updated using the |
Signed-off-by: Aditya <aditya050995@gmail.com>
Signed-off-by: Aditya <aditya050995@gmail.com>
scpeters
left a comment
There was a problem hiding this comment.
I think we should deprecate the existing static Distance function and rename it to DistanceWGS84 or something like that. We could add the same function alias to ign-math6
jennuine
left a comment
There was a problem hiding this comment.
Initial pass, +1 to deprecate the existing static Distance() function
Signed-off-by: Aditya <aditya050995@gmail.com>
Signed-off-by: Aditya <aditya050995@gmail.com>
Signed-off-by: Aditya <aditya050995@gmail.com>
Signed-off-by: Aditya <aditya050995@gmail.com>
Signed-off-by: Aditya <aditya050995@gmail.com>
Signed-off-by: Aditya <aditya050995@gmail.com>
There was a problem hiding this comment.
LGTM, left some minor comments. I'm new to gz-math so this could use a final review from @scpeters
Also, should we mention the default constructor assumes Earth here?:
gz-math/include/gz/math/SphericalCoordinates.hh
Lines 77 to 78 in e49d9f4
| /// \param[in] _lonA Longitude of point A. | ||
| /// \param[in] _latB Latitude of point B. | ||
| /// \param[in] _lonB Longitude of point B. | ||
| /// \return Distance in meters. |
There was a problem hiding this comment.
This may be too nitpicky but if the radius was set in different units then the distance returned would be in those units (eg. radius is in km). Not sure if we should mention this, remove meters in the comment, add in meters to the comments anywhere radius is mentioned, or ignore my nitpicky comment? Any thoughts @scpeters ?
There was a problem hiding this comment.
we use meters everywhere in our API, so I think we can just leave it at that
5620578 to
fbe260a
Compare
|
I messed up the commit history here. Fixing that. |
Signed-off-by: Louise Poubel <louise@openrobotics.org>
Signed-off-by: methylDragon <methylDragon@gmail.com> Signed-off-by: Louise Poubel <louise@openrobotics.org> Co-authored-by: Louise Poubel <louise@openrobotics.org>
* Suppress zero variadic macro args message * Remove unused clang flag, suppress ruby warnings Signed-off-by: Michael Carroll <michael@openrobotics.org>
889fad5 to
9e756fe
Compare
Signed-off-by: Aditya <aditya050995@gmail.com>
bb18e27 to
2a7c853
Compare
ahcorde
left a comment
There was a problem hiding this comment.
I saw that you added the Python interface, do you mind to add the tests too ? otherwise can you add an issue ?
Signed-off-by: Aditya <aditya050995@gmail.com>
Signed-off-by: Aditya <aditya050995@gmail.com>
Signed-off-by: Aditya <aditya050995@gmail.com>
|
Ported test cases to python bindings, passing in CI, cc @ahcorde : |
Signed-off-by: Aditya <aditya050995@gmail.com>
Signed-off-by: Aditya <aditya050995@gmail.com>
| // https://en.wikipedia.org/wiki/Eccentricity_(mathematics)#Ellipses | ||
| this->dataPtr->ellP = sqrt( | ||
| std::pow(this->dataPtr->ellA, 2) / std::pow(this->dataPtr->ellB, 2) - | ||
| 1.0); |
There was a problem hiding this comment.
nit: the ellE and ellP computations are repeated between this MOON_SCS case and the prior EARTH_WGS84 case. We could potentially move them outside of this switch block if the CUSTOM_SERVICE and default cases had a return instead of break, but this isn't a big deal, so it's not required
Addressed changes, dismissing so that github allows merging
🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸
🎉 New feature
Summary
The current
SphericalCoordinates::Distancefunction uses hardcoded Earth's radius for its calculation. In order to compute distances between points for any non-Earth celestial body, we would need to consider its radius as well. This PR overloads theDistance()function to add an additional parameter,_radius.Test it
Added a simple test case : Consider a hypothetical body with its radius half as that of the earth. The distance between 2 points on that body should be half as the distance between them on Earth.
Implementation variation
I could also implement radius as an optional parameter in the original
SphericalCoordinates::Distance()function.Another idea is to keep a small database of radii of common celestial bodies, so "MOON" should automatically get you a radius of 1.7374 * 10^6 m. This way it makes sense to keep overloads of the
Distancemethod, we can have a third one with the signatureDistance(Angle, Angle, Angle, Angle, string _celestialBody).Checklist
codecheckpassed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-bymessages.🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸