10 ms·
How SpaceX lands Starship (sort of)
- geocrasher 5y agoThis is very interesting and I appreciate the author's take on his own work: That it's not, by a long shot, the whole solution. It's great that he modeled the physics and all, and he acknowledges that the amount of work to turn that simulation into a landed rocket is just staggering. The scale of the complexity comes seems analogous to the complexity of starting with nothing- no raw materials- and building something complex like an internal combustion engine. Step 1: Find iron ore. Wait, what? Step .5 answer "What is iron?" Step .4 "What is ore?". Step .3 "shoveling is hard." Step .2 Banging rocks together.
- BurningFrog 5y ago“If you wish to make an apple pie from scratch, you must first invent the universe.” ― Carl Sagan
- cle 5y agoThe author says exactly that at the end of the article: Its tempting to go “woah I just figured out how SpaceX lands their rockets!!”, but sadly, that’s not really true. Once you have generated a physically possible trajectory that gets you where you want to go, there’s a whole host of things that you need to do to actually go follow that trajectory: state estimation, closed loop feedback control, dynamically updating that trajectory based on real time conditions… and many more that someone who is an actual aerospace engineer (which I am not) would know. Beyond that, these solvers take a long time to run, and online (real time) optimization is incredibly hard to pull off correctly and safely: one wrong input and your solver could just spit back “fail”, causing the thing to fall out of the sky.
- geocrasher 5y agoIndeed I was trying to allude to his own take on it, that it's just a fraction of what's needed. I reworded it clearer. :)
- gnzoidberg 5y agoyeah, just not in the title. He's in fact way off.
- jacquesm 5y agoThis sort of thing always runs into 'need the tool to make the tool' loops, where you end up substituting an inferior version long enough to get you to the next level. Bootstrapping a working metal workshop from first principles would require you to re-run a substantial part of history including the re-invention of lost processes. You'll also likely get killed because quite a few of those processes are anything but safe. Our modern days materials science is very hard-won knowledge, and there aren't a whole lot of shortcuts on that route even if you have the knowledge itself.
- geocrasher 5y agoIndeed! After I posted I remembered the book "How to Invent Everything" which takes the case of a time traveler stuck in the past with a guide to invent civilization from scratch. It's a cool read: https://www.howtoinventeverything.com/ https://www.howtoinventeverything.com/
- f00zz 5y agoLooks interesting, thanks for the recommendation. Another one is "The Toaster Project", about how a guy made (well, sort of) a toaster from scratch: http://www.thomasthwaites.com/the-toaster-project/ http://www.thomasthwaites.com/the-toaster-project/
- SECProto 5y agoBootstrapping civilization is a bit of a sub-thread in the three Zones Of Thought books by Vernor Vinge. Definitely my favourite SciFi books
- generalizations 5y agoI got bored in the second one when I realized there wasn't going to be any space travel, but otherwise I agree.
- SECProto 5y agoAssuming you mean Children Of The Sky (second as in sequel to the first one published), that one actually deals with this topic (bootstrapping technological advancement) maybe more than the other two. I assume you didn't mean A Deepness In The Sky (second published, but almost stand-alone, super interesting dealing with practicalities of interstellar civilization in a universe with real speed limits) or A Fire Upon The Deep (second in-universe timeline)
- walrus01 5y ago> Step .2 Banging rocks together. a cpu is just a rock that we tricked into thinking. but not to make it seem overly simplified, first you have to flatten the rock and put lightning inside it.
- benjaminl 5y agoThe YouTube show How to Make Everything. Did this. They started the tech tree from the very beginning by making simple hand stone tools and then building up tool by tool to more sophisticated technologies. If all you have is a hand. Even getting the wood to make a handle for your axe is hard. https://youtube.com/playlist?list=PLLXfVEsLI-qRC_MAQZcVxpjtF7I1-H6Gw https://youtube.com/playlist?list=PLLXfVEsLI-qRC_MAQZcVxpjtF...
- perl4ever 5y agoSeems to me like a lot of the difficulty would be that the natural resources you need, in the absence of civilization, are scattered all over the planet, let alone deep underground. I vaguely remember reading something about how even in the earliest days of making flint arrowheads, there were massive centralized mines that archaeologists have found. It wasn't like just because you were in the stone age chipping rocks, every location was equally accessible to the resources you needed. Similar to now, where you need a particular type of sand for concrete, or for fracking, or...
- monocasa 5y agoInterestingly there's technologies we might not be able to replicate if needed, as we've mined out the purest resources that we know of. Particularly nuclear technology, since so much early experimentation was dependent on ores like from the Shinkolobwe mine in Congo with 65% uranium. These days finding ore with 1% uranium is considered a good find. https://en.wikipedia.org/wiki/Shinkolobwe https://en.wikipedia.org/wiki/Shinkolobwe Maybe our nuclear waste will fill the same niche in a post apocalyptic reconstruction of society?
- spfzero 5y agoFor one thing, it seems like the change in fuel mass, and its centroid relative to the body center of pressure, would be kind of important. But this was super- interesting as is. I’m glad it was posted here.
- fallingfrog 5y agoGreat project, makes a complex topic easy to follow
- Animats 5y agoRocket science is easy when you have a very powerful general optimization package available. Classic rocket science is trying to find closed-form minimum-fuel solutions for those problems. See "Hohmann orbit" and related topics. That's hard. Legged running for robots is a very similar problem. It's under-actuated (more degrees of freedom than actuators) and constraint-limited. I worked out some closed-form solutions for legged running with anti-slip control back in the 1990s, which were later used in robotics work at McGill. Now you can probably just crunch a solution out of an optimizer. (I used to make the comment about that, "It's rocket science. Which is good, because rocket science is a solved problem.")
- bpodgursky 5y agoI get where you are coming from, but if it was truly "easy", there would be a lot more self-landing rockets. It makes one almost-impossible thing... possible. Not "easy".
- FriedrichN 5y agoIt makes me think of the Laputans in Gulliver's Travels, the race of scientists that are so caught up in their theories they can't do anything practical.
- knuthsat 5y agoI mean, if you have perfect measurements of the state of the rocket and a complete model of it then it's just physics. Problem is that measurements are random variables and your model of the rocket is probably not perfect and now somehow you need to make it work.
- colordrops 5y agoEverything is "just physics"
- knuthsat 5y agoThat's true, I guess I was imagining more of a Newtonian approach, modern physics has everything.
- 2bitencryption 5y agofrom this article, it seems like the thrusters must be doing lots of little micro-adjustments, similar to balancing a pencil upright on your hand, or riding on a Segway, correct? I'm super interested in understanding what the actual mechanism is like for "aiming" the thrusters in different directions. I imagine they must need freedom of movement in a full 360-degree circle to adjust in all possible directions. How the hell is that achieved??
- pmcjones 5y agoGimbals -- https://en.wikipedia.org/wiki/Gimbal#Rocket_engines https://en.wikipedia.org/wiki/Gimbal#Rocket_engines
- sephamorr 5y agoWhat you're looking for is Trust Vector Control(ler). Most modern rocket engines physically gimbal the engine around with ~two linear actuators around a fixed point at the top of the engine. All of the plumbing and connections to the rest of the rocket must then be flexible. https://en.wikipedia.org/wiki/Thrust_vectoring#Gimbaled_thrust https://en.wikipedia.org/wiki/Thrust_vectoring#Gimbaled_thru...
- walleeee 5y agoIf you watch a video of a booster or starship coming down you can see the engines twitching around, pretty cool
- zlsa 5y agoThe thrust vector control method in this case is gimbaling, and it basically means using linear actuators (I think these are commonly hydraulic, and Falcon 9's Merlin engines actually use the kerosene fuel in the TVC hydraulic system) to point the engine in a different direction: Raptor TVC test: https://www.youtube.com/watch?v=3pD5CZZfnYk https://www.youtube.com/watch?v=3pD5CZZfnYk Merlin TVC test: https://www.youtube.com/watch?v=Pigsq5rt-mY https://www.youtube.com/watch?v=Pigsq5rt-mY
- 5y ago
- rsj_hn 5y agoFYI, the ESA (European Space Agency) has a python package, pykep, that implements these types of algorithms for you: https://esa.github.io/pykep/index.html https://esa.github.io/pykep/index.html Check out the pontryagin optimization module, which uses the maximum principle: https://esa.github.io/pykep/documentation/pontryagin.html https://esa.github.io/pykep/documentation/pontryagin.html
- skykooler 5y ago"Minimize thrust output" is not a great constraint - the most efficient landing would run at 100% thrust to minimize the time spent thrusting against gravity. Another thing to take into account, which is that rocket engines have a minimum throttle setting, which for the Raptor is 40%.
- tonyarkles 5y ago“Minimize the integral of thrust probably would do ok as a proxy for “minimize the amount of fuel required”
- lamontcg 5y agoUsually it is "minimize the integral of the thrust acceleration" (T/m). Other metrics are to maximize the final mass, or to minimize the final time.
- mr_toad 5y agoYes but if the 100% thrust exceeds the mass of the rocket you need to exactly offset your momentum so that you reach zero velocity exactly as you touch down, which requires very precise timing and doesn’t leave much margin for error. Time it too late and you RUD. Too early and you stop short, run out of fuel, and then also RUD.
- ludocode 5y agoAt least for Falcon 9, this is true even at minimum thrust. They don't have the ability to hover at all. The rocket is so light when empty that the thrust of a single engine at minimum throttle during landing is enough to make it take off again. That's why they do a "hoverslam" or "suicide burn" as you described. I assume they still throttle down as much as they can in the last few moments to minimize the impact of imperfections in the landing.
- sgtnoodle 5y agoThey likely just target a trajectory that falls at the center of their throttling capability. The controller can then handle a limited amount of trajectory error by throttling up or down. I.e. if they can throttle down to 70%, then they would compute a trajectory that would nominally require 85% thrust.
- sobellian 5y agoOne of my hobby projects is a real-time optimal flight controller for Kerbal Space Program rockets, and it also uses CasADi! It's an absolutely fantastic software package that makes it dead simple for anyone to set up and solve NLP (nonlinear programming) problems. Indeed, a lot of hard work goes into making an online solver that can run in a reasonable time. I already have launch working quite well, but precision landing has proven more difficult. For the initial trajectory, I use collocation (https://en.wikipedia.org/wiki/Collocation_method https://en.wikipedia.org/wiki/Collocation_method) to encode the physics constraints. For updates, I use the previous solution as the initial guess for the updated trajectory. In practice this seems to work quite well, but there are still some issues I need to iron out. Sometimes the trajectories it provides are unstable in the sense that if you slightly overshoot, it will generate a radically different solution. I believe the solution here will be to turn some of the constraints in my solver into soft goals instead. It's difficult for me to say whether this is evidence that SpaceX definitely uses optimal control for their flight control, since we would naturally expect any reasonably efficient control algorithm to produce a similar trajectory. After all, if you have a solution that's 99% efficient, how much slack is there in a trajectory using only ~1% more time than the optimum? However, I would not be surprised if they do that - I'm just wondering how they test it, since my setup seems so finicky!
- prox 5y agoI’ve been using program blocks in Space Engineers to play with some parameters as well. I still need to install the orbital mechanics mod though. The math is incredibly hard (if you have basic training) , even if you have a simple model, but it’s fun to figure out. Hats off for your project and what you’re trying to do!
- bodhiandphysics 5y agoThere’s one really important aspect of starship control that this article mentions... starship control is stochastic. Spacex needs to minimize the area of an ellipse that represents the likely touchdown area of the craft. To do this they use another trick... they continuously recompute the optimal trajectory, in real time. Lars Blackmore has a paper on the process!
- gnzoidberg 5y agoYep, Lars learned GFOLD at JPL and took it to Spacex. GFOLD was invented by Behçet Açikmeşe https://www.aa.washington.edu/facultyfinder/behcet-acikmese https://www.aa.washington.edu/facultyfinder/behcet-acikmese
- bodhiandphysics 5y agoThough as I understand, spacex doesn’t actually use GFOLD, but a related (and secret!) development
- ClumsyPilot 5y agoNot to accuse spaceX of anything, but I've witnessed companies sell 'hyper-localised weather" where they take public weather information and average the nearest two datapoints to you. So I always take 'secret' 'proprietary' data and algorythms with a bit of salt, as almost every time I dug into them, it was all spin on previous public stuff.
- loudmax 5y agoIn this case, SpaceX is actually landing those Falcon boosters pretty reliably now. So maybe their secret proprietary stuff isn't as advanced as they make it out to be, but whatever they're doing it does seem effective.
- jhgb 5y agoThe two have apparently co-authored the relevant papers. So perhaps both of them "learned GFOLD at JPL" in the same sense.
- grouphugs 5y agothose aren't star ships
- forrestthewoods 5y agoAwww I’m disappointed his solver started in a bellyflop position. Would be interesting to see if a vertical position at higher altitude and higher velocity could discover the bellyflop maneuver. That would also require a variable initial fuel. Which is itself dependent on takeoff. Ok so now solve the full loop from launch, peak altitude/position, and return. :)
- ludocode 5y agoThis would require adding the force of drag to the dynamics timestep, since the purpose of the belly-flop (after re-entry) is to minimize terminal velocity by maximizing drag. Currently his solver assumes no drag. Calculating the drag on an ideal cylinder is non-trivial to begin with. It gets vastly more complicated once you start adding the flaps, which are what Starship uses to get itself into the belly-flop position in the first place. Simulating the whole belly-flop maneuver isn't going to be feasible on the scale of a blog post.
- homero 5y agoI'd love to see this algorithm play Flappy Bird, seems like a similar challenge
- lpmitchell 5y agoThis is awesome! I'm working on a similar hobby project (an avionics software programming/simulation game) and have written some basic avionics software to fly/land Starship [1]. It's really satisfying when simple simulations give results that are close to reality. The StackOverflow blog posts and this blog have been very well timed for me - I have a good list of things to learn more about now. In the initial avionics software that I've written I'm using a fairly simple approach involving a lot of PIDs to keep the ship on a predefined track. So getting some more dynamic trajectory plans in there will be a fun thing to explore! [1] https://www.youtube.com/watch?v=TdLv62ZVl6I https://www.youtube.com/watch?v=TdLv62ZVl6I
- t0mas88 5y agoCool! I've been playing around a bit with X Plane and the library NASA open sourced for getting simulator data to see whether I could get autopilot software to fly upset recovery maneuvers better than pilots. What are you using?
- lpmitchell 5y agoIt's a really interesting and fun area of programming to explore, did you have any success? I think I saw that the XPlane developers released a Starship model for their simulator too, which could be fun to play with. I'm using Unity for the front-end visualisations, then the simulation & avionics are run on a headless server that currently uses Havok (realtime physics engine for games) with some layers to add aerodynamic forces and some tweaks to try to keep things as realistic as possible. More info & code behind the aerodynamics here: https://avionic.dev/blog/simulating-aerodynamics/ https://avionic.dev/blog/simulating-aerodynamics/ This video: https://youtu.be/GSJPm4uG42M https://youtu.be/GSJPm4uG42M is probably more interesting to the HN crowd than the one I shared in my last comment, and gives a little more context as to what's going on behind the scenes than the abstracted UI dashboard.
- t0mas88 5y agoI had some initial succes in having the code do the same steps as UPRT training teaches pilots: 1. Unload the wings (usually push the stick forward) 2. Roll shortest path to level (easy to calculate, but needed a bit of tweaking to make a smooth roll input) 3. Set power according to energy state (slow = set full power, fast = set idle power) 4. Pitch back to level (9 out of 10 times this means pulling out of a dive) Easy to combine 2 and 3 at the same time, more tricky than for humans to get 4 correct because you're often in an overspeed condition where just pulling sharply up will over stress the airframe. But if you take too long you're losing altitude rapidly and may hit the ground. I think the correct software solution would be to always aim for a min(3.8, stall load) G pull (the maximum is 3.8 for a normal aircraft to not break), calculate the expected altitude loss for current speed and if you're going to hit the ground pull as hard as you need to miss the ground by a small margin and hope the aircraft doesn't break apart. I haven't written any code for that last part. And I haven't added rudder input to it other than using the standard function to coordinate rudder with ailerons when rolling level (the sim has this built in). If the airplane gets as far as to enter a spin condition the procedure above will no longer work and you really need rudder. And the power change for a prop driven aircraft or an asymmetric thrust situation in a multi-engine then has to happen at the start, everything idle even at low speed. So here you enter a more complicated area to determine what the state is and adjust the response as opposed to following the standard rules.
- raverbashing 5y agoNo mention of drag apparently. It's a nice write-up but that is an important point that was simplified. Because it helps with deceleration and with rotating the rocket.
- FeepingCreature 5y agoSpaceX definitely use a dynamic solver, if only because they have to correct for wind gusts during landing.
- lpeancovschi 5y agoThere's a nice game that simulates this on iOS. Falcon Lander - SpaceX Edition