# MusicalHQ

Members

5

## Community Reputation

0 Neutral

• Rank
Bottle Rocketeer
1. ## Calculate landing coordinates on Kerbin

I played around with the position_at() function, and managed to get it to work, so that it gave me my landing predictions as a position vector. But... it wasn't accurate enough for me. So I started from scratch on a predictor that took into account drag. Using some equations, I was able to start with a velocity, and simulate what would happen using a basic physics model until it hit the ground. This turned out to be a lot simpler than I thought it would be - the hardest part was figuring out the atmospheric density on Kerbin at different altitudes (because its modeled on the US standard atmosphere). I wrote some functions (https://github.com/MusicalHQ/KSP-Landing-Predictions/blob/master/Landing.py) for this. So far, you can use the functions to calculate landing coordinates (right now just position vectors for body.reference_frame) on bodies with no atmosphere, and on Kerbin. I'll try and add Eve, Duna, Laythe, Earth, Venus, Mars, Titan and maybe some OPM moons too. My trajectories line up pretty well to mechjeb's, but that's the problem. My only way of checking whether my math is correct is comparing my results to mechjeb. If someone could have a look at the code and tell me whether my math makes sense, it would be appreciated. The only thing holding back the speed of the calculations is drawing the trajectory. I have a few ideas about how to fix this, but right now if you want to calculate the landing site, turn off drawing.
2. ## Calculate landing coordinates on Kerbin

So far I've been able to get the vector position of where the orbit intersects the ground (thanks, the position_at() seems very useful). However, the vector doesn't take into account Kerbins rotation, so doesn't give the true landing site. Is there any way to account for this?
3. ## Calculate landing coordinates on Kerbin

The air breaks sound interesting - thanks. However, I need to be able to get the coordinates for the landing within in my python program. kRPC allows python to interface with ksp, but doesn't interface with mods. Is there an equation to estimate the landing site? This would probably get complicated taking into account drag, so assuming a vacuum.
4. ## Calculate landing coordinates on Kerbin

Is there any way to semi-accurately predict where a craft would land? Mechjeb does this and gives a latitude and longitude, but I do not understand how it works. I'm trying to write a script that lands a sub-orbital rocket back on the launch pad in python using kRPC. Also, what would be a good way to steer the rocket onto the launch pad? The standard space plane control surfaces wouldn't work for a rocket in freefall.
5. ## Calculating the time to impact on Kerbin

I'm writing a python script using kRPC to propulsively land on Kerbin, but I can't find how to calculate the time to impact. Mechjeb and Kerbal Engineer do this, but I don't think kRPC can interact with them. With kRPC I know my current altitude, surface velocity, verticle velocity, horizontal velocity and terminal velocity. Is there an equation that I can use to get the time to impact?