mirror of
https://gitlab.com/Anson-Projects/projects.git
synced 2025-06-16 06:56:46 +00:00
52 lines
1.2 KiB
Plaintext
52 lines
1.2 KiB
Plaintext
---
|
|
title: "Moon Cannon: dos"
|
|
description: |
|
|
Can you shoot Earth from the Moon? Simulate lunar ballistic launches with Julia. Explore orbital mechanics, gravity, and drag in a simplified Moon-to-Earth cannon model.
|
|
date: 2024-09-25
|
|
categories:
|
|
- Julia
|
|
- Astrodynamics
|
|
- Code
|
|
- Aerospace
|
|
- Space
|
|
- Math
|
|
draft: false
|
|
freeze: false
|
|
image: moon_spirograph.png
|
|
---
|
|
|
|
```{julia}
|
|
using SPICE
|
|
|
|
const LSK = "https://naif.jpl.nasa.gov/pub/naif/generic_kernels/lsk/naif0012.tls"
|
|
const SPK = "https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de440.bsp"
|
|
|
|
# Download kernels
|
|
download(LSK, "naif0012.tls")
|
|
download(SPK, "de440.bsp")
|
|
|
|
# Load leap seconds kernel
|
|
furnsh("naif0012.tls")
|
|
|
|
# Load a planetary ephemeris kernel
|
|
furnsh("de440.bsp")
|
|
|
|
function get_planet_positions(epoch)
|
|
planets = ["MERCURY", "VENUS", "EARTH", "MARS",
|
|
"JUPITER", "SATURN", "URANUS", "NEPTUNE"]
|
|
positions = Dict()
|
|
|
|
for planet in planets
|
|
# Get position vector in km relative to Sun
|
|
pos, _ = spkpos(planet, epoch, "J2000", "NONE", "earth")
|
|
positions[planet] = pos
|
|
end
|
|
|
|
return positions
|
|
end
|
|
|
|
# Example usage (epoch in UTC)
|
|
epoch = "1995-12-17T12:00:00" |> utc2et
|
|
positions = get_planet_positions(epoch)
|
|
|
|
``` |