14Flying: four motors and a lot of math the robot does for you
A quadrotor cannot stay up for a moment without a controller correcting it hundreds of times a second. Fly a palm-sized drone, watch what its four motors are doing, and then take one of them away.
This assumes: Legs and balance: why walking is hard. About 9 minutes of reading.
Balance a broom upright on the palm of your hand. It can be done, but not by holding your hand still: the moment the broom starts to lean, your hand darts under it, and it never stops darting. The broom is always just starting to fall, and always being caught.
The robot in the box below is a broom that is never allowed to fall: the Crazyflie 2, a real drone the size of your palm and the weight of five sheets of paper. The dog in the last module fell only when you shoved it; a real Crazyflie whose controller stopped would be on the floor within a second. The box cannot switch its controller off, but it can show you the controller at work, in four numbers, and then take one of its motors away.
Four fans on a cross
A quadrotor is a flying robot with four propellers on fixed arms, one at each corner of a cross, steered by nothing but how hard each propeller spins. No wings, no tail, no rudder.
A propeller is a fan. Spin it and it throws air downward, and the air pushes back up on it. That push is the propeller's thrust, the force it gives by throwing air one way and being pushed the other, and it grows as the propeller spins faster.
The four thrusts added together are the drone's lift. All four propellers point straight up out of the top of the body, so the lift points wherever the top of the body points: straight up while the drone is level, off to one side the moment it leans.
Hovering
To sit still in the air, the lift has to be exactly the drone's weight, and the four thrusts have to be equal, so that no corner is lifted more than another. That is a hover: holding still in the air, the lift matching the weight exactly and shared evenly. On this drone that is every motor at about 44% of what it can give, and everything else the drone does is a small difference between motors on top of that shared 44%.
Leaning to move
A quadrotor cannot push sideways; its only push is the lift. To go forward it leans. Give the two rear motors a little more than the two front ones and the back is lifted more than the front, so the nose dips, the lift points a little forward as well as up, and the forward part gets the drone moving. A tilted lift has less of itself pointing up, so all four motors give slightly more to hold the height. Lean back to slow down; lean to one side to go sideways.
Once up to speed, the lean is only needed to fight the air, because a moving body keeps its speed until something slows it; this drone flies so slowly that the air barely pushes back, so in this simulation it levels out at speed and coasts.
Turning without a rudder
Spin a propeller one way and it pushes back on the motor the other way: hold a power drill, pull the trigger, and it tries to turn against the bit, harder the harder it works. So every propeller turns the drone's body against its own spin, and if all four spun the same way the drone would whirl like a top. Instead the front-left and rear-right spin one way, the other two the other way, and while all four run alike the pushes cancel.
Give one diagonal pair a little more than the other and they no longer cancel, and the body begins to turn, the opposite way to the spin of the pair given more. The lift does not change, and the drone stays level, because a diagonal has one motor at the front and one at the back, one left and one right.
Height, then, is all four motors together. Leaning is a difference between the front pair and the rear pair, or between the left and the right. Turning is a difference between the two diagonal pairs. Four motors, four jobs.
A difference starts a turn; it does not hold one
Each of those differences is a twist on the body: a push that turns it instead of moving it along. A twist does not set an angle. It sets the body turning, and the body keeps turning after the twist has gone, like a spun coin, until another twist stops it. A straight push is the same: it keeps adding to the speed for as long as it pushes.
The rover's wheels grip the floor, which stops it the instant the wheel difference stops; the drone hangs in air that stops nothing. So to turn, the controller gives one diagonal a little more to start the turn, runs all four alike while the body coasts round, and gives the other diagonal a little more to stop it. A lean is the same: the rear pair to start the nose dipping, the front pair to stop it. Every move in the box is a pair of opposite differences with the body coasting between.
Why it cannot be left alone
Here is the broom. Suppose the drone is hovering level and something twists it half a degree. Its lift now points half a degree sideways, so it starts to slide that way, faster and faster, and nothing pulls it back level: it has no legs on a floor. Worse, the twist that tipped it set it turning, and nothing stops that either. Half a degree becomes five, five becomes fifty, and as the lift swings away from upright, less of it holds the weight up. Within a second the drone is on its side and falling.
So its controller does what your hand does under the broom, only faster. A chip at the center of the board holds a tiny weight on springs that gravity pulls toward the ground, so it can tell which way down is, and a part that feels how fast it is being turned. In this simulation those readings are exact, and the height and speed are handed to it too.
The controller reads all this five hundred times a second and does three sums. The first looks at the height: too low, more lift from all four. The second turns the gap between the speed you asked for and the speed it has into a lean it wants, capped so it can never tip itself over. The third turns the gap between the lean it wants and the lean it has into a twist, and the turn you asked for into another, measured against how fast it feels itself turning; it eases each twist off as the body comes round, because a twist held until the body got there would carry it straight through. Then one last sum shares it out by the four-jobs rule: a quarter of the lift to each motor, each twist added to one pair and taken from the other. Four numbers out, five hundred times a second.
In this simulation the motors are perfect and the air is still, so nothing ever tips the hovering drone and the four numbers sit at one value, the same to a tenth of a percent for as long as you watch; a real one's never sit still. You see the controller at work when you ask for a move: a dash forward begins as a difference between the front and rear pairs of about one percent, and a stop as the same difference the other way. That is what a good controller looks like: almost nothing. The readout keeps the most uneven sample from the last half second, so a difference can be seen at all.
Flying it
The box shows the drone on the floor, and the view follows it. It takes off by itself: half a second of nothing, the four bars at 0.0%, then all four rise together, a two-second climb to half a meter, and it hovers, the bars at about 44%, all four alike. Under the box is the stick from the rover and the dog: drag the knob, or click it once and hold the arrow keys, up and down to fly forward and back, left and right to turn on the spot. A full push asks for 60 centimeters a second, a full turn for 90 degrees a second; let go and it holds its spot. A sentence beside the stick says what it is doing. One button, Cut a motor, takes the front-left motor away for the rest of the flight, and the controller is not told. An orange line marks its path. Reset puts it back on the floor to take off again, and Slow runs everything at a quarter speed.
Under the stick, four bars read what each motor is giving as a share of its most, laid out nose-up; the body line reads the body's height and lean, and the ground line its speed and turn rate.
This is easier on a larger screen, but it works here too.
What you saw
The cut was the four-jobs rule with one number taken away: three numbers for four jobs, and one job has to go. The controller was not told, and its third sum, which levels leans nobody asked for too, did the rest. With the front-left corner dropping, the front pair was weaker than the rear, so it took thrust from the rear pair; the left pair was weaker than the right, so it took thrust from the right pair. The rear right is in both, and was cut twice over, while the other two were pushed up to make up the lift. So the drone was left on the front right and the rear left, which spin the same way, and it spun up like a top.
It also leaned. Picture a square plate held up at two opposite corners: it can rock about the line through the other two corners, and nothing else. So the lean the cut had started, the dead front-left corner dropping, is a turn about the hinge through the two live corners: the one lean they cannot touch. With nothing to stop it, that tilt grew to about 45 degrees. Leaning that far and whirling, the lift swept round like a lighthouse beam, and only the part still pointing up was holding the weight, which was not enough. Half a second after the cut it was on the floor, still leaning.
Even a controller that knew would have had to give up the turn. Of three motors, two spin one way and one the other, and the odd one sits opposite the dead motor, so any thrust it gives lifts its own corner with nothing across from it to balance. To stay level it must give nothing, and then the other two turn the body. Level, or not turning: with three motors you choose one.
The drone's motors are told five hundred times a second by a controller that reads where the body is and works out what it should be doing; your stick was only ever a request to it. That loop, noticing the gap between where a robot is and where it should be and closing it, has a whole part of this course to itself later on, and a quadrotor is the robot that cannot fly for a second without it.
Watch
The astounding athletic power of quadcopters | Raffaello D'Andrea — TED (7:28 of it, starting at 0:22)
- Why this video
- Real quadrotors on a stage, flown by the researcher who builds them, doing the three things the words claim. He says in his first minute that a quadrotor is mechanically simple but inherently unstable and cannot fly without automatic feedback control. Then one balances a pole on its top and you can see it making fine adjustments to keep the pole up, the broom caught over and over. Then he says out loud why four propellers is the minimum, four things to control and four motors to do it with, and flies a quadrotor with two propellers missing: it stays up only by giving up the turn and spinning like a top the whole time, which is what the exhibit's cut motor starts and cannot finish.
- What to watch for
- At 1:02, "they are inherently unstable and they need some form of automatic feedback control in order to be able to fly". At 3:13 a quadrotor balancing a pole, and the small, constant adjustments it makes; he nudges the pole and it recovers. At 6:23 why you need at least four fixed motor-propeller pairs: four things to control, roll, pitch, yaw and acceleration. At 7:00 a quadrotor with only two working propellers, flying while it spins; at 7:19 the cost, "we relinquish control of yaw".
Words introduced
- quadrotor
- A flying robot with four propellers on fixed arms, one at each corner of a cross, steered by nothing but how hard each propeller spins.
- thrust
- The push a propeller gives by throwing air one way and being pushed the other. Spin it faster and the thrust grows.
- lift
- The four thrusts of a quadrotor added together. They all point the same way, straight up out of the top of the body, so the lift points wherever the body's top does.
- hover
- Holding still in the air, with the lift exactly matching the weight and shared so that no corner is lifted more than another.
- twist
- A push that turns a body instead of moving it along. A twist does not set an angle; it sets the body turning, and the body keeps turning after the twist has gone until another twist stops it.
Where next
Suggested next: 15. Knowing where your own joints are: encoders
