-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
Add LVLH frame and geoid intersection method #839
base: master
Are you sure you want to change the base?
Add LVLH frame and geoid intersection method #839
Conversation
2edbf7c
to
ebaa3ee
Compare
9de1023
to
4ca0a99
Compare
I just wanted to leave a quick note to say that I'm planning to look over this by maybe mid-week this week, and respond with some feedback! I'll be interested to see how the code looks. |
Thanks! No hurry, by the looks of the tests, I still have some tidying up to do. |
f1feb1e
to
d5184cf
Compare
Hi @brandon-rhodes, just thought I would ping you again for your thoughts/feedback on this PR. No hurry at all; I'm keen to hear what you think whenever you have the time. |
Ah, is your tidying-up now complete? Then I'll schedule some time this week to take a look—I'll try to take a look tomorrow morning. |
Ah yes, sorry about that, I should have dropped you a note to let you know I have tidied up and ran the tests locally to ensure they are passing. |
This is really a helpful pull request. Thank you so much. I implemented my own LVLH reference frame in the past into skyfield and will compare this results with your implementation. Some feedback here from my side:
In about 2 months I will have a little bit more time working on this. Then I will also be able to open source my implementation to show more practical applications. |
Thanks! I'm really glad to hear that you have found it useful. You raise two very good points. I agree with both suggestions, thanks for pointing that out. I was fortunate to only need pitch and roll for the instrument I was working with, so I took a shortcut there. But, completely forgot to go back and add yaw. I would be very keen to see your implementation/results once they are ready. I also need to apologise to @brandon-rhodes for making several commits since marking this as ready for review - sorry! I hope it hasn't inconvenienced you. I will aim to make the two changes mentioned above in the next few days, add will add a comment to let you know once I have done that. |
On the contrary, I need to apologize, for having gotten busy back in June and never coming back to give feedback! I'll try to take a look today, so that you can make adjustments while you're in the code to look at the suggested name improvements. |
(I did look at the code later that day, by the way, but have not yet grabbed a pad and paper to work through exactly why |
Simpler and faster sounds appealing! I guess somehow we could just use the position and velocity vectors to calculate the frame rotation? Anyway, I won't get ahead of myself, keen to see what you have whenever you have the time. |
In case I don’t get a chance to go over the math today or tomorrow, I can at least share a few early thoughts about the API rather than making you wait!
I’ll keep thinking and later this week I’ll hope to make more comments. Thanks for having the PR include tests — that brings it much closer to completion and will make it much easier to merge! |
Also, while looking into adding a Thanks for the other tips and suggestions - very useful. I will address them and chip away at getting this into a mergeable state. |
I've had a bit more of a think about your initial feedback, and made some progress (I think..) in the right direction.
Interested to hear whether these changes are a step in the right direction, whenever you have some time @brandon-rhodes. I'll track the progress/remaining to do's in a list here;
|
…g Geometric object
727a1d6
to
5bd963d
Compare
I've made a set of changes to tick off those remaining items in the to-do list in this comment above. A few points to note/follow up questions;
I also rebased this branch to bring in the latest updates to |
@jamesgrimmett — Thank you for the updates! I just this morning have given a conference talk about Skyfield, which will encourage me to now return to the code and look over open issues and pull requests, so you have perfect timing. (It will also help that my spare hours won't be busy with writing the talk!) Hopefully I'll either be able to respond from here on the road, or else next week when I'm home. Feel free to ping me with another comment on the issue if you haven't heard back by the end of next week. |
Hi @brandon-rhodes - how coincidental! I hope your talk and travel went well. I have updated the |
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.
If you wish to do some additional applications-oriented testing, I can provide you with some test data generated by a well-known industry tool that includes data like timestamped satellite-Sun LVLH position vectors and associated satellite position/velocity vectors.
y_lvlh = -L_vec / length_of(L_vec) | ||
x_lvlh = cross(y_lvlh, z_lvlh) | ||
|
||
matrix = array([x_lvlh, y_lvlh, z_lvlh]).T |
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.
Instead of or in addition to this method of returning the rotation matrix itself, could it return a scipy Rotation object? it would then be easily convertible back to a rotation matrix or to other useful forms like Euler angles or quaternions.
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.
Thanks for reaching out, the test data that you mentioned would be excellent! I had been meaning to spend some time thinking about additional testing strategies, so any data that you could provide would be very much appreciated.
Are you able to attach the data here? Otherwise, could you email it through to - james dot grimmett at protonmail dot com?
I think you make a good point about scipy Rotation objects being a nice, versatile way to carry the rotation information. I would lean toward keeping the return value as a matrix, however. Mainly to remain consistent with several other rotation_at
functions scattered throughout the skyfield.framelib
module, and also to avoid adding a scipy
dependency. That said, I would be curious what @brandon-rhodes opinion is - it may be an option that has been considered before?
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.
@jamesgrimmett — I agree entirely. SciPy is even larger than NumPy, and it would be a shame to nearly double the install size of Skyfield just for a single feature by adding it as a dependency. The Rotation
object also strikes me as a bit expensive, in terms of its setup cost (as I'm reading through its from_matrix()
builder method), for a basic operation in Skyfield.
If there's a good use case for turning Skyfield rotations into Rotation
objects, let's just plan on showing in the documentation how it would work, so that folks who need SciPy can import it into their own code and build the Rotation
.
@brandon-rhodes are you planning to merge this? what is the final status? |
Hi @brandon-rhodes, I made these modifications for a project that I was working on with skyfield, and thought that they might be more widely useful for others in the community.
Changes include;
skyfield.framelib.LVLH
, including methods to generate attitude vectors from viewing geometry.skyfield.toposlib.Geoid.intersection_of
It seems there are a few different conventions for defining an LVLH frame, but I've gone with z-axis anti-aligned with the position vector, and y-axis anti-aligned with the orbital momentum vector.
For the intersection method I've borrowed heavily from here. In short, a "distortion map" is defined to transform the ellipsoid into a unit sphere, and applied to both ellipsoid and vector. Then, the intersection problem is much easier to solve, and the inverse distortion can be applied to the solution.
I'd be interested to hear with you think! If you are in principle keen to add this functionality but have other ideas for the implementation, I'd be interested to discuss that also.