The Klaxon Starts Ringing

Imagine it’s the year 2300. Earth and Mars are at war. You’re an Earth warship, blue, based on an asteroid in the asteroid belt. A martian drone, red, lands on the opposite side of the asteroid. It’s out of line of sight so how do you aim your rail-gun to destroy it?

Traditional Trajectory Problem

Now, you may have noticed that instead of drawing you as a space ship I drew you as a cannon. That’s because this problem is similar in nature to the cannon problem everyone does in a basic physics class. If you want to hit a target somewhere what angle must you fire at?

This problem, with certain assumptions, can be solved analytically by integrating the equations of motion. The assumptions needed to make this problem solvable are

Neglect drag

Assume constant gravity (Both in magnitude and direction)

Assume flat earth

Because we are in the vacuum of space we can assume no drag, but because of the size of the asteroid and the distance we need to shoot we can no longer assume constant gravity or flat earth. If we assumed either, the problem would be unsolvable.

Orbital Governing Equations

Because of the sizes we’re dealing with we must rely on Newton’s law of universal gravitation.

Which by plugging it into newtons second law we get

where μ is the gravitational parameter. Note we can usually measure μ to a greater degree of accuracy than either the universal gravitational constant or the mass of the body.

Lets also set a few parts of the problem to make our lives easier.

The asteroid is a perfect sphere

Let’s set our coordinate system so that our rail-gun has (x,y) coordinates of (0,+radius)

Our rail-gun’s muzzle velocity is below escape velocity and high enough to hit the target.

The Asteroid isn’t rotating

In the end our setup should look like this

Newton Solver

Now we have the following givens from the problem

The position of the rail-gun

The position of our target

The initial velocity out of the rail-gun

And we want to find the angle, relative to the local horizon, that we should fire the rail-gun.

We have enough givens to solve this problem analytically (To at most two trajectories, I’ll cover that and a few other permutations of the problem in a future post), but for now lets turn to a numerical method like newtons method. Last week’s post covered the basics of newtons method so I’m going to leave out some detail with this weeks post.

Let’s begin by defining some cost function between where we want to hit, and where we end up hitting.

Note: the extra π/2 is there because of how we defined our coordinate system.

We can now write out our update equation

We know that the x and y locations of our impact are functions of Φ, but we don’t have a good, closed form solution, so let’s use the finite difference formula approach from the last post

This is based on a forward difference. We used the last two iterations to determine what our new iteration should be. How do we get our first two values for J and Φ? I’ll go over how we get our first value of Φ in the next section, but we get our second value of Φ by adding a small amount (around 1 percent of our first Φ) to our first Φ. We get our J’s by forward integrating our governing equations forward using our Φ’s as initial conditions. You will need to store your old Φ and J(Φ) values for the last two iterations but this is a fixed memory cost. As long as you use your old values in your update equation, you will only need to run one forward integration. If your update value is large enough the forward difference approximation may break down, but for now let’s assume it’s good enough.

If you want to derive a better approximation try to write an update based on a central difference. There will be less error in your derivatives, but you will have to do two forward integrations at each time step to calculate your update.

Initial Guess

Now that we have our update equation,how do we make an initial guess for the solution? Let’s use the simplified trajectory problem where we do have a solution for the problem. First let’s convert our round asteroid to a flat plane

In order to convert our circular asteroid to a flat plain lets move the target to a point that’s equal to the arc distance on the asteroid and at the same height

Let’s also place our cannon at the origin of the new coordinate system. Finally lets assume we can treat gravity as a constant so that our equations of motion are now linear and solvable. Using this and plugging in our target values gives us the following relationship.

Where a is the accelreation at the surface of the asteroid

Using some trig identities and algebraic manipulation we get the following

and once more through trig identities and algebraic manipulation we get

Now what should we use as our initial velocity? First we can bound it on two ends. The high bound will be escape velocity which we can calculate using the following

Next let’s set a lower bound. For an easy to calculate lower bound let’s use whatever the orbital velocity would be at the surface of our asteroid.

This isn’t the actual lower bound as we only need to cover half the asteroid with our initial velocity, but this was easier to calculate.

Final Shot

So now we have our update equation and our initial guess, let’s actually solve the problem and obtain a firing solution! Here’s the Gif of the us acquiring a firing solution.

And here’s the round actually being fired.

Now, you’ll notice that it took a relatively long time for the projectile to hit the target. This is because our asteroid is quite small and the small amount of initial velocity corresponds to a high trajectory. If we wanted to change the time of flight to a specific lower number we would need to decrease the initial velocity. I’ll briefly describe a way we could do this as any change in initial velocity would also require a change in Φ. Instead of having a single update we could now have the initial velocity constantly update as well using an equation of the following from

where TOF() is the time of flight function. We would run both update equations at the same time and let it converge from there. What if we choose a desired TOF that is outside the solution space of the problem? We can write our scripts to stop running the update equation if we hit either of the bounding values we determined earlier.

What is Asteroid Wars?

This is a first part in an indefinite series that explores astrodynamcis and numerical methods, through different scenarios. To make it interesting, I’ll try to give the problems some backstory as to why we want to solve the problem. Most of the time this backstory will involve some sort of war between the blues (Earth) and red’s (Mars). Mars in this world was a colony of earth that is now an independent military entity. If this sounds familiar, this is because I finally got around to watching season 3 of the expanse. Great show, you can find season 3 on amazon! Our universe is not the expanses universe but may have certain similarities. I’m hoping that these more applied posts are able to complement the more theoretical posts that go over topics and ideas.

*No belters were harmed in the making of this post*

Want more Gerehses…

If you want to receive the weekly Gereshes blog post directly to your email every Monday morning, you can sign up for the newsletter here!

If you can’t wait for next weeks post and want some more Gereshes I suggest

What is the n-Body Problem?

What is my Engineering EDC

How to Write a Lot

Share this: Facebook

Reddit

Twitter

Pocket

More

Print

LinkedIn



Tumblr

Pinterest



Telegram

WhatsApp



Skype

