Wednesday, April 27, 2016

Rocket thrust and sensor fusion

Inspired by various people, notably Julia Evans and (naturally) Sarah Sharp, I'm going to try writing again. (My previous personal blog had its last post in 2009.)

I've been part of the Portland State Aerospace Society since 1999, which is to say, over half my life—so while I'm not going to introduce it in detail here, you can guess it's important to me. Check out the web site and our pile of GitHub repos. Maybe you'll feel inspired to contribute to open-source rocketry!

I just learned something about rocket motors

Last night at our weekly general meeting, I learned something from Aaron Baker, one of the students in the group:
Rocket motors produce thrust (force) proportional to the amount of mass they're losing.
(NASA has good background on the thrust equation, if you want more details and feel OK about first-year calculus-based physics. They claim their explanation is suitable for middle-school students but I think they may have mis-judged their audience.)

Now, in hindsight, this feels almost obvious: a rocket throws burning bits of fuel out the nozzle in order to move, and if you throw more fuel out you'll move more. But it had never occurred to me that the two were related, before.

OK, that's, uh, fascinating. Honest. Why do I care?

The short answer is: It's useful to have a model of the physics of our rocket's flight that has as few parameters as possible, and this observation leads to a simpler model.

A brief tour of rocket physics

While a rocket is in flight, there are three major things affecting how it moves:
  1. If the rocket motor is burning, then it's making the rocket go faster.
  2. If the rocket is in atmosphere, then pushing against the air slows the rocket down.
  3. Gravity is always pulling on the rocket, and for my current purposes we can pretend like only Earth's gravity matters and it's always slowing the rocket down.
How much effect does gravity have? We can pretend like it only depends on how high above the Earth you are.

How much effect does air resistance have? We can pretend like it only depends on how fast the rocket is going, and how thick the atmosphere is; and for the latter, we can again pretend like it only depends on how high above the Earth you are.

So far we only have two parameters to this model, altitude and speed, and those are both things our sensors can tell us directly.

But the rocket motor adds two more parameters:
  • How hard is the motor pushing on the rocket right now? That changes during the burn, and is part of the design of the motor.
  • And how much does the remaining fuel weigh? As the rocket gets lighter, it becomes easier to move. So pushing the same amount gives you more speed than it did before, like the difference between pushing a bicycle and pushing a car.
And we can't measure either of these parameters while the rocket is in flight! The closest we can get is the ratio of thrust to total vehicle weight, which is acceleration... but the acceleration we measure is the combination of accelerations due to all three of the above forces, and we can't separate out just the part due to the rocket motor.

Here's where Aaron's observation comes in: Thrust is proportional to the change in vehicle weight. So if we can measure our total acceleration, and subtract off what our model says air resistance and gravity should have contributed, and we know what the total vehicle weight was a moment ago, we can compute both the current thrust and the new total vehicle weight. Et voilĂ , two parameters derived from one measurement!

Of course it isn't actually that easy because we can't measure anything precisely enough.

Measurement precision is hard

Among the many challenges in building a rocket that can reach orbit, one is that it's moving faster than a human can react, and so the rocket needs to be able to steer itself. To do that, the rocket needs to know where it should be going, and where it actually is—so that when it isn't where it should be, it can take some action to get going the right direction again.

Figuring out where you are is a tricky problem. You probably use GPS for that. On our rocket we also use GPS, but it isn't good enough by itself for several reasons:
  1. Commercial GPS receivers are not built with the amateur rocketry community in mind. (They're missing out on dozens to hundreds of sales each year!) So they tend to stop reporting positions during the most critical parts of the flight. There are both technical and legal reasons for that, but that's an entirely different discussion.
  2. The best commercial GPS receivers tell you where you are ten or twenty times per second. In one tenth of a second, our rocket may have traveled up to 40 meters (or 120 feet) at 375 meters per second (840 miles per hour). In other words, a lot can happen to a rocket in a tenth of a second!
  3. GPS can tell you your position and your velocity, but not which direction you're pointing (or equivalently, which direction your rocket motor is pointing). For that, your phone probably uses an electronic compass... which you may have noticed is often wrong. Yeah, electronic compasses have their own problems.
For all those reasons, we don't rely purely on GPS. We also use accelerometers, gyroscopes, a pressure altimeter, and the previously mentioned electronic compass (technically called a 3D magnetometer).

This raises a new problem: Now we have a bunch of sensors and they're all wrong! Every sensor measurement has some error—think of stepping on your bathroom scale and how it's obviously never right—and we use sensors that are as cheap as we can get away with, so our measurements are especially bad. Now we need to combine them all to get some idea of what's really going on. When they disagree, we need some way of making our best guess of the truth.

This is the "sensor fusion" problem: how can we get the most truth out of each sensor, fusing all the measurements together into a reasonable guess? I'm not going into how to do sensor fusion today. If you want to do your own research, two standard algorithms you can look up are the Kalman Filter and the Particle Filter. Aaron is taking Prof. McNames' class on sensor fusion and related techniques right now, and Prof. McNames is posting video of his State Space Tracking course lectures as he goes, so you might find that to be a good resource.

Putting it all together

Sensor fusion algorithms do best when you give them an accurate model of the system you're measuring, so for sensor fusion applied to rockets, we'd like to use a physics model that incorporates all the major forces.

But the more parameters the model needs, the worse any sensor fusion algorithm will perform. (Prof. McNames and others refer to this as the "curse of dimensionality".) I think of it this way: If I can explain the measurements I'm seeing two different ways, by changing different parameters, then it's going to be harder to guess which explanation is correct. If instead I can express one of those parameters in terms of another, then that rules out some explanations and makes it easier to find the right answer.

So I'm excited about Aaron's insight because it allows us to use a more accurate physics model without adding too many parameters, which may lead to better results from cheaper sensors!

p.s. Check out this video of our microgravity test of a reaction wheel system for attitude control in the cubesat we're building. Honestly I could just watch this on loop.

1 comment:

  1. Well, we *hope* we know what the vehicle mass is. We make assumptions about fuel flow, which is in turn our change in mass. Just one more dimension of error!

    Additionally, there's the matter of aerodynamic lift. It's less pronounced (but nonzero) with the classic rocket, but more pronounced with boosters (Delta IV Heavy) or lifting surfaces (STS).

    This stuff gets complicated!