How do Falcon-9's cold gas thruster maneuvers account for the center of mass changes due to “floating fuel shifts”?

The Art of Engineering video How SpaceX Lands Rockets with Astonishing Accuracy after 07:19 explains:

1. Cold Gas Thrusters

The falcon 9 is equipped with a total of 8 nitrogen cold gas thrusters that are mounted towards the top of the first stage. There is one pod on each side of the rocket, each containing 4 thrusters. Like the gimbaled main engines, the cold gas thrusters are used to control the orientation of the rocket. They are particularly useful for the flip maneuver after stage separation because of the large lever arm between the thrusters and the rocket’s center of mass.

They are also used to control the rocket at times during the flight when the gimbaled main engines are shut off.

While the diagram shown in the video shows the center of mass at approximately the center of the rocket, what's really happening is a little more complicated. The two liquid propellants in their tanks are in a microgravity environment and their positions are determined by their history, small accelerations and viscous and damping forces, so the effect of a given impulse by the cold gas thruster has a variable effect even if the masses of the remaining propellants are known, and is not even predictable without knowledge of their distribution along the length of the rocket.

Question: How is this problem managed? Is there an ullage-like impulse to put the propellants in a desired location, or does a computer use inertial measurements following each thruster impulse to model the instantaneous mass distribution and calculate the subsequent impulses accordingly, or is this done in more of a bang bang servo-like way without explicit consideration of the mass distribution of the liquids during the freefall segments of flight?

The new SpaceX video SAOCOM 1B | Launch and Landing (found in Till what altitude above earth sounds can be heard?) demonstrating that the cold gas thrusters are used in several different parts of the return, not just the initial rotation.

• Since the flip happens directly after stage sep (for the Falcon Heavy side boosters, you can even think of at as just the continuation of the separation), I would assume that most of the fuel will still be sitting near the back, since it only had seconds to slosh around. Also, come to think of it: would it even matter? The tank is just going to "rotate around" the fluid ball in the middle, is it not? – Jörg W Mittag Sep 3 '20 at 11:23
• @JörgWMittag Aren't the thrusters used on and off throughout the descent to maintain attitude, at least until there is enough atmosphere for the grid fins to take over. – uhoh Sep 3 '20 at 11:44
• @JörgWMittag of course as soon as the rocket encounters any drag whatsoever and begins to even slightly decelerate, the liquid may all move up to the top. While it's the "wrong end" when applying torque from the top based on moment arguments, at least it would settle down (up) to a definite location. – uhoh Sep 3 '20 at 15:40
• Yeah, that APU system is the only place I ever heard it used. Didn't want to muddy the waters by bringing it up. I have not heard it applied to flight control systems. Sounds OK though. Doubt it's confirmable what SpaceX actually uses though. – Organic Marble Sep 10 '20 at 18:23
• The APU controller operated like "if the speed is below this number, open the valve until the speed is above this number". I guess that's kind of the same thing. – Organic Marble Sep 10 '20 at 18:27