Gravityturn, what is it and how to do it?
How do we get to space in an easy and fuel efficient way? Nothing is really fuel efficient when talking about defying gravity to reach space, but there are some techniques that spend the fuel smarter.
First of all, the objective is to get into a safe and stable orbit. in Kerbal Space Program, that is reaching an altitude of at least 70000m above the surface. When you have reached an orbit where no part of it dips below 70000m, then you will continue to fall with grace around Kerbin, forever.
The bad approach
One way to achieve that is flying up intil you are above 70000m, then fly horizontally untill your Periapsis, the orbital lowest point is also above 70000m. This cost a lot of energy since you need to first overshoot your desired altitude to have enough time, then spend a lot of energy changing the orbit trajectory.
A better approach
That is why almost all crafts sent to space use a technique called Gravityturn. To sum it up easilly, start with going up until safe altitude and velocity. This is not very high, clear any structures is really sufficient. Next step is to tilt the craft a few degrees towards east. Why East? Because facing the rising sun means we go in opposite direction of the planet rotation, which give us a little speed for free. When the trajectory starts pointing to the east, we can set the heading to Prograde, and everything sorts out by itself as long as we keep accelerating along the trajectory.
When we achieved our desired Apoapsis, that is the orbits highest point, we can reduce the engines to a minimum burn until we are above the athmosphere of 70000m for Kerbin. Close to Apoapsis, we do the injection burn. The closer to Apoapsis the more precise the burn is, but not too close or you will overshoot. I usually calculate so I keep the craft at 50-70 seconds to Apoapsis, this will give me enough time for the injection burn unless my engines are too weak.
The above video shows a fully scripted automated launch from Kerbin Space Center to a low orbit, release of a satellite, and descent to splashdown on Kerbin. There are no accelleration in the video, the entire trip takes about 34 minutes. There are three simultaneous running scripts:
The first is the telemetry, which is shown in the open terminal window. This script keeps track of most parameters of interest to the mission, and some.
Second is the main computer, the AGC, sort of. This runs the gravityturn on the way up, releases the satellite, and runs the descent script.
Last is the satellite computer. This one holds to high enough altitude where it releases the flairing, and activates the satellite.
You can find my gravityturn script here.