Replies: 2 comments 2 replies
-
A first observation: I would expect the elevation of the resulting position (above or below ground) to be fairly small — say, the distance to the Moon in AU. But if I add:
— right before your
Is this also a larger number than you were expecting, or have I misunderstood what the loop is trying to accomplish? |
Beta Was this translation helpful? Give feedback.
-
I was also trying to work out ISS transits and ran into the problem of find where the line of sight intersects with Earth. However, trying to find where a line intersects an ellipsoid seemed to be really complicated based on what I was finding in math forums. Thanks to a hint from @brandon-rhodes in #801, I was able to code something based on the SPICE Here's my script which looks for locations at which the ISS will appear to transit Mars. Though, it should be trivial to modify to look for any satellite transiting any body. I get the positions of the target body and the satellite, then "draw" a vector between them. The location where this vector intersects Earth is where the target body and satellite will be in the same apparent position. At the end, I also plot the locations on a map. Though, I still need to work out how to handle the longitude wrapping.
|
Beta Was this translation helpful? Give feedback.
-
Hi! Let me preface this by saying that I'm writing as much detail as possible to make sure I don't leave out anything useful - hope this post isn't too incredibly long :)
I'm hoping to write a script that will allow me to detect times when the ISS passes in front of the moon, so I can take a neat picture of its silhouette against the glow of the moon. I chose to solve this graphically: I made a script where I punch in my location and time, and it finds times the ISS is near the moon, then I'm able to use sliders to relocate my latitude and longitude. Whenever I change the sliders, it re-draws the ISS and moon positions in the sky, so by adjusting them I can get the two to line up, and then I just read off where the sliders turned out to land, and then I know where to go.
In order to validate the results of that script, I write a second script. The second script takes the time from the first script. At that time, it finds the positions of the moon and the ISS. Then, it draws a vector from the moon to the ISS, and then extends that vector until it intersects the Earth. Then it finds the latitude and longitude where that intersection occurred. We hope to find that the intersection is at the exact same location as our observer was in the first script.
Here is a proof of concept of my first script. It shows the ISS right in the middle of the moon in the sky. (please note: This is a trimmed down version of the script I originally wrote; this is intended as a somewhat-minimal example, for ease of understanding. Therefore some programming choices here may seem odd, but they're just due to leftovers from the fully fleshed out script):
This generates a plot image, which you can zoom into, and see the red dot of the ISS landing nearly centered on the moon. Therefore, we've determined that at the precise time of [2021,9,23,4,31,59.0], the ISS passes in front of the moon (Well, passed in front of the moon - I've been working on debugging this for a while :) ).
Now, to validate that, I coded up the mathematical version I mentioned. If we punch in that same time, we hope to see the same location that generated our first image: 40.33825356986421,-72.86106736111111.
Here's that code:
The output of this code is:
40.15023086852985, -72.86124647265113.
Again, compare to the observer location from the first script:
40.33825356986421,-72.86106736111111
Interestingly, the longitude seems to match (to the precision I would expect), while the latitude has a wide offset. If I punch that latitude into the first script, the ISS totally misses the moon. An offset of 0.18 degrees of latitude corresponds to almost exactly 20 kilometers, which is a pretty wide margin to miss.
Now, the best guesses I can make regarding why the answer would be different would be if my earth radius is being treated differently by the two scripts. But the first script takes an elevation of 0, and the second script makes sure to evaluate the earth radius at the known intersection location, so that doesn't seem like it would end up generating errors.
In the end, I'm wondering if I'm going about this all wrong. Maybe I'm taking the wrong approach with my second script? Is there a better way to validate my first script? What's the best way to do what I'm looking to do, to find the vector intersect point? Maybe I'm running into a floating point error? I could see a possibility that my unit vector ends up slightly misaligned, and that that would make a sub-degree error that, multiplied over the hundreds of kilometers up to the ISS, makes for a 20 kilometer error, but any advice on where to hunt would be hugely appreciated.
Thanks for taking the time to read!
Beta Was this translation helpful? Give feedback.
All reactions