Simple approach to trajectory calculation


I’m developing a spacecraft game and my own approach to navigate through space is massively failing due the lack active physics knowledge.
I hope that you and this project can help me :wink:

So probably this could be the wrong idea, but let me explain:
What I want to achieve is to calculate a “good enough” trajectory for a spacecraft which can ignore the gravitational distractions through a sci-fi sublight drive.
Not ignored can be the own ships mass and of course the maximal safe acceleration and the need to plot the course for the shortest time to the destination.

Now we have a planned own trajectory and a second one from another ship. Both ships has to react on the others actions, therefore the planned trajectory will be changed at a given time due acceleration in another direction.

And this is the point where my own code failed, because I can’t calculate the mass inertia correct.
I sat a long time on this problem and came to the conclusion that I need a library from guys who knows what they are doing
Of course this is not the only point - due my missing “physics overview” my code is ridicilous complex.

Thanks for reading up to here, the bold text is just to have some optical fun in the text :wink:
I tried to follow the continious maneuver example but to ask it directly seems to be more promising.

Could you help me to build up a minimal example to start with this approach? When I understand enough how Orekit works I can do the rest, but I’m completely overwhelmed and have no idea how to start.

thanks and bya,

Hi @CoderGarm welcome,

For your needs, I think Orekit is a bit too much. The library is used in real space systems, as such it focuses on accuracy and reliability. It is not possible in Orekit to switch off “gravitational distractions”. If you need to set up your own game physics, I guess using only TimeStampedPVCoordinates and modelling your sublight drive as a constant acceleration would be sufficient.

So you can look at the coordinates class and perhaps at the CelestialBody and Frame so you can compute trajectories with respect to solar system bodies.

Hey @luc,

thanks for your help :slight_smile:

Reducing the distractions was only an idea to make the setting more easy - it would be great to use Orekit to model a solar system with respect to the laws of physics.

So let me try to follow up org.orekit.forces.maneuvers.ImpulseManeuverTest#testInertialManeuver far as “easy to learn” blueprint.

As I understand there are a set of basic parameters defined (position, beginning timestamp, velocity, a acceleration of zero) and also the resulting movement by time due impulse of the “observed object” by deltaV.
The observed object there has also its own gravity, given my mu and a rotation. I assume, mu has no influence because the test is only about a single object?

Both, rotation and movement (by the given impulse) is given per potion for driftTimeInSec. Finally, the KeplerianPropagator executes a “tick” on every call of .propagate(...) and returns the position, rotation angle etc inside the SpacecraftState object.

When this assumptions are correct, I would assume that I have to create multiple objects and could call the .propagate(...) for every instance.

Is this correct somehow?
This test is about a single impulse to an object, the acceleration is zero here. Can I change the acceleration direction and value without creating new Propagators or do I have to transport the inertia to a new instance?

Sorry for all the questions, but as longer as I look into the code as more I’m interested to try my physics studies again :see_no_evil: