Disqualified for Winning. They Said No Public School Robot Could Do That.Chapter 12

The Professor Won't Touch the Keyboard

Room 211 of Engineering Hall held forty desks, a chalkboard from 1962, and one professor sitting very straight with both hands trapped under her thighs.

"I'm sitting on them," Ines Calderón said, when she saw me staring. "It's a precaution. In my first year as a teaching assistant, I reached over a student's shoulder and fixed a sign error in his code, and he never learned what the sign error was. Twenty years later I still remember his face."

It was Day 12. Patel had visited the shop that morning for the first scheduled inspection, photographed our half-built chassis, and written *Nothing to report.* I had been so relieved I'd offered him a granola bar. He'd taken it.

Now there were four of us in room 211: me, Priya, Dex, and Tomi, who had been warned he could attend as long as he didn't film. He held his phone against his chest like a hamster.

"These are public office hours," Calderón said. "Anyone may ask a question. I will answer it. I may ask questions back. I will not touch your work. If I seem unhelpful, remember that's by design, mine and the university's." She glanced at the door. "I'll also tell you, because I think you'd rather hear it from me, that a gentleman on the advisory board of this department phoned me Monday morning to ask whether I planned to 'mentor' you."

"Who?" said Dex.

"A gentleman whose company funds roughly forty percent of my laboratory." She smiled thinly. "I said I was teaching a class. He found that unsatisfying. So: bring me your question. And make it good, because I don't have many to spend."

I stood. I'd rehearsed it in the van. "Professor Calderón, why do you tune a controller, and why does it stop being tuned?"

She looked at me for a long moment.

"That is two questions," she said. "And neither is the question you care about. But I'll take it." She turned to the chalkboard. "Do you know what the word *error* means in control?"

"The difference between where you want to be and where you are."

"Good. Write it."

I wrote *e = r − y.*

"Now. You're driving a robot toward ninety degrees. The error is ninety. What should the motor do?"

"Turn, hard."

"How hard?"

"As hard as it can?"

"And when the error is five degrees?"

"Less hard."

"So the command should be proportional to the error." She stepped to the board and wrote *u = Kp·e.* "This is the proportional term, P. A spring. The farther you are from the target, the harder it pulls. A spring pulls the robot to the target and then, because the robot has momentum, goes past it. Then it pulls back. Spring plus mass."

"Oscillation."

"Unless the system has damping." She drew a tiny shock absorber beside the spring. "In control, damping comes from the derivative term, D. It looks at how fast the error is *changing* and pushes back against it. A spring says 'go there.' A damper says 'but not so fast.'" She wrote *u = Kp·e + Kd·de/dt.* "Together, they let you arrive."

"That's what we do," Priya said. "We use a PD controller on heading."

"I'm sure you do. Why?"

"Because it works."

"That is not a reason." Calderón's voice was not unkind. It was a tuning fork striking something hollow. "I am going to ask you to *predict.* Mr. Havel, you have a turn that overshoots by fourteen degrees. What would you do to the gains?"

"Reduce Kp or increase Kd."

"Which?"

I hesitated. "Both?"

"Priya?"

"Increase Kd first. Reducing Kp makes it slower."

"Why?"

"Because the spring is the speed. Damping slows the *overshoot* but not the approach." Priya blinked. "Oh. That's why Niko always tunes D first when it overshoots."

"Does he?"

"Always." Priya looked at me. "I never asked why."

"That's all right," said Calderón. "Most people tune by feel and call it intuition. Intuition is just a controller you haven't written down."

She wrote on the board for twenty minutes. It was not a lecture. It was a conversation conducted entirely in questions, with her hands under her legs. She asked what they wanted the controller to do, and made us put numbers to it. *Ninety degrees in 0.6 seconds. Overshoot under five percent. Settled within half a degree by 0.9 seconds.* I wrote them down. They were the first specifications I'd ever written for a controller, and I realized with a small cold drop that I had never had a *target* before. I'd had a feeling.

"Now," she said. "Derivative of a noisy signal."

"It amplifies the noise," I said.

"Say more."

"A derivative is the slope. If the gyro reading jitters a tiny bit sample to sample, the slope of that jitter is huge. At two hundred samples a second, a jitter of 0.05 degrees becomes ten degrees a second of apparent speed. The motor twitches."

"So what do you do about it?"

"Filter the derivative. Low-pass it. Average over a few samples."

"At what cost?"

"Lag. A filtered derivative is late." My mouth was dry. "It's a trade. More filtering, less noise, less damping at the moment you need it."

Calderón lifted one eyebrow by about a millimeter. It was the closest thing to a compliment I'd seen from her. "Congratulations," she said. "You've discovered that every control design is a negotiation between wanting to know and being able to know."

"And the I term?" said Dex, who had been quiet.

"The integral." Calderón's eyes found me. "I'll say one thing about integrals and then stop. An integral term accumulates error over time. It's the controller's memory. If the robot is a millimeter short for a full second, the integral says, 'I've been short for a long time. Push harder.' That's useful. It fixes the steady error caused by friction, a tiny bit that proportional alone can't close."

"We don't use I on heading," I said.

"Do you plan to?"

"On the ramp. Speed control. Probably."

"Then ask this before you write a line." She turned to the board and drew a box with an arrow, and on the arrow a small flat line, a ceiling. "What does the integral term do when the motor is already at full power and the error is still there?"

I looked at the ceiling.

"It keeps accumulating," I said. "But the motor can't do any more."

"And then?"

"And then..." I stopped. A thought was hovering, one I'd never had to finish. I felt it recede.

"Hold that question," said Calderón. "You'll meet it."

It was, I later understood, the most direct warning she was allowed to give. She'd given me the question. I hadn't picked it up.

"But you started by asking why a tuned loop stops being tuned," she went on, drawing a new diagram. "Take your robot. You command *seventy percent duty cycle.* On Tuesday, with a fresh battery at 12.8 volts, seventy percent means 8.96 volts at the motor. On Friday, after four runs, the battery's at 11.6 volts. Seventy percent is now 8.12. Ten percent less voltage. What happens to your controller?"

"The motor has ten percent less torque for the same command," Priya said. "So the loop gain dropped ten percent. We tuned for 12.8. The robot is now sloppier. It might even..."

"It might oscillate less. Or respond more slowly. Or fail to reach the target within your 0.9 seconds." Calderón nodded. "Your tuned system had a hidden input you weren't tracking. The battery."

"We can measure the battery voltage," I said. "Every loop."

"Then what could you do?"

I said it slowly, the way you set down a plate you aren't sure is clean. "Command *volts,* not percent. Divide by the measured battery voltage to get the duty cycle. That way the motor sees the same voltage no matter what the battery is doing."

Priya's pen stopped. "Voltage compensation."

"I can't comment on your design," Calderón said, with perfect gravity. "I can say that in the literature, it's a common technique."

I was so grateful, I could have hugged her. Instead, I wrote it down.

We were in the room for an hour and forty minutes. She asked questions. We answered. She asked us to predict what a step response would look like when Kd was doubled, then drew it, then asked us to explain the shape. At 5:40 she stood, finally, and retrieved her hands, flexing them like someone who'd been holding an enormous bird.

"I'm done," she said. "I have a faculty meeting at six where a vice president will ask me, politely, about my teaching load."

"Professor," I said. "Thank you."

"For what? I taught a class." Her voice softened an inch. "Mr. Havel, you cited my lecture. In a file. You didn't have to. You could have said you invented it. Most people would have, if they were seventeen and desperate." She slung her canvas bag over her shoulder. "I've decided that matters."

She left. The door swung slowly closed on its pneumatic closer, and Dex let out a long breath.

"She's terrifying," he said.

"She's *calibrated,*" Priya said, with reverence.

By Friday night, Day 14, Dex had finished the prototype drivetrain: a plywood chassis, two new SA-12 motors with the ten-to-one gearbox, four wheels, a controller. No intake. No ramp mechanism. A rolling table with brains. We set it on the shop floor on a strip of blue tape.

I'd written the controller that afternoon from scratch: PD on heading, with a filtered derivative, voltage-compensated output. I had written down the specifications on the whiteboard first.

*90° in 0.6 s. Overshoot < 5%. Settle ±0.5° by 0.9 s.*

"Ready," I said.

Priya started the log. Dex stood back. Tomi had been given special permission, by me, to film. I typed the command.

The prototype spun. A blur of plywood and a quick, clean whirr, and it stopped.

Priya read the plot. "Reached 90 degrees in 0.58 seconds. Overshoot 3.7 degrees. That's 4.1 percent. Settled at 0.84 seconds."

All three specs.

I stood in the shop room feeling something I hadn't felt in two weeks. It wasn't triumph. It was the rarer thing: the pleasure of a prediction that came true.

Then Priya's face changed.

"Niko," she said. "The gyro says 90.0 degrees."

"Right. That's the target."

"The *robot*..." She turned to the tape. A faint line on the floor where Dex had drawn the reference. The robot sat at an angle next to it, visibly short. "Look at the line. The robot isn't at ninety."

Dex got a protractor from the toolbox. He laid it on the plywood. He read it, and read it again.

"Eighty-seven point six," he said.

Everyone stared at the floor.

The controller had done exactly what we'd told it. The gyro had reported ninety. The robot had turned eighty-seven point six.

The sensor was lying, quietly and consistently, by a little over two and a half percent.