Hopper rocket 1.0
Tutorial
Author: smoketeer
In Hopper rocket tutorials we’re paying tribute to historical rockets capable of powered landing in atmospheric environment, namely DC-X, Grasshopper and BlueShepherd. Instead of combining every bit of fall module into one script, we’re going to gradually build complexity.
Mission
You can either build your own rocket, or download a ready to go fully stock KSP v.1.6.1:
Remember, we want to start small! Mind you, if you decide to use your own rocket, tuning may slightly differ.
We want our rocket to have:
- RCS at the top
- landing gear
- no clamps!
We’re going to:
- launch the rocket straight up
- land anywhere, without location requirement
Implementation
You can either create a regular script in your archive(“0:/”), or a boot script in your boot directory.
Importing FALL
Let’s get into it! First we want to load FALL libraries. In this tutorial we need
only the hoverSlamModel
:
Launch
Now let’s add some launch logic:
Landing
At this stage our rocket majestically falls to its inevitable destruction. But have no fear! Hoverslam is here to rescue us:
How does it work? HoverSlamModel implements getThrottle()
method. It calculates
when(as late as possible) and how much throttle should be applied to successfully
kill all the velocity before our rocket hits the ground.
Summary
Code as a whole looks like this:
But what if?
Let’s take a look at line 10 of this code. What happens if we increase this number to say, 10000? Our ship will still go straight up and land, but you’ll notice that we’ve landed far away from the launchpad. That’s not good!
In the next tutorial we will try to reduce the error when falling from higher altitudes.