Newtonian physics & spacecraft control

Started by
6 comments, last by lawnjelly 5 years, 4 months ago

I was tying to figure out what to do with my procedural planets and for an initial step and I wanted to fly a spacecraft in and establish a low orbit around my world starting from some distant point and initial velocity.  I know how to set up the gravity and I think I can pretty much do manual controls that will simulate Newtonian physics. However what I'm looking for is some software or algorithms that let me establish the orbit by controlling thrust in the right direction at the appropriate points in a trip towards the planet.

So I guess the software would accept something like starting position, starting velocity, desired orbit height (I'm assuming circular for now) , and desired orbit plane.  From there it would give me firing points, duration and trust vectors needed to for the orbit.  To make things simpler I'm assuming infinite fuel. I figure NASA must do stuff like this all the time but I haven't been able to find something solid on how it's done.  Perhaps it's too complex, I'm not really sure, but I thought I throw the question out there anyway.

Advertisement

I've seen people within the Kerbal Space Program community doing this kind of math by hand, perhaps some of the tech savvy ones have put together some basic programs/scripts or even GUIs to automate the process somewhat? Worth checking out what their player-community and modding-community is doing.

My input as a less than gifted mathematician : :) 

Things are easier if you know some things about your physics simulation, the tick rate. If you decide in advance you want to achieve orbit at a certain height from the centre, at your equilibrium orbit, as I understand it your perpendicular velocity at a tick will take you 'upward' on a tick the same distance that gravity will pull you 'downward'. So you can calculate in advance the velocity you would need to maintain orbit at a height, given your physics simulation parameters.

To get yourself into orbit you could either try and calculate everything in advance, which probably would be a nightmare (might be what you are asking for), or use a feedback system to control the thrust and move you towards a desired situation, which is what I would use, with your target being a particular height and velocity as you move towards the planet. You could then just have a feedback system to periodically adjust to keep target velocity and height once you reach orbit.

You also might need to decide how quickly you want to reach orbit. If you are a gazillion light years away from the planet you might want to accelerate a bit to get in the vicinity before decelerating to orbit velocity.

More specifically a sensible first target might be an entry to orbit at a point perpendicular to a line between the rocket initial position and the planet centre.

55 minutes ago, lawnjelly said:

To get yourself into orbit you could either try and calculate everything in advance, which probably would be a nightmare (might be what you are asking for),

Yeah I guess I kind of was, LOL! I figure NASA does it but .... well .... I'm not NASA, so you're right it might be a bit unrealistic.  I can do some basic stuff myself. I mean I'm sure I can calculate the final orbit height and speed based on a given gravity.  However getting into the orbit, especially with a specific orbital plane is beyond my knowledge.  I was thinking maybe there is a way to first orbit and then correct the plane.  I imagine NASA must change satellite orbits somehow.  The only thing I kind of remember is the Hohmann transfer, but that's really an altitude change.

You can adjust the orbital plane by burning in the normal/anti-normal direction. Here's a quick article on it: https://wiki.kerbalspaceprogram.com/wiki/Maneuver_node#Directions

Playing Kerbal Space Program is a great way to improve your intuition, and possibly math too, on orbital manuevers. And since so many space enthusiasts play it, you can find pretty informative tutorials and articles on real orbital mechanics by looking for resources on KSP.

14 hours ago, 1024 said:

Playing Kerbal Space Program is a great way to improve your intuition, and possibly math too, on orbital manuevers. And since so many space enthusiasts play it, you can find pretty informative tutorials and articles on real orbital mechanics by looking for resources on KSP.

Yeah I'm getting the idea that this is pretty good advice. Thanks.

I did write another post yesterday but decided to leave it because I was sure someone with more (a little) knowledge of this would pop up, anyway a bit more discussion because I am interested to know the answer myself:

If you watch the movie 'hidden figures' one of the things that popped out is that they figured out using the euler method (which is what we use in game physics) was the key to solving the complex calculations needed for their problem. There is a more in depth discussion here (I don't understand any of it because I don't speak math).

Whether they still use the euler method in the same way now I don't know, but it is a potential way of solving complex scenarios like interacting gravity from different planets (as long as you take into account the downside of euler method being the step sizes and inaccuracy due to this).

Anyway, one possible way of deciding the most efficient trajectory to get towards a desired destination is simply to run a load of simulations. If you consider the closeless to the desired destination as a measure of success (and maybe time taken / fuel used), you can essentially do a shedload of simulations firing off your rocket in all possible directions / velocities and find out which gets you closest to your destination (goodness of fit).

If you could do infinite simulations, you would be guaranteed to find the best answer. This is very inefficient, so for these kinds of problem there is often an optimization strategy to shortcut through the search space. You might for example run a very rough version of the simulation get a rough answer, then run more accurate versions around the rough answer etc.

It is important to note that this type of optimization method doesn't guarantee you the 'best' solution, because often the strategy ends up getting stuck in local peaks of goodness of fit. This is actually analogous to the same thing which happens in evolution, and can lead to evolutionary dead ends and extinctions. Your optimization strategy may for example end up with a direct route to the destination, when the actual best method is to slingshot around another planet.

I like to think this is what happens when han solo is making the calculations to make a jump to lightspeed:

Quote

BEN

How long before you can make the jump to light speed?

HAN

It'll take a few moments to get the coordinates from the navi-computer.

The ship begins to rock violently as lasers hit it.

LUKE

Are you kidding? At the rate they're gaining...

HAN

Traveling through hyperspace isn't like dusting crops, boy! Without precise calculations we could fly right through a star or bounce too close to a supernova and that'd end your trip real quick, wouldn't it?

Anyway of course the potential trouble with this sort of approach of making calculations beforehand is both one of a potential performance blip, and the inability to cope with changing scenarios (perhaps an alien controlled asteroid, like in the Expanse). Whereas the feedback I originally suggested might result in a slightly suboptimal path but has no performance blip, and can deal with dynamic situations.

This topic is closed to new replies.

Advertisement