Setting up your Script

Now that we've created our template file, we can begin to start writing our script.

This tutorial will be much easier with axcli installed.

Although we created the system, we actually don't know where Mars will be by the time the rocket gets there. First, we need to load our simulation to find the final position of Mars. With axcli we can load the system:

python -m axcli load rocket-launch.tmpl.ax

Then we can run a short Python script to analyze our results:

import axinite.tools as axtools
import axinite as ax

args = axtools.read("rocket-launch.tmpl.ax")
final_n = ax.timestep(args.limit, args.delta) # Getting the final timestep number
rocket_pos = args.bodies[2].r(0) # Initial position of the rocket
mars_final_pos = args.bodies[3].r(final_n) # This is our final position after 300 days


difference = rocket_pos - mars_final_pos # Difference vector between the starting rocket and ending Mars

Last updated