Setting up your Script
Now that we've created our template file, we can begin to start writing our script.
Although we created the system, we actually don't know where Mars will be by the time the rocket gets there. To figure out what we need, we'll use the axana.intercept
function to find the point that we'll land at.
import axinite as ax # Importing axinite as ax
import axinite.tools as axtools # Importing axtools for loading
import axinite.analusis as axana # Importing analyzation functions as axana
args = axtools.read("examples/rocket-launch.tmpl.ax")
bodies = axtools.load(args, verbose=True) # Loading the system
result = axana.intercept(bodies[3], bodies[2], (0, 1.1e4), ax.timesteps(args.limit, args.delta), args.delta, verbose=True)
# Gets the intercept point for the Rocket and Mars
position = result[1]
unit_vector = result[3]
speed = result[0]
Now unit_vector
holds the direction towards the point we're aiming for, and speed
holds our average travel speed.
If you get a NoneType
error, that means your rocket couldn't find an intercept. You can try adjusting the speed range ((0, 1.1e4)
) or editing your template.
With those variables, we can now write our modifier:
Last updated