Created
May 15, 2021 09:01
-
-
Save krisoft/4f06624a79f4a0df1107fb29be994a25 to your computer and use it in GitHub Desktop.
Calculating the distance between perseverance and zhurong rovers.
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
import math | |
MARS_RADIUS = 3389.5 # https://en.wikipedia.org/wiki/Mars | |
# source https://spacenews.com/chinas-zhurong-mars-rover-lands-safely-in-utopia-planitia/ | |
ZHURONG_LONGITUDE = 110.318 | |
ZHURONG_LATITUDE = 24.748 | |
# source https://www.jpl.nasa.gov/news/press_kits/mars_2020/launch/mission/landing_site/ | |
PERSEVERANCE_LONGITUDE = 77 | |
PERSEVERANCE_LATITUDE = 18 | |
# modified from https://stackoverflow.com/a/4913653 | |
def haversine(lon1, lat1, lon2, lat2, radius): | |
""" | |
Calculate the great circle distance between two points | |
on the earth (specified in decimal degrees) | |
""" | |
# convert decimal degrees to radians | |
lon1, lat1, lon2, lat2 = map(math.radians, [lon1, lat1, lon2, lat2]) | |
# haversine formula | |
dlon = lon2 - lon1 | |
dlat = lat2 - lat1 | |
a = math.sin(dlat/2)**2 + math.cos(lat1) * math.cos(lat2) * math.sin(dlon/2)**2 | |
c = 2 * math.asin(math.sqrt(a)) | |
return c * radius | |
if __name__=="__main__": | |
distance = haversine(ZHURONG_LONGITUDE, ZHURONG_LATITUDE, PERSEVERANCE_LONGITUDE, PERSEVERANCE_LATITUDE, MARS_RADIUS) | |
print( f"The distance between the zhurong and the perserverance rowers is {round(distance)} km." ) |
Thank you Bill. It was just a quick sketch to calculate the approximate distance. I used it to show that it is very unlikely that these two robots can ever "visit" each other.
To do that the used precision was more than enough.
That being said thank you very much for the more precise values!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That lat/lon for Zhurong was the planned landing spot. Actual lat/lon was reported to be 109.7 E, 25.1 N, modified inexplicably on Wikipedia to 109.9. Since then, rover and lander have been imaged by HiRISE, leading to improved lat/lons of rover and lander. I'd not consider those to be 'final' values, but they'll be a lot closer than the 0.1-degree precision values.
Also note that Perseverance is at about 77.4509E, 18.446N. That tool has positions for most hardware that has been on Mars, though it's not caught up on Zhurong yet.