Sunday, August 6, 2017

KSP: Laythe Colony, Part 1

A while back, I read a book called Seveneves, by Neal Stephenson, and found it to be immensely entertaining. The premise is that, for unknown reasons, the moon explodes and humanity has two years to get off the surface of the planet before the pieces crash into it. What I particularly enjoyed is that it's set in the near future, so we only have the tools we have now to work with. One of those tools is the International Space Station, which becomes the hub of a permanent space habitat. With no budget constraints and no point in risk aversion, a convincing amount of hacking manages to throw lots of hardware into space in a short period of time. And it falls on a few people to figure out what to do with all of it, since no viable long-term mission plan is proposed by ground leadership, who have other concerns. (Just go read it!)

You know who else has no budget constraint and no concept of risk aversion? The Kerbals! I decided a fun challenge would be to see how many Kerbals I can get off-planet in two (Kerbin) years, with the ultimate goal being to land them on Laythe and set up a colony. Laythe's atmosphere, while not directly breathable by Kerbals, has enough oxygen for jet combustion. And there is plenty of water.

Like, seriously a lot of water.
It's been a while since my Kerbals first carried out a mission to Laythe and back. Making a precision landing on Laythe's sparse, sand dune-covered islands was a challenge, especially with a top-heavy vertical lander. In order to establish a colony, Kerbals and equipment will have to meet at a single location on the surface of Laythe, so a better approach is needed. For the passengers, this means riding down on one of these:


This space plane uses four CR-7 R.A.P.I.E.R engines, hybrid engines that switch from air-breathing to closed-cycle at altitude. So, it takes off like a jet, builds up as much speed and altitude as it can, then switches to rocket propulsion to reach orbit. KSP's aero model was entirely redone for v1.0 and onward, making atmospheric flight both more realistic and more difficult. But this plane can still ferry six Kerbals into Low Kerbin Orbit (LKO) with a bit of fuel to spare.

It's also surprisingly sporty.
The Kerbals can't ride space planes all the way to Laythe, though. Well, they can if you build one like this. But I can barely get my six-passenger one into orbit so I'll need a more suitable living space for the passengers on the long cruise to Laythe. This led me to build my first true space station in LKO:

Finally a place to park all my space planes...
I wanted it to be modular and symmetric so it would be easier to add a propulsion stage for the long journey. This meant docking two space planes, and after some thought I decided they should be back-to-back to minimize the inertia on the long axis. (Any guesses as to why I would want to do that?) The planes are docked with two ports each for precise alignment and more rigidity.

The T-shaped station is actually launched into orbit in two pieces. The docking module attaches to the space planes, while the crossbar of the T is the main passenger module, where the Kerbals will ride out the long trip. The passenger module will become the hub of a much larger ship once propulsion is added on opposite the docking module.

Getting pieces this large into orbit is the work of a new two-stage heavy lifter.

No, the first stage is not recoverable.
The first stage is powered by five RE-M3 Mainsail engines, and includes all eight side-mounted fuel tanks and the bottom central fuel tank. The second stage is just a single tank and Mainsail. Together, they can hurl about 50t into orbit. Except for the space planes, every piece of hardware that goes to Laythe will start out mounted to the top of one of these ascent stages.

And there are many more pieces of hardware required to make the trip. The main strategy will be to send a crapload of unmanned stuff (rovers, habitats, and utility vehicles) to Laythe during the first launch window (~184d in) and then follow up with a fleet of passenger ships, based on the station above, during the second launch window (~1yr, 225d in). But, since KSP has added an element of realism in that unmanned craft need communications to be remote controlled, a network of relay satellites is also needed. All of this also needs efficient propulsion for the long leg of the trip.

More to come...

Sunday, July 23, 2017

Link Update (Again) and Bonus Link Trig!

Once again, all my documentation permalinks got broken when Google Drive stopped supporting static URL hosting. But, I've transferred everything over to AWS now and gone through updating links accordingly on all the static project pages and a few select posts, especially this one. Hopefully these permalinks last a bit longer! Here's the full directory: https://scolton-www.s3.amazonaws.com/list.html. I may transfer more stuff over to there as I go, including maybe using it for hosting new static project pages. Still learning my way around AWS.

Speaking of links, here's an odd bit of trigonometry to solve last post's linkage mystery:

For Twitch X, I mentioned that rather than solving the trig for the geometry of the linkage that connects the two sets of diagonal wheels together (the sin/cos link, as I called it), I came up with a weird exponential parametric equation for the two angles:
x = [sin(θ1)]^K = 1 - [cos(θ2)]^K
The value x ranges from 0 to 1 as θ1 and θ2 both sweep from 0º to 90º, albeit on different trajectories. It makes an excellent feedback variable for the controller, since it can be derived from a simple weighted average of the two linkage angle sensors (after trig and exponent). And conveniently, x = 0.5 is where the wheel sets are perpendicular, for omni mode. For the link lengths used on Twitch X (L1 = 1.00in, L3 = 7.50in), I experimentally derived K = 1.23456789...no joke. But I wasn't ever convinced this was an exact solution, and as it turns out it isn't.

A few pages of trig later, this is the actual parametric solution:
L3*[cos(θ2) + sin(θ1) - 1] = L1*sin(θ1 + θ2)
This one's a lot less convenient from a control standpoint: since θ1 and θ2 are on both sides of the equation it's not obvious what to do with the wheels based on measurements of the linkage angles, at least not without further math. But this is the geometrically accurate solution.

What's amazing is how close the other parametric equation is. As it turns out, the max error is just over 1º and the value K = 1.23456789 is actually a pretty good one in terms of the average error over the full range from 0 to 90º:


None of this matters as far as Twitch X control software is concerned - the exponential approximation with θ1 and θ2 separated is still far better for the application. But solving the mystery of the sin/cos link was really interesting.