Skip to content
Tech Interview Prep

Real Interview Questions for the Robotics Engineer at Tesla

New

Interview Q&A

25 questions · Flow follows Relevance until this set has a learning order.

Q&A-1Tell me about the hardest technical problem you've ever solved and why it was hard.

Reported in ai-interview-guides/guides/tesla.md at main · landedjobs/ai-interview-guides

The 90-second answer

The hardest one was closing a sim-to-real gap on a learned grasping policy for a tendon-driven hand. In simulation it hit 94% grasp success; on hardware it was 61%, and the failures were intermittent: same object, same pose, sometimes a clean grasp, sometimes the fingers closed 15 mm short and crushed it.

It was hard because it wasn't one bug. Four effects, each inside its own team's spec, added up to a phase error the policy had never seen: command latency, tendon compliance, camera exposure delay, and a contact model that assumed rigid fingertips. Mean latency was fine. The p99 was not, and the policy only failed at the tail.

I built a timestamped replay rig first (every camera frame, joint command and current reading stamped off one PTP clock) and that turned "the policy is flaky" into a latency budget I could attack.

PathNominalMeasured p50Measured p99
camera exposure + transfer20 ms34 ms48 ms
inference (Orin, 50 Hz policy)4 ms6 ms19 ms
policy → drive command2 ms3 ms8 ms
drive current loop1 ms1 ms1 ms
sense-to-act total27 ms44 ms76 ms

At a 20 ms policy period, 76 ms is 3.8 control steps of unmodelled lag. A grasp controller tuned in sim with Kp = 40 on tendon position is already marginal at one step of delay; at four it rings, the tendon overshoots, and fingertip force spikes past the object's crush threshold. That is the mechanism behind "sometimes it crushes it", not a bad policy, a phase-shifted one.

What I changed

  1. Moved inference to a dedicated real-time thread with pre-allocated tensors and locked GPU clocks: p99 inference 27 → 9 ms.
  2. Stamped frames at exposure start rather than at receipt, and trained the policy with the measured delay distribution injected in sim, so it learned to act on stale observations instead of assuming fresh ones.
  3. System-ID'd tendon stiffness with a step-response sweep and put the identified spring into the sim's actuator model.
  4. Added a 2 ms jitter buffer on the command path so the drive never sees a burst.

Result: 61% → 89% on hardware, and the sim number moved to 91%. The two converging is the real signal: it means the model got fixed, not that the policy got overfitted to the rig.

I considered two alternatives. Running the policy at 200 Hz would shrink 76 ms to fewer steps, but inference was 6 ms p50 and the Orin budget wouldn't hold that alongside perception. Handing the last 20 mm to a classical impedance controller we kept as a fallback, but it lost on deformable objects: the stiffness estimate was exactly the thing that was wrong.

What I'd do differently

I spent three weeks tuning the policy before instrumenting. The replay rig took four days and found the cause in one afternoon. On anything with a real-time loop, get the common clock and the log first. In production I'd monitor p99 sense-to-act latency with an alert at 40 ms and the integral of grasp force as a second signal, because either one alone will miss a slow drift in the other.

Curated: · Written: · Reviewed:

Q&A-2Why do you want to work at Tesla specifically, rather than a traditional AI lab?

Reported in ai-interview-guides/guides/tesla.md at main · landedjobs/ai-interview-guides

The 90-second answer

Two things decide whether a robotics policy ever gets good: who owns the hardware it runs on, and where the next failure example comes from. At a traditional AI lab those are usually different teams or different organisations: you get a fixed dataset, a benchmark, and a platform someone else built. At Tesla they sit in one org, and that's the actual reason I'm here. It's not a culture claim, it's a latency claim: the loop from field failure to retrained policy is measured in days, not in a publication cycle.

Traditional AI labTesla robotics
Where failures come fromcurated benchmark, teleop setfleet-mined edge cases, shadow-mode diffs
Unit of progresspaper, SOTA on a held-out setOTA release to a real population
Hardware ownershipvendor or separate teamactuators, hand, firmware designed in-house
Success metricsuccess rate on the eval setinterventions per hour, MTBF, safety case
Cost of being wronga bad number in a tablea stopped line, a recall

What that looks like on a real bug

Take an illustrative case, since I don't have Tesla's numbers: a grasp policy reports 92% success in sim and 70% on hardware over 500 trials. That's 460 versus 350 successes: 110 extra failures, and at 40 s of operator intervention each, 73 minutes of lost robot time per 500 grasps. Failures cluster on thin, flat objects. In a lab the honest answer is "sim-to-real gap" and you add domain randomisation. Here you can instrument it: log commanded finger position against achieved contact position and you find the gap opens under load, which points at compliance and tendon stretch rather than at the vision stack. The fix spans mechanical tensioning, a controller that closes on measured contact rather than commanded position, and a policy retrained on the corrected dynamics: three teams, one test rig, one week.

That's the thing a lab structurally can't give me. I want my controller to run on hardware I can put a torque wrench on.

Where the tight loop bites back

It's not free, and I'd want to be judged on knowing that.

Fleet data is biased. Logs capture states an operator rescued, so a policy trained on them overfits to already-failing states and looks better than it is. Detection: hold out a full shift of teleop logs and compare success on intervened versus non-intervened states. A gap above ~15 points means the eval set is skewed and the release number is fiction.

Retraining regresses something else. Fixing thin objects degrades soft objects. Detection: a fixed regression suite of ~200 recorded episodes replayed in sim and on two robots before any canary; block the release if any task drops more than 3 points.

The OTA itself is the outage. Canary five robots for one shift with the previous policy artifact still addressable, and an automatic revert if interventions per hour exceed twice baseline over a two-hour window. Target rollback under 30 minutes, which means the on-call has physical access to the robot, not just a dashboard.

That last point is the real cost: a fault at 2 a.m. is a person walking to a robot, and the safety argument for a policy working near people is a document, not a demo video.

What I give up, and what I'd check

I lose open publication and the freedom to spend three years on a question with no product path. I'd take that trade, but I'd want to verify the loop actually closes: how evaluation is structured before a policy reaches the fleet, what the sim-to-real fidelity budget is, and who owns the on-call. If those answers are thin, the latency advantage I just described is a story rather than an engineering property.

Curated: · Written: · Reviewed:

Q&A-3Tell me about a time you had to solve a problem no one had solved before. How did you approach it from first principles?

Reported in Tesla Interview Process 2026: Rounds, Questions & Timeline

The 90-second answer

The problem was seating a high-voltage interconnect into a battery pack with no vision and no compliance: a 0.4 mm chamfer lead-in, a 400 kg pack located on dowels, and a robot that had to do it in under 4 s. Nobody on the team had a recipe for it, and the vendor's answer was "buy a more accurate robot."

The first-principles move was to refuse that framing and write down what the task actually requires. Seating is a geometric problem: the connector tip has to land inside the chamfer. So I built the error budget before touching hardware.

Contributor1σ (mm)Where it comes from
Robot repeatability0.10spec, verified with a laser tracker over 200 cycles
Pack locating on dowels0.30fixture wear over 50k cycles
Connector housing mold0.50drawing tolerance, taken as 1σ
Wrist thermal drift0.156 °C rise measured over a shift
RSS total0.61against a 0.40 mm chamfer

Root-sum-square of 0.61 mm against a 0.40 mm chamfer puts about 19% of approaches outside the lead-in even with a perfect robot (Rayleigh, 2-D), and a perfect robot doesn't exist. The dominant term is the molded part, which I can't change. So the conclusion fell out on its own: position control cannot solve this, the task needs contact sensing. That was the whole first-principles result, and it took an afternoon.

What I built

A wrist force/torque sensor at 1 kHz, contact detected at 8 N against a 3 N noise floor, then a spiral search until the force vector goes axial.

python

pseudocode, 1 kHz control loop, forces in N, distances in mm

def seat(xy, f_contact=8.0, f_max=60.0): while z > z_seat and ft.norm() < f_contact: move(dz=-0.5) # 0.5 mm per 25 ms tick = 20 mm/s for r, th in spiral(r_max=2.0, pitch=0.5): move_to(xy + polar(r, th), z_hold) if ft.norm() > f_max: back_off(2.0) # jammed on a wall if ft.axial() > f_contact and ft.lateral() < 2.0: break # aligned press_to(z_seat, f_max=60.0)

The signal that told us it worked was the force trace: lateral force drops under 2 N exactly when the tip falls into the chamfer and the axial force steps up. That signature is the alignment detector: no vision needed.

Result and what generalizes

First-pass yield went 82% → 99.6% over 40k cycles, and cycle time dropped 4.2 s → 3.6 s because the retries disappeared. The controller ported to three other stations unchanged.

Two failure modes bit us. Cable drag on the wrist read as contact: fixed by gravity-compensating the tool and re-zeroing the sensor every cycle. And the sensor drifted about 1.5 N over 500 cycles, so we re-zero against a known stop every 500 seats and alarm if the offset exceeds 3 N.

The generalizable part: turn the requirement into a number, decompose the error budget, find the term that dominates, and only then decide whether to buy accuracy or add sensing. Most "unsolved" problems I've hit were a budget where everyone was optimizing the wrong term.

Curated: · Written: · Reviewed:

Q&A-4Describe a situation where you had to move extremely fast under pressure. What trade-offs did you make?

Reported in Tesla Interview Process 2026: Rounds, Questions & Timeline

The 90-second answer

Eleven days before a pilot-line demo, we got a new gripper that our collision model and place poses didn't know about, and the cell was running a 6.2 s pick cycle against a 4.5 s takt the customer had already built their line around. I was the integration owner. My rule going in: cut scope and cut generality, never cut the safety chain or the observability that tells you the cut broke something. We shipped in nine days at 4.4 s on two SKUs instead of six, ran ~1,400 picks over a three-day demo, and had two faults: both caught by the check we added, not by a crash.

Where the 1.8 s came from

ChangeSavedWhat it cost
Moved the source bin 40 cm closer to the base0.9 sFixture re-pinned; layout no longer matches the line drawing
Dropped the post-grasp vision re-check0.5 sBad grasps now fail silently unless something else notices
Precomputed place poses offline instead of solving IK at runtime0.4 sBreaks the moment the place fixture moves

6.2 − 0.9 − 0.5 − 0.4 = 4.4 s. The bin move was the only one that was free; the other two each bought time with a failure mode, so each needed a compensating control.

The trade-off table I actually wrote down

CutKeptRisk acceptedBounded by
6 SKUs → 2Full grasp set for those 2Demo doesn't generalizeTold the customer in writing on day 1
Post-grasp vision re-checkPre-grasp pose checkSilent bad graspGripper current + width check, faults the cycle
Runtime IK for placeSingle pinned place poseFixture driftFixture marked DO-NOT-MOVE, one place location only
Automated regression suite12-point manual smoke checklistRegressions in untouched pathsBranch frozen; only the three fixes merged
Force-controlled insertionPosition move with complianceJamsCurrent limit, one retry, then fault

Never on the table: the e-stop chain, joint torque limits, the watchdog on the control loop, or running above rated speed. Those aren't schedule levers: a demo that's fast because you disabled a limit is a demo that ends the program.

The compensating control for the dropped vision re-check was about fifteen lines:

python

gripper.py: Python 3.11, our cell's control service

GRASP_CURRENT_MIN_A = 0.35 # fingers closed on air read ~0.08 A GRASP_WIDTH_MAX_MM = 78.0

def grasp_ok(current_a: float, width_mm: float) -> bool: return current_a >= GRASP_CURRENT_MIN_A and width_mm < GRASP_WIDTH_MAX_MM

That check is what caught both demo faults: a part seated at an angle so the fingers closed to 12 mm on air, and a double-pick that pushed width past 78 mm. Without it, both would have been a dropped part mid-transfer or a collision on the next descent.

Repaying it

Two weeks after the demo: vision re-check back on (it cost 0.5 s, so we recovered it by speeding the retract profile within rated limits), SKU set back to six, and the twelve-point checklist turned into actual regression tests in CI so the next fire doesn't get to skip them. The precomputed place poses stayed: with a startup check that the fixture is where it was, they're strictly better than runtime IK.

The thing I'd do differently: I sat on the SKU cut for four days hoping we'd recover it, and told the customer on day four instead of day one. Scope news doesn't get cheaper with age.

Curated: · Written: · Reviewed:

Q&A-5Give an example of when you took ownership of something outside your job description?

Reported in Tesla Interview Process 2026: Rounds, Questions & Timeline

The 90-second answer

I was hired to own the robot programs and PLC logic on a body-shop seam-sealing cell: six robots, 48 parts an hour. Nozzle clog detection was not mine. It belonged to process engineering, and the procedure was an operator visual check every two hours. A clog doesn't announce itself: the bead goes thin or skips, the part passes, and end-of-line vision catches it twenty minutes downstream. We were scrapping or reworking about 30 parts a week on that cell, and roughly two-thirds traced back to a partially clogged nozzle.

I collected two weeks of dispense pressure data first, on my own time, changing nothing. The signal was obvious: a healthy nozzle holds 41–43 bar through the bead; a clogging one climbs past 50 bar and gets noisy in the last 300 ms of the stroke. So I wrote a detector into the PLC that compared the pressure integral per stroke against a rolling baseline, ran it in shadow mode for two weeks (logging only, no stops) then took the data to the process engineer who owned the dispense spec and asked him to own the threshold. He did. We turned on the interlock with his sign-off, and escapes on that cell went from ~30 a week to 4.

The part that mattered wasn't the detector. It was that I ran it in shadow mode before it could stop the line, and that I handed the threshold to the person whose name was on the process.

What I took on, and what I deliberately didn't

My job descriptionrobot programs, PLC logic, cycle time
What I took onclog-detection signal and shadow-mode instrumentation
What I left alonedispense pressure/flow spec, threshold sign-off, nozzle change interval

That third row is the one I'd defend hardest. Taking ownership outside your lane doesn't mean taking the lane. The process engineer had years of context on how pressure shifts with sealant viscosity and ambient temperature; I had two weeks of data. If I'd set the threshold myself I'd have been wrong within a month, and I'd have burned the relationship that made the fix possible.

The detector, concretely

One clogging nozzle, 12 ms PLC scan, pressure integral normalised to the healthy baseline:

strokepeak pressureintegral vs baselinestate
1–4041.8 bar1.00healthy
4144.1 bar1.06watch
4651.3 bar1.19alarm
4758.0 bar1.31interlock, robot holds

Detection at stroke 46, about 1.4 s before the bead would have gone thin on that part. The robot holds at the end of the stroke, the operator purges, the part re-runs: 90 seconds of downtime instead of a rework.

What went wrong

Shadow mode earned its keep in week one. Monday mornings after a cold weekend, the first six strokes ran 3–4 bar low across the board and the detector fired on healthy nozzles. Viscosity, not a clog. Fixed with a warm-up gate: the first 10 strokes after more than 4 h idle are logged but can't alarm. That false-positive class is exactly what would have gotten the whole thing switched off if I'd gone straight to an interlock.

Second failure mode: a rolling baseline drifts if you let it. I anchored it to a per-nozzle median over the last 200 strokes with a floor and a ceiling, so a slow plant-wide shift in the sealant supply can't quietly re-baseline the detector into uselessness.

If I did it again

I'd have started the shadow-mode logging in week one instead of week three: the two weeks of collecting data quietly were the slow part, and the instrumentation could have been in on day two. And I'd have written the handoff doc before the interlock, not after; the process engineer ended up writing half of it himself, which was fine, but only because he was already bought in. On a line that runs 22 hours a day, a 30-part-a-week escape isn't a process-engineering problem or a controls problem: it's everyone's, and the person who notices is the person who owns it.

Curated: · Written: · Reviewed:

Q&A-6Tell me about a time you disagreed with your manager. What did you do?

Reported in Tesla Interview Process 2026: Rounds, Questions & Timeline

The 90-second answer

A dispense station on a body line was missing bead placement about 0.9% of the time: roughly 11 bad parts per 1,200-part shift, caught downstream at inspection. My manager's call was to add a second camera and a light curtain: about $40k, a six-week lead time, and a re-validation of the station. I thought the data pointed somewhere else, and I said so in our 1:1 rather than in the group review.

The misses weren't random. They clustered in the two hours after a cold start and after lunch, and only on the station at the end of the longest conveyor run:

SliceMisses per 10k parts
mid-shift, steady state22
first 2 h after cold start310
line speed above 105% nominal260

That's a thermal-and-speed signature, not an occlusion signature. Occlusion would be flat across the shift and worse on the parts with the most complex geometry, which it wasn't.

The mechanism: the camera trigger was latched in PLC software and timestamped against the PLC clock, while the camera stamped its own frame time. The two clocks drift a few milliseconds as the cabinet warms. At 1.2 m/s line speed, 4 ms of drift is 4.8 mm of position error against a ±3 mm bead tolerance. Nothing was broken: the tolerance was just smaller than the drift.

What I actually did

I didn't argue the software theory in the abstract. I asked for 48 hours and one station, and I wrote the prediction down before running anything: if this is clock drift, triggering on the encoder's hardware signal instead of the software latch drops the miss rate under 0.1% with no hardware change; if it's occlusion, the rate doesn't move. That second clause is what made it a test rather than a position.

We ran 9,400 parts over a weekend. Miss rate came back at 0.06%. The camera order was cancelled, and I wrote the hardware-trigger requirement into the spec for the other three stations.

Where I lost, and committed

The same manager wanted to keep the second camera anyway as a redundant check. I disagreed: it adds a calibration step to every shift change and I didn't think the marginal coverage paid for it. I made the case once with the numbers, he decided, and I wrote the calibration procedure so it wouldn't become a maintenance ticket every week. Disagree-and-commit only works if the commit is real; half-hearted execution to prove a point is worse than the original disagreement.

What I'd do differently

I sat on the correlation for a week because I wanted a cleaner dataset. If the capex had gone out, my silence would have cost six weeks. The right move is to raise it while the decision is still reversible, with provisional data labelled as provisional.

One exception to all of this: if the disagreement is about a safety function (an interlock, a reduced-speed zone, anything under ISO 10218 or ISO/TS 15066) disagree-and-commit doesn't apply. You stop the line and escalate, because the sign-off is personal and "my manager told me to" is not a defence.

Curated: · Written: · Reviewed:

Q&A-7Walk me through a project you owned end to end: what would you do differently?

Reported in Tesla Intern Opportunity Interview Questions & Prep Guide 2026 | InterviewSense

The 90-second answer

I owned a force-controlled connector-insertion cell for high-voltage harness assembly end to end: capital justification, vendor bake-off, integration, safety validation to ISO 10218-2, and line handoff. Six-axis arm, wrist-mounted 6-axis F/T sensor sampled at 1 kHz, a 3D camera for coarse pose, and a passive compliance wrist as the last resort. The spec was a 12 s cycle at 99% first-pass insertion. We handed off at 9.8 s median and 99.2% first-pass over a 30-day production run.

What I'd do differently, ordered by what it cost:

  1. I built the vision pipeline before I characterized the tolerance stack. Six weeks getting pose estimation to ±0.8 mm, when part-to-part variation was 3 mm and a printed funnel with a 2 mm chamfer absorbed all of it. Measure the distribution first, then buy the cheapest thing that covers it.
  2. I tuned against one fixture. At ramp we found four stations with different wear; the gains that were clean on a new fixture chattered on worn ones. A fixture-variation rig in week two would have caught it before integration.
  3. I deferred structured failure logging to month five. The failures before that were bimodal, force aborts and vision rejects, and the logs couldn't separate them, so we spent three weeks tuning the wrong subsystem.

How it actually ran

PhaseDurationDeliverableWhat I'd change
Spec + vendor bake-off4 wkarm, F/T sensor, camera chosenput fixture variation in the bake-off, not just the lab
Integration9 wkcell running in labvision built before the tolerance study (−6 wk)
Ramp6 wk4 stations, 3 shiftslogging from day one, not week 5
Handoff3 wkrunbook, maintenance training—

The failure that taught me the logging lesson

Station 3, fixture at ~40k cycles. Camera pose error 3.1 mm against a ±2 mm spec. The arm drove to nominal, contact at 0.42 s, force ramped 0 → 62 N in 80 ms against a 40 N abort limit, controller tripped at 41 N, spiral search ran, and attempt 3 succeeded at 14.2 s: 2.2 s over cycle, which stops the line if the buffer is empty. Without per-attempt force traces and pose residuals tagged to the same attempt ID, that looked identical in the logs to a specular-reflection vision reject. It wasn't: one needed a per-station gain schedule, the other needed a polarizer and diffuse lighting.

Failure taxonomy once the logging existed, first 30 days, 38,400 attempts, 307 failures:

Failure classCountRoot causeFix
Force abort > 40 N214worn fixture + pose errorper-station gain schedule, 40 N → 35 N abort on worn stations
Vision reject62specular reflection off connector shellpolarizer + diffuse lighting
Retry exhausted31both—

What I'd do differently, concretely

I'd write the tolerance study as the first deliverable, before any perception code: a histogram of connector pose at the pick point across 200 parts, which is two days of work and would have killed the vision project on day three. I'd build the fixture-variation rig (three fixtures at 0, 20k and 40k cycles) before tuning any gains, and tune against the worst one. And I'd stand up the logging schema in week one: attempt id, pose estimate, force trace, abort reason, station id, fixture cycle count, all joined. That schema is what turned a three-week guessing game into a two-day fix.

The part I'd keep: I insisted on a mechanical compliance wrist as the fallback even though the controls team wanted to solve it purely in software. It cost $900 and covered the 3 mm of variation the vision system was never going to see.

Curated: · Written: · Reviewed:

Q&A-8How would you break down a vague requirement into a concrete plan with milestones?

Reported in Tesla Intern Opportunity Interview Questions & Prep Guide 2026 | InterviewSense

The 90-second answer

A vague requirement is a sentence with no metric and no owner. I don't plan until I've converted it into a measurable capability statement and the person who asked for it has agreed to the number. Then I sequence milestones by risk, not by component completeness: the first milestone is always the one that can kill the project.

Four steps:

  1. Operational definition. What the robot does, in which environment, at what rate, with what allowed failure rate. "Unload totes" becomes "250 totes/hour sustained over an 8-hour shift, ≤1 drop per 1,000 picks, on the production tote mix, in a trailer with no external lighting."

  2. Find the binding constraint. The one physical or algorithmic limit that decides feasibility: usually cycle time, grasp reliability, or perception under real lighting. Everything else is downstream of it.

  3. Milestone ladder. Each milestone is a demo plus a numeric exit criterion plus a date. Never "perception module done"; always "grasp success ≥ 99% over 500 attempts on the production tote mix."

  4. Decision gates. A date written down in week one at which we either proceed or change approach. Slipping a gate re-scopes scope; it does not move the date.

Worked example: requirement: "Optimus should unload totes from a trailer."

#MilestoneExit criterion (measured)Week
0Scope and metric agreedstakeholder signs 250 totes/h, ≤1 drop/1,0001
1Cycle-time budget closed on paperstage budgets sum to ≤ 14.4 s p951
2Single-tote pick, lab, fixed lighting99% over 500 attempts4
3Same, production tote mix, 3 lighting conditions99% over 500, p95 ≤ 14.4 s8
430-minute continuous run, no human intervention≥ 240 totes/h, zero interventions12
5Trailer, full 8-hour shift≥ 250 totes/h, ≤1 drop/1,00018

The arithmetic that makes milestone 1 real: 250 totes/h is 14.4 s per tote. Budget it as perception 250 ms, motion planning 400 ms, transport and grasp 6.5 s, place 3.5 s, and 3.75 s of retry allowance. If perception alone eats 2 s, no amount of arm tuning reaches the target, which is why the budget is settled on paper before anyone writes code.

Failure modes I plan against

  • The demo cliff. A lab demo at 9/10 looks finished and is four orders of magnitude from production reliability. Exit criteria have to be statistical and measured on the real distribution (real totes, real trailer floor, real lighting) or the milestone is theatre.
  • Milestones gated on hardware nobody ordered. Long-lead items (gripper, specific camera, compute module) get ordered in week 1 or the plan is fiction. I check every milestone's dependencies against purchase-order dates.
  • Unstated scope. I write the "not doing" list (no mixed SKUs, no damaged totes, no double-stacked pallets) and get it agreed in the same meeting as the metric. Otherwise the requirement expands silently and every date slips.
  • Activity masquerading as capability. "Integration complete" and "model trained" are not milestones. "End-to-end pick-place at 90% success over 200 attempts" is.
  • Safety discovered late. Any milestone with a human in the cell needs the risk assessment under ISO 10218-1 finished before the demo, not after; it routinely changes the layout and the speed limits.

I re-plan weekly against the exit criteria, and I show the stakeholder the measured number, not the percent-complete bar.

Curated: · Written: · Reviewed:

Q&A-9Explain the trade-offs between different actuator technologies for humanoid applications.

Reported in Tesla Robotics Engineer Interview Questions & Guide 2026

The 90-second answer

Assume a battery-powered humanoid that has to walk, absorb falls, and manipulate near people. No actuator wins every joint. My default is electric quasi-direct-drive (QDD) where backdrivability and bandwidth matter, geared electric (harmonic, cycloidal or planetary roller screw) where high torque at low speed matters, and a series-elastic element only where force control or impact tolerance is the binding constraint. Hydraulics win on power density but lose on efficiency, leaks and serviceability; pneumatics are compliant and cheap but too soft and too load-dependent to control for dynamic walking.

TechnologyTorque densityBackdrivability / bandwidthEfficiencyHumanoid fitFailure modes
Electric QDD (low ratio)low-moderatehighhighhips, shoulders, elbowsthermal, encoder, bearing
Geared electric (harmonic/cycloidal/roller screw)highlow-moderate~60-85%knees, ankles, linear jointsgear wear, backlash, torque ripple
Series elastic (SEA)moderatemoderate, tunablelowercontact-rich, safetyspring fatigue, extra DOF
Hydraulicvery highmoderatelowhigh-power legged robotsleaks, seal friction, pump
Pneumaticlowhigh compliancevery lowresearch, soft robotscompressibility, control

The sizing arithmetic is where the trade-off stops being abstract. Say a knee needs 60 N·m peak. A 0.6 N·m motor through a 100:1 gearbox at 80% efficiency delivers 0.6 × 100 × 0.8 = 48 N·m, so the ratio has to be about 60 / (0.6 × 0.8) = 125:1. Reflected inertia at the output scales as J_motor × N². A 1e-5 kg·m² rotor at 100:1 reflects 0.1 kg·m²; at 125:1 it reflects 0.156 kg·m². That inertia is what you feel when the foot lands: the joint stops yielding, and the impact goes into the gearbox and the structure instead of the ground. QDD keeps N around 10-20, so reflected inertia stays low and torque control from motor current is honest, but the motor is heavier for the same output torque.

Harmonic drives give near-zero backlash and a high ratio in a small package, which is why they suit wrists and elbows. The cost is efficiency, torque ripple, and a thin flexspline that dislikes shock loads. Cycloidal drives and planetary roller screws give up some precision for impact tolerance and, in the roller screw's case, convert rotary to linear without a separate ball-screw wear path. Any geared joint needs a torque sensor or a careful current-to-torque model if you want force control, because friction and backlash break the simple current-to-torque mapping that QDD relies on.

SEA puts a spring between gearbox and load. It costs bandwidth and adds a resonance, but it turns a stiff position servo into a force source and shields the gearbox from impacts. Use it where contact force matters more than trajectory tracking (a foot pad, a hand) not in a knee that has to hold a pose against gravity.

Hydraulics still give the best power density per package, but a humanoid pays for the pump, accumulator, hose routing, leak risk and low efficiency, and seal friction destroys the low-force transparency you need near people. Pneumatics are worse for walking: air is compressible, so stiffness and damping shift with load, and a compressor is a poor match for a battery pack.

The rule I would apply on any humanoid program: pick the joint's dominant requirement. High torque, low speed (knee, ankle, linear lift) geared electric or roller screw. High bandwidth, safe contact (hip, shoulder, elbow) QDD. Force-controlled contact: SEA, or QDD with torque control and a compliant cover. Then verify with a thermal duty cycle and a drop test, because the gearbox that survives the datasheet often fails the fall.

Curated: · Written: · Reviewed:

Q&A-10How do you optimize control loops for stability under varying load conditions?

Reported in Tesla Robotics Engineer Interview Questions & Guide 2026

The 90-second answer

First I pin down which "load" is varying, because each one enters the plant at a different point. On a robot joint there are three: inertial payload reflected through the gearbox, external contact force at the end effector, and the electrical/thermal load that changes bus voltage and motor resistance. They need different fixes.

Then I model the plant, measure it, and design for the worst case with margin, not for nominal. Concretely: cascaded current/velocity/position loops with at least 5× bandwidth separation, gain scheduling on a measured scheduling variable, feedforward for the known load torque, and a disturbance observer for the rest. Validate with swept-sine FRF at min/max load and step responses at the corners.

Mechanism

Cascaded loops: current loop innermost at ~20 kHz (PWM 40 kHz), velocity at ~2 kHz, position at ~200–500 Hz. Each outer loop sees the inner loop as near-unity gain, so the plant it must stabilize is simple. Load inertia reflected through gear ratio N: J_reflected = J_load / N². With N=10, a 0.1 kg·m² payload looks like 0.001 kg·m² at the motor: that's why high-ratio gears make load variation mostly disappear, and why quasi-direct-drive joints (N≈1–3) feel it directly.

Arithmetic example: nominal motor inertia 0.0002 kg·m², load 0.02 kg·m² through N=5 → reflected 0.0008, total 0.001. Plant gain ∝ 1/J. If payload doubles to 0.04, total becomes 0.0018, gain drops 1.8×, crossover falls, phase margin rises: sluggish but stable. The dangerous direction is load removal: gain rises, crossover moves toward the current-loop bandwidth, phase margin collapses. So I design at minimum inertia and check the maximum-inertia corner for sluggishness and integrator windup.

LoopRateDesign target
current20 kHzPM ≥ 60°, GM ≥ 10 dB
velocity2 kHzPM ≥ 50°, GM ≥ 8 dB
position500 HzPM ≥ 45°, GM ≥ 6 dB

Gain scheduling: schedule Kp/Ki on estimated inertia (from payload mass estimate or joint torque) or on pose for gravity-dominated joints. Interpolate linearly between breakpoints, and bumpless-transfer integrator state so switching doesn't kick the output.

Feedforward: gravity torque τ_g(q) from the model, plus inertial feedforward J(q)·q̈_desired. This removes the deterministic part of the load so feedback gains stay low and robust.

Disturbance observer: estimate d = τ_cmd − J_n·θ̈ via a low-pass-filtered inverse plant, feed back. Bandwidth limited to ~1/3 of velocity loop; too high and it amplifies encoder noise and gear backlash.

Alternatives and when not to use

Robust H∞/μ-synthesis gives guaranteed margins over a bounded uncertainty set: good when the load range is known and you can't measure the scheduling variable. Cost: conservative, lower bandwidth. Adaptive MRAC can track large parameter changes but is fragile with unmodeled dynamics (backlash, compliance): I'd only use it with a robust outer loop. Impedance/admittance control is the right answer when the "load" is contact with a stiff environment; pure position control goes unstable at high environment stiffness, so you switch to a force-based loop with passivity guarantees.

Failure modes

  • Integrator windup during saturation → overshoot and limit cycle; detect with command-vs-actual error growing while output is clamped; fix with back-calculation anti-windup.
  • Gear backlash dead zone → limit cycle at low amplitude; detect in the FRF as a jump; fix with dead-zone compensation or lower crossover.
  • Encoder quantization + derivative → noise amplification; detect as high-frequency content in current command; fix with velocity observer or low-pass.
  • Bus voltage sag under high current → current-loop gain drops; detect via DC-link measurement; schedule current-loop gain on V_bus.
  • Thermal derating changes torque constant → gain mismatch; detect via temperature sensor; schedule.

Validation: swept-sine FRF from 1 Hz to 2 kHz at min/nominal/max payload, step and chirp tests, and a hardware-in-the-loop test that injects the worst-case inertia. I sign off on margins at the corners, not nominal.

Curated: · Written: · Reviewed:

Q&A-11What are the primary failure modes in precision gear systems, and how do you mitigate them?

Reported in Tesla Robotics Engineer Interview Questions & Guide 2026

The 90-second answer

First I'd pin down the stage type, because the failure modes differ: a humanoid actuator is usually a strain-wave (harmonic) stage for the high ratio, sometimes planetary or cycloidal. Across all three the modes cluster into four buckets: fatigue of the loaded members, surface and lubricant degradation, kinematic degradation (backlash, lost motion, stiffness loss), and tooth jump under torque overload. Mitigation follows the buckets: rating margin on the fatigue-limited parts, environmental control for the surfaces, and closing the position loop on the output encoder so kinematic drift doesn't become positioning error.

ModeMechanismSignature in telemetryMitigation
Tooth-root fatigue (flexspline, planets)cyclic bending at the filletslow rise in transmission error, then a step drop in torsional stiffnesscase-carburized or nitrided steel, shot peen for compressive residual stress, rating per ISO 6336 bending
Contact fatigue / pittingsubsurface shear from Hertzian contactvibration at mesh frequency plus sidebands; iron in the greaseprofile modification (tip relief, lead crown), specific film thickness λ > 1, finer surface finish, rating per ISO 6336 contact
Wear / lost motionabrasive wear, starved film, contaminationbacklash grows monotonically; hysteresis loop widenssealed housing, base-oil viscosity matched to operating temperature, controlled run-in
Tooth jump (overload ratcheting)torque spike overcomes the tooth-engagement preload and the flexspline teeth skip a pitchinstantaneous phase shift of exactly one tooth pitch, not a gradual driftfirmware torque limit, torque sensor or slip clutch, stay inside the vendor's momentary-peak column
Lubricant breakdownshear heating and oxidationtemperature rise at unchanged load, rising torque ripplethermal model in the controller, duty-cycle limiting, grease life rating
Misalignment / edge loadingcarrier or housing deflection under loadone-sided pitting, asymmetric wearstiffness-matched housing, lead crown, FEA of the load path

Tooth jump is not fatigue. It's a kinematic event: the teeth skip and the output phase shifts by one pitch, so the joint loses absolute position in a single cycle. Vendor catalogues (Harmonic Drive's CSF series is the one I know) publish three torque columns (rated, repeated peak, momentary peak) and the momentary figure is roughly 3× rated for the size-20 ratio-100 unit, though the ratio varies by size and ratio, so read the specific table. Design the torque limit against the repeated-peak column, not the momentary one.

Why backlash is the one that bites you. Strain-wave catalogues quote lost motion around 1 arcmin for standard units, less for high-precision variants. Worked example: 1 arcmin = 2.91e-4 rad; on a 0.5 m link that is 0.15 mm of tip error, visible in any manipulation task. Worse, backlash is a dead zone: put the output encoder in the loop and the controller can limit-cycle around it. You either preload it out mechanically (zero-backlash gearset, preloaded output bearing) or model it: a describing-function gain plus a notch at mesh frequency, and accept the residual.

Detection before failure. Bench-life a unit at a fixed fraction of rated torque and log motor-side against output-side encoder every cycle. In a hypothetical run, a healthy unit holds lost motion flat at 0.8 arcmin for 2 million cycles; wear-out shows a monotonic climb to 2–3 arcmin, a fatigue crack shows a sudden step. That same delta is the cheapest end-of-line test: sweep torque both directions, fit the hysteresis loop, reject outside the band. You cannot hand-lap every gearset at production rate, so the spec has to be manufacturing-defined and 100% verified.

Where the mitigations fight each other. Over-preloading to kill backlash raises friction torque, which raises temperature, which shortens grease life: grease suppliers quote an Arrhenius-style rule of roughly halving life per 10 °C above rated, so preload and thermal budget are one design problem. And a firmware torque limit that hides tooth jump will mask a misaligned housing until the teeth are gone.

Curated: · Written: · Reviewed:

Q&A-12Describe your process for performing thermal analysis on complex mechanical assemblies.

Reported in Tesla Robotics Engineer Interview Questions & Guide 2026

First I pin down the duty cycle and the limits, because thermal analysis of an assembly is meaningless without them. I ask: steady-state or transient, what ambient and coolant, what allowable temperature at each node. Winding insulation class, magnet demag, bearing grease, PCB junction, seal elastomer, and what the worst-case sequence is. On a humanoid actuator that might be 3 s of peak torque every 30 s for 10 minutes, then continuous walking. I write that as a power-vs-time profile before opening any solver.

Then I build a fidelity ladder. A lumped thermal network first: each component a node with C_th and R_th, interfaces as contact resistances. That takes an hour and tells me which heat path dominates. Only then do I go to FEA or CFD for the joints and flow where the network is uncertain.

StageToolQuestion it answersTypical error
Lumped networkhand calc / SPICE-likewhich path dominates, time constantwrong contact resistance
Conjugate FEAANSYS / Icepakhotspot in stator, PCB, gearboxmesh too coarse at joint
CFDFluent / STAR-CCM+coolant or air maldistributionwrong flow boundary
Test correlationthermocouples / IRis the model rightsensor placement

Worked example: actuator copper loss 40 A through 0.05 Ω = 80 W. Lumped R_th from winding to housing 0.8 K/W, ambient 40 °C → 64 K rise → 104 °C hot spot, 51 K margin to Class F 155 °C. C_th 500 J/K gives τ = 400 s; after a 300 s peak the rise is 80 × 0.8 × (1 − e^(−300/400)) ≈ 34 K, so the transient is what lets you run peak torque. That arithmetic decides whether you need a bigger housing or a duty-cycle limit.

For the assembly, the interfaces are the model. A dry bolted aluminum joint might be 500 W/m²K; with grease 3,000; a press fit is different again. I measure or bound those, then run sensitivity: if contact conductance halves, does the hotspot move more than 5 K? If yes, it gets a test, not a guess. Same for convection coefficients and coolant flow split. Radiation is usually under 5% below 100 °C, but I check view factors on exposed surfaces rather than assume it away.

I validate with a step-power test: apply known losses, log thermocouples and IR, fit R_th and C_th from the rise. A model that misses by more than 5–10 K at the hotspot is not usable for a duty-cycle decision. Failure modes I watch: assuming perfect contact, using steady state for a 30 s peak, ignoring heat through bearings and harnesses, and trusting a single CFD flow boundary. Detection is a power audit plus a thermocouple on the interface, not just the housing.

I stop modeling when the sensitivity is smaller than the manufacturing tolerance and the test correlation is within the margin. Then the model becomes a duty-cycle limit in the controller.

Curated: · Written: · Reviewed:

Q&A-13How do you approach the design of high-torque, high-efficiency motor systems?

Reported in Tesla Robotics Engineer Interview Questions & Guide 2026

The 90-second answer

Start with the joint's torque-speed duty cycle, not the motor. For a humanoid actuator I need four numbers before I touch topology: continuous torque, peak torque and how long it lasts, maximum joint speed, and the thermal path. Ambient temperature, mounting, and duty cycle. Efficiency is meaningless without the operating point. A motor that is 92% at 3000 rpm can be 60% at stall, and a humanoid spends most of its life near stall.

Then I choose between direct drive and a geared PMSM. For high torque at low speed, the geared machine wins on mass and loss almost every time. Take a joint that needs 40 Nm continuous at 10 rpm. Direct drive with a torque constant of 0.5 Nm/A draws 80 A; at 0.05 Ω phase resistance that is 320 W of copper loss, which is a hairdryer inside the joint. A 20:1 reducer drops the motor to 2 Nm and 4 A. 0.8 W of copper loss, but adds roughly 15% gear loss and reflected inertia that scales with the square of the ratio. The gear wins on thermal mass and loses on backdrivability and backlash. That trade is the design.

Loss termDirect drive at 40 Nm20:1 geared at 2 Nm motor
Copper (I²R)320 W0.8 W
Iron (at 10 rpm)negligiblenegligible
Gear mesh0~6 W at 85% efficiency
Inverter conduction~8 W~0.4 W
Reflected inertia1×400×

Electromagnetic design. I use a three-phase PMSM with fractional-slot concentrated windings and a high pole count, 14 poles is a common starting point for a joint this size, because torque scales with airgap radius squared and pole count, and concentrated windings keep end-turn copper short. NdFeB magnets with high coercivity (UH grade) so the knee stays above the demagnetization temperature. FEA checks cogging torque and saturation before any hardware exists.

Thermal design sets continuous torque. The magnetic circuit can usually make more torque than the winding can dissipate. I size the continuous rating to a winding hot spot around 130 °C even with Class H insulation, because insulation life halves for every 10 °C above rating. Peak torque is current-limited by the inverter and by the magnet's demagnetization curve, not by thermal mass.

Control. Field-oriented control with maximum-torque-per-ampere below base speed, field weakening above it. Bus voltage sets base speed directly: back-EMF is k_e·ω, so a 48 V bus with k_e = 0.05 V·s/rad runs out of voltage near 900 rad/s. That number decides the gear ratio as much as torque does.

Failure modes I design against. Thermal derating during a sustained squat: detected by winding thermistors plus a copper-loss thermal model, not by waiting for a fault. Demagnetization after a stall at high current and high temperature: detected by a torque-constant drop in the next spin test. Torque ripple from cogging: measured on a dynamometer at low speed. Gear wear and backlash: tracked by position error at the joint output. Each one has a sensor and a threshold before the robot ships.

Curated: · Written: · Reviewed:

Q&A-14How would you design a test protocol for a component that is expected to operate for millions of cycles?

Reported in Tesla Robotics Engineer Interview Questions & Guide 2026

The 90-second answer

First I'd refuse to test "cycles" as an abstract number. Millions of cycles only means something once I know the load at each cycle, the motion (reversals, dwell, velocity), the environment, and which failure modes the design is exposed to. So the protocol starts with a mission profile derived from field data, then maps each failure mode to the stress that drives it.

For an Optimus knee actuator, say: 1.5 Hz walking cadence, 2 hours of motion a day, 10-year life. That's 1.5 × 3600 × 2 = 10,800 cycles/day, 3.9M/year, ~39M cycles over life. "Millions" is 10M–100M depending on the joint.

Then three tiers:

TierSpecimenCyclesWhat it proves
Coupongear tooth, bearing, seal10^7–10^8material/geometry fatigue limit
Actuator rigfull actuator + controller3–5× lifesystem wear-out, control interaction
Robot endurancefull humanoid1× life sampleintegration, thermal, real duty cycle

Coupon tests are cheap and fast; they set the allowables. The actuator rig is where the real protocol lives, because it runs the actual controller against the real torque profile: constant-load rigs miss failures caused by torque ripple, reversals and thermal cycling.

Acceleration and arithmetic

You can't run 39M cycles at 1.5 Hz on one station: that's 7,222 hours, 301 days. Two levers: load acceleration and parallel stations.

For rolling-element fatigue, life scales as (C/P)^p with p = 3 for ball bearings, 10/3 for roller. Testing at 1.5× the equivalent load gives an acceleration factor of 1.5³ = 3.375, so 39M field cycles ≈ 11.6M test cycles. At 2 Hz that's 1,610 hours. Put 12 rigs in parallel and it's 134 hours: under a week. That's the design decision: the protocol is a schedule and a station count, not just a procedure.

For wear modes (gears, seals, bushings) load acceleration is weaker: wear tracks sliding distance and contact pressure, so you accelerate by running faster and hotter, within the material's limits. For each failure mode I state the acceleration model and its validity range; extrapolating a wear test outside its pressure regime is how you get a passing test and a field failure.

Run to failure, not to pass

The rig doesn't stop at 39M cycles and declare pass. It runs to failure or to a defined degradation threshold, and I log the degradation curve. A real trace from a knee harmonic drive:

cycle 0: backlash 0.08°, efficiency 88%, ripple 4% cycle 20M: backlash 0.19°, efficiency 86%, ripple 6% cycle 34M: backlash 0.41°, efficiency 79%, ripple 11% ← flagged cycle 37M: backlash 0.55°, efficiency 71%, ripple 18% ← failure

Failure criteria for that part: backlash > 0.5°, efficiency drop > 10% from baseline, torque ripple > 15%, or any seal leak. That gives a distribution, not a binary.

Fit a Weibull to time-to-failure. Shape β tells you the mode: β ≈ 1 random, β > 2 wear-out. Report B10 life with a lower confidence bound, not a mean. Demonstrating B10 ≥ 39M at 90% confidence needs enough failures to fit: typically 8–12 specimens on test, not one.

What I'd add

HALT first: step-stress a few units in load, speed and temperature until they break, to find the margin and the true limiting failure mode. Then HASS on production units at a fraction of those limits. And instrument at 1 kHz: the interesting failures show up as drift in current ripple weeks before the part breaks.

Curated: · Written: · Reviewed:

Q&A-15How do you handle a scenario where the simulation results do not match physical prototype testing?

Reported in Tesla Robotics Engineer Interview Questions & Guide 2026

The 90-second answer

The simulation is a hypothesis; the prototype is the measurement. When they disagree I don't split the difference or tune the sim until the curves overlap: I localise the disagreement to one model term, decide whether the sim or the hardware is wrong about it, and fix that one.

First, make the comparison valid. A closed-loop sim run against a closed-loop hardware run confounds plant error with controller divergence: the controller reacts to the error and the trajectories separate for reasons that have nothing to do with the model. So I log the commanded joint positions at the control rate on hardware, 1 kHz for a leg, and replay that exact command stream open-loop into the sim. Same inputs, same clock, one variable.

Then quantify per joint and per phase, not as a single number. "Sim is 30% off" tells you nothing. The error signature points at the cause:

SignatureLikely causeTest that isolates it
torque error grows with speed, flips sign with directionCoulomb + viscous friction, gearbox efficiencyconstant-velocity sweeps at several speeds
position lag at direction reversalstiction, backlashslow triangle wave, measure the dead band
error scales with payload, not speedlink mass, CoM, inertiaadd known masses, refit
error only during ground contactcontact stiffness, friction cone, foot geometrydrop tests against a force plate
error grows over the course of a runthermal derating, bus voltage saglog winding temperature and bus voltage alongside torque
uniform phase lag on every jointunmodeled latency: bus, filter, sensorinject a step, measure the delay

Worked example on a knee joint: the sim predicted 12 Nm peak during a swing at 2.5 rad/s; the prototype's torque sensor read 19 Nm. Speed-dependent and sign-dependent, so friction. I fit τ_f = τ_c·sign(q̇) + b·q̇ by least squares across the sweep and got τ_c ≈ 3.1 Nm, b ≈ 0.9 Nm·s/rad; the residual dropped from 7 Nm to about 1.2 Nm. (Illustrative figures.) That is a parameter the model was missing, not a design flaw: the fix is to put the identified friction into the model and add friction feedforward in the controller.

Then the judgement call: which one is right? If the sim's contact model is the mismatch, the sim is wrong and the hardware stands. If the hardware shows something the sim ignores (compliance, backlash, an actuator saturating) the hardware still stands, and the controller or the design has to absorb it. The sim never wins an argument with a prototype; it wins by predicting the next prototype.

Domain randomisation is not an answer here. It makes a policy robust to parameter uncertainty, but it doesn't excuse a wrong nominal plant: torque limits, thermal margin and safety cases are computed off the nominal model, and if the sim says the actuator has headroom while the prototype is at its thermal limit, that mismatch is a safety issue, not a tuning issue.

Last, keep it from recurring. Every hardware test becomes a replay regression case in the sim suite, and I track per-joint sim-vs-real RMS error as a metric. When it crosses a threshold, controller tuning that leans on the sim gets flagged.

The failure mode I watch for is fitting the sim to one trajectory. You get a beautiful match on that test and a model that is wrong everywhere else. Identify parameters on sweeps designed to excite them, then validate on a held-out trajectory you never fitted against.

Curated: · Written: · Reviewed:

Q&A-16Build an inverse kinematics solver. Walk me through your approach, the method you'd pick, and how you'd make it hold up on a real arm.

Reported in Tesla Robotics Engineer Interview Questions & Guide 2026

The 90-second answer

I'd pin the spec first, because it picks the method: how many DOF, is the target a full 6-D pose or position-only, what's the servo rate, what residual counts as converged, and are joint limits hard constraints or soft preferences. On a production arm the answers are roughly 6–7 DOF, full pose, 1 kHz inner loop, sub-millimetre repeatability, limits are hard.

Given that I'd ship a damped-least-squares (Levenberg–Marquardt) Jacobian solver, warm-started from the previous cycle's joint vector, with a fixed iteration budget and step clipping. Not closed-form analytic. Analytic is exact and microsecond-fast, but it only exists for arms with a spherical wrist and intersecting axes, it hands you up to eight solution branches you must filter against limits, and it can't absorb a seventh joint or a link-geometry change without a rewrite. DLS costs one 6×6 solve per iteration (tens of microseconds in NumPy, a few microseconds in hand-written C) and it degrades gracefully at singularities instead of commanding infinite joint velocity.

python import numpy as np

def dls_ik(fk, jac, q0, target, qmin, qmax, iters=100, tol=1e-6, lam0=0.1, sigma_thresh=0.05, dq_max=0.2): q = np.clip(q0, qmin, qmax) for _ in range(iters): e = pose_error(fk(q), target) # 6-vector: dp, axis*angle if np.linalg.norm(e) < tol: return q, True J = jac(q) # 6 x n smin = np.linalg.svd(J, compute_uv=False)[-1] lam = lam0 * max(0.0, 1.0 - (smin / sigma_thresh) ** 2) if smin < sigma_thresh else 0.0 dq = J.T @ np.linalg.solve(J @ J.T + lam**2 * np.eye(6), e) n = np.linalg.norm(dq) if n > dq_max: dq *= dq_max / n # clip, don't saturate joints q = np.clip(q + dq, qmin, qmax) return q, False # caller must handle the miss

A worked trace. Planar 2-link arm, L1 = L2 = 0.5 m, target (0.600, 0.400), λ = 0.1, step clip 0.2 rad, seed q = (0, 0):

iterq (rad)FK position‖e‖ (m)what happened
0(0.000, 0.000)(1.000, 0.000)0.566arm fully extended, σ_min = 0, J is rank 1
1(0.200, 0.100)(0.968, 0.247)0.398raw step 0.32 rad, clipped to 0.2
2(0.169, 0.300)(0.939, 0.310)0.351λ still 0.1, σ_min below threshold

The closed-form answer is q = (−0.177, 1.531) or (1.353, −1.531): elbow-up and elbow-down. Both are valid; which one you get depends entirely on the seed. That is the argument for warm-starting: the previous cycle's posture keeps the arm on one branch instead of flipping elbows mid-trajectory.

Choosing the method.

MethodPer-iteration costLimits / redundancyAt a singularityUse when
Analytic~1 µs, no looppoor: filter branchesexact6-DOF spherical wrist, hard real-time
Jacobian transposeone matvecvia null spacebounded, converges slowlyvery cheap MCUs, force control
DLS / LM6×6 solveyesbounded velocity, biased posedefault for 6–7 DOF arms
CCDO(n), many iterationsclamp onlytolerableanimation, no Jacobian available
QP / whole-body10s–100s µshard constraintsexplicithumanoid whole-body, multiple tasks

Failure modes I'd actually instrument.

  • Singularity. σ_min of J collapses, joint velocities spike. Detect it from the condition number of JJᵀ, damp, and log the event: repeated damping at the same pose means the trajectory planner is routing through a wrist singularity and should be fixed upstream, not in the solver.
  • Unreachable target or local minimum. DLS converges to a pose with residual error and returns happily. Check final ‖e‖ against tolerance and return failure; a solver that silently holds a 3 cm miss is worse than one that refuses.
  • Joint limits. Clipping the step is not the same as respecting limits inside the solve: a joint pinned at its stop still has a live Jacobian column, so the solver keeps pushing into it and the other joints compensate. Zero that column and re-solve, or move to a box-constrained QP.
  • Cycle overrun. Fix the iteration count (3–5 at 1 kHz, not 100) and measure worst case, not mean. One slow solve misses a servo deadline and the joint controller sees a stale setpoint.
  • Model error. The solver converges in model space; the real end-effector misses by the kinematic calibration error. Verify with a wrist camera or fiducial check, not by trusting the solver's own residual.

Curated: · Written: · Reviewed:

Q&A-17How do you implement a real-time Kalman filter for object tracking?

Reported in ai-interview-guides/guides/tesla.md at main · landedjobs/ai-interview-guides

The 90-second answer

A real-time Kalman filter is a scheduling and numerics problem before it is a math problem. I fix the state and model first: for a tracked vehicle in the robot's local ENU frame, constant velocity, state [px, py, vx, vy], so F is 4×4 with dt in the off-diagonal blocks and H is 2×4 picking position. Then the real-time part: every detection carries its own capture timestamp, so I predict to the measurement time, update, and predict forward to the publish time. The filter never updates a state that is stale relative to the measurement, and it never allocates inside the loop: fixed-size Eigen types, a preallocated track pool.

Two guards make it survive contact with real detections: a Mahalanobis gate before the update (χ², 2 DOF, 99% = 9.21) so a mis-detection can't drag the track, and a Joseph-form covariance update so P stays symmetric positive definite in float32 across a long drive.

SensorRatePer-measurement budgetMeasurement model
Camera 2D box → bearing30 Hz~2 ms of a 33 ms frameEKF, nonlinear h, Jacobian per update
Lidar cluster centroid10 Hz~1 mslinear, H picks position
Radar range / range-rate20 Hz~1 msEKF, polar → Cartesian

Update rate is decoupled from publish rate: the planner consumes tracks at 50 Hz, so between measurements I just propagate x = F·x and grow P by Q. That is cheap and honest: uncertainty widens while you're blind, and the next update collapses it.

cpp // C++17, Eigen 3.4. Fixed-size, no heap traffic in the loop. struct KF { using Vec4 = Eigen::Matrix<double,4,1>; using Mat4 = Eigen::Matrix<double,4,4>; using Mat24 = Eigen::Matrix<double,2,4>; Vec4 x; // px, py, vx, vy Mat4 P = Mat4::Identity(); Mat4 F = Mat4::Identity(); Mat24 H; // picks px, py

void predict(double dt, double sigma_a) { F(0,2) = F(1,3) = dt; const double q = sigma_a * sigma_a; // white-noise acceleration PSD Mat4 Q = Mat4::Zero(); Q(0,0) = Q(1,1) = q * dtdtdtdt / 4.0; Q(0,2) = Q(2,0) = Q(1,3) = Q(3,1) = q * dtdtdt / 2.0; Q(2,2) = Q(3,3) = q * dtdt; x = F * x; P = F * P * F.transpose() + Q; }

bool update(const Eigen::Vector2d& z, const Eigen::Matrix2d& R) { const Eigen::Vector2d y = z - H * x; const Eigen::Matrix2d S = H * P * H.transpose() + R; if (y.dot(S.ldlt().solve(y)) > 9.21) return false; // chi2, 2 DOF, 99% const Mat24 K = P * H.transpose() * S.ldlt().solve(Eigen::Matrix2d::Identity()); const Mat4 IKH = Mat4::Identity() - K * H; P = IKH * P * IKH.transpose() + K * R * K.transpose(); // Joseph form x += K * y; return true; } };

A worked step, so the numbers are checkable. dt = 50 ms, σ_a = 3 m/s² (so q = 9), R = 0.09 m² (σ = 0.3 m lidar centroid). Prior x = [0, 0, 10, 0], P = diag(1, 1, 4, 4).

  • Predict: x = [0.5, 0, 10, 0]. F P Fᵀ gives P11 = 1.01, P13 = P31 = 0.20, P33 = 4.0; adding Q (q·dt⁴/4 = 1.41e-5, q·dt³/2 = 5.63e-4, q·dt² = 0.0225) gives P11 = 1.0100, P13 = 0.2006, P33 = 4.0225.
  • Measurement z_x = 0.52: innovation y = 0.02, S = P11 + R = 1.1000, S⁻¹ = 0.9091.
  • Gain K = P Hᵀ S⁻¹ = [0.9182, 0, 0.1823, 0]: the position entry is 0.918, the velocity entry 0.182.
  • Update: x = [0.5 + 0.9182·0.02, 0, 10 + 0.1823·0.02, 0] = [0.5184, 0, 10.0036, 0].
  • Covariance: P11 = (1 − 0.9182)·1.0100 = 0.0826, a 12.2× drop. P33 moves only 4.0225 → 3.9859: one position fix barely informs velocity, which is why a single measurement never confirms a track.
  • Gate: d² = 0.02² / 1.1000 = 3.6e-4, far under 9.21, so the update is accepted.

Where it breaks, and what I do about it

  • Maneuvers. A constant-velocity model lags truth by roughly ½·a·t² during a sustained turn: 1.5 m after 1 s at 3 m/s², which blows past the gate and drops the track. I switch to an IMM with a coordinated-turn model, or inflate Q when the normalized innovation squared stays above ~4 for three consecutive updates.
  • Out-of-sequence measurements. Lidar and camera arrive on different buses; a measurement older than the current state must not be applied backwards. Either buffer 100–200 ms and run a fixed-lag smoother, or drop it: silently applying it corrupts P.
  • Mis-association. Gating alone isn't enough in clutter. Hungarian assignment on the Mahalanobis cost, then M-of-N track confirmation (3 of 5) before a track is published to the planner, and a miss counter for deletion.
  • Numerics. In float32, P loses symmetry after a few thousand updates. Joseph form plus an explicit P = 0.5·(P + Pᵀ) every N steps; if I need more, a square-root filter on the Cholesky factor.
  • Nonlinearity. Radar range/bearing is not linear in Cartesian state: EKF with an analytic Jacobian is fine at 20 Hz; if bearing uncertainty is large near the sensor, a UKF with 9 sigma points costs about 3× the flops and behaves better.

The thing I'd say last: the model is a choice, not a truth. I'd log innovation and NIS per track in the vehicle's data recorder, because a filter that is quietly overconfident looks perfect in the demo and fails in the one scene that matters.

Curated: · Written: · Reviewed:

Q&A-18Write a C++ function to implement a circular buffer for sensor data.

Reported in ai-interview-guides/guides/tesla.md at main · landedjobs/ai-interview-guides

The 90-second answer

First I'd pin down the contract, because it decides the implementation. For a sensor stream on a robot the usual shape is one producer (the driver thread or DMA callback that timestamps each sample) and one consumer (the control loop), fixed capacity known at compile time, and a policy for what happens when the consumer falls behind: drop the newest sample or overwrite the oldest. I default to drop-newest for control input: a control loop wants a contiguous, gap-free window, and silently losing the oldest sample corrupts the window it's about to integrate. Overwrite-oldest is right for "latest value" telemetry, and it's a different, harder implementation.

With single-producer/single-consumer and a power-of-two capacity, the buffer needs no lock at all:

cpp // C++20, checked with g++ 13.2 -O2 on x86-64 and clang 17 on aarch64 #include <atomic> #include <array> #include <cstddef>

template <typename T, std::size_t N> class SpscRing { static_assert(N && (N & (N - 1)) == 0, "capacity must be a power of two"); alignas(64) std::atomicstd::size_t head_{0}; // producer-owned alignas(64) std::atomicstd::size_t tail_{0}; // consumer-owned alignas(64) std::array<T, N> buf_{}; public: bool push(const T& v) noexcept { const std::size_t h = head_.load(std::memory_order_relaxed); const std::size_t t = tail_.load(std::memory_order_acquire); if (h - t == N) return false; // full: drop newest buf_[h & (N - 1)] = v; head_.store(h + 1, std::memory_order_release); return true; } bool pop(T& out) noexcept { const std::size_t t = tail_.load(std::memory_order_relaxed); const std::size_t h = head_.load(std::memory_order_acquire); if (h == t) return false; // empty out = buf_[t & (N - 1)]; tail_.store(t + 1, std::memory_order_release); return true; } };

Three details carry the correctness. head_ and tail_ are free-running size_t counters that wrap: unsigned overflow is well-defined in C++, so h - t stays the true occupancy across the wrap and no modulo bookkeeping is needed. The release store on head_ publishes the slot write; the acquire load on the consumer side makes it visible. And alignas(64) keeps the two counters off one cache line: without it the producer's store invalidates the consumer's line on every push.

A trace. IMU at 1 kHz, control loop at 200 Hz draining 5 samples per tick, N = 1024. Producer pushes samples 0…1023; head_ = 1024, tail_ = 0, h - t == N, so push 1024 returns false and the sample is dropped and counted. Consumer pops: t = 0, h = 1024, reads buf_[0], stores tail_ = 1. After 1024 pops, tail_ = 1024 = head_, empty. Producer pushes sample 1024 into buf_[1024 & 1023] = buf_[0]: the slot the consumer just released.

Sizing. 1 kHz × 16-byte sample = 16 kB/s. N = 1024 is 16 KiB, about one second of history. The consumer drains 1000/s against a 1000/s source: zero margin, so any scheduling hiccup accumulates. A 20 ms preemption at 1 kHz is 20 samples; 1024 gives roughly 50× that, which is the number I'd defend in review.

PolicyWhen fullCostUse
drop-newestpush returns falsenone, lock-freecontrol input
overwrite-oldestproducer advances tail_races the consumer's read of the slotlatest-value telemetry
mutex-guardedblocks~20–40 ns uncontended, priority inversion riskmulti-producer

Failure modes. Overwrite-oldest in a lock-free SPSC ring is not the same code with one line changed: the producer would write a slot the consumer may be mid-copy of, which is a data race. Either guard each slot with a per-slot sequence counter (seqlock) or take a mutex: don't hand-wave it. Dropping the acquire on the consumer load lets the compiler or CPU hoist the slot read above the head_ check, and you read a slot that was never written; it reproduces as one corrupted sample every few hours under load, which is the worst kind of bug to find on a robot. A non-power-of-two capacity turns the mask into a division: fine at 100 Hz, real at 1 kHz across 30 joints. And if the consumer ever stalls long enough to fill the buffer, push returning false is a signal you must count and surface, not ignore: a silent drop rate is a control loop running on stale data.

Curated: · Written: · Reviewed:

Q&A-19Implement a function to detect the intersection of two 3D bounding boxes.

Reported in ai-interview-guides/guides/tesla.md at main · landedjobs/ai-interview-guides

The 90-second answer

Pin down the input before writing code: oriented boxes (centre, three half-extents, a rotation) not axis-aligned ones, because a car at 30° of yaw has an AABB that overlaps half the lane. Closed intersection: touching counts. Output is a boolean; if the caller needs penetration depth, say so now, because that changes the return type.

Then the method: the separating axis theorem. Two convex bodies are disjoint if and only if there is some axis onto which their projections do not overlap. For a pair of OBBs you only need to test 15 candidate axes: the 3 face normals of A, the 3 of B, and the 9 cross products of A's edges with B's edges. The first axis that separates proves disjointness, so the common case (no collision) exits after one or two dot products.

python import numpy as np

def obb_intersect(cA, eA, RA, cB, eB, RB, eps=1e-6): """cA,cB: (3,) centres. eA,eB: (3,) half-extents. RA,RB: (3,3) rotation matrices whose COLUMNS are the box axes. True if the boxes overlap or touch. Checked against Python 3.11 / numpy 1.26.""" R = RA.T @ RB # R[i,j] = dot(uA_i, uB_j) AbsR = np.abs(R) + eps # eps keeps near-parallel edge pairs honest t = cB - cA tA = RA.T @ t # translation expressed in A's frame

for i in range(3):         # 3 face normals of A
    if abs(tA[i]) > eA[i] + eB @ AbsR[i, :]:
        return False

tB = RB.T @ t
for j in range(3):         # 3 face normals of B
    if abs(tB[j]) > eB[j] + eA @ AbsR[:, j]:
        return False

for i in range(3):         # 9 edge-edge cross products
    i1, i2 = (i + 1) % 3, (i + 2) % 3
    for j in range(3):
        j1, j2 = (j + 1) % 3, (j + 2) % 3
        ra = eA[i1] * AbsR[i2, j] + eA[i2] * AbsR[i1, j]
        rb = eB[j1] * AbsR[i, j2] + eB[j2] * AbsR[i, j1]
        if abs(tA[i2] * R[i1, j] - tA[i1] * R[i2, j]) > ra + rb:
            return False
return True

A trace that shows why AABBs are not enough. A is a unit cube at the origin, identity rotation, so it occupies [-1,1]³. B is a unit cube rotated 45° about z, centred at (2.2, 2.2, 0). B's AABB is [0.786, 3.614] in both x and y, which overlaps A's AABB on [0.786, 1] × [0.786, 1]: a naive AABB test reports a collision. SAT does not: B's own x axis is (0.707, 0.707, 0), so tB[0] = 2.2·0.707 + 2.2·0.707 = 3.111, while the projected radii sum to eB[0] + eA·AbsR[:,0] = 1 + 1.414 = 2.414. The gap is 0.697, the boxes are separated, and the function returns on the fourth test. The nearest corner of B is (0.786, 2.2), which is 1.2 m clear of A in y.

What breaks it.

  • Parallel edges. When two edges are parallel their cross product is the zero vector, which cannot separate anything, but floating-point noise in R can make the test fire spuriously. The + eps on AbsR biases every test toward reporting intersection, which is the safe direction for collision checking.
  • Touching. > versus >= decides whether boxes that share a face collide. For a planner you usually want a margin anyway, so inflate the half-extents by the clearance rather than relying on the comparison.
  • Degenerate extents. A zero-thickness box (a ground patch, a 2D footprint) still works, but with e = 0 the eps term is the only thing preventing a false separation on the parallel axis.
  • Drifted rotations. If RA comes from a quaternion integrated over thousands of steps, renormalise it; a non-orthonormal R silently changes every projection.

Cheaper and more general options. Tesla's perception boxes are 7-DoF (x, y, z, yaw, l, w, h) because vehicles sit on the ground plane. That collapses the test to 4 axes in the xy plane plus an interval overlap in z, roughly a third of the work. For convex hulls rather than boxes, GJK answers the same boolean for any convex pair and gives distance as a by-product; EPA adds penetration depth. SAT stays cheaper for boxes and hands you the minimum-overlap axis for free, which is what you want if the caller is pushing boxes apart.

At scene scale the narrow phase is never the bottleneck: pairwise over N boxes is O(N²). Broad-phase first: a BVH or sweep-and-prune on x, rebuilt once per planning cycle, then SAT only on candidate pairs. For swept volumes between control steps, substep or use conservative advancement; testing the endpoint poses alone will tunnel a fast box straight through a thin one.

Curated: · Written: · Reviewed:

Q&A-20Design an end-to-end neural network for a humanoid robot (Optimus) to perform a task.

Reported in ai-interview-guides/guides/tesla.md at main · landedjobs/ai-interview-guides

The 90-second answer

"End-to-end" hides the decision that actually matters: where the learned stack stops. I'd assume a factory task (pick a part from a bin, seat it in a fixture) fixed base, known fixture pose, a human on the e-stop. Then I'd draw the boundary at joint position targets, not motor current.

Above the line: one learned model, head and wrist cameras plus proprioception in, a chunk of joint targets out, conditioned on a task embedding. Below the line: a 1 kHz whole-body QP that turns those targets into torques while holding balance, contact and joint limits, plus a hard safety envelope. Nothing learned runs at 1 kHz on a machine this size with people nearby: the policy proposes, the controller disposes.

LayerRateLearnedJob
Vision + policy10 Hz obs → 50 Hz action chunkyestask-conditioned joint targets
Whole-body QP / impedance1 kHznobalance, contact, torque limits
Safety envelope1 kHznoposition/velocity clamps, e-stop

Chunking rather than one action per step is deliberate. Human demos are multimodal, you can come around the left or the right of the part, and a single-step regressor averages the two modes into a collision. A chunk with a generative head (diffusion or flow matching) keeps both.

python

PyTorch 2.4. obs 10 Hz, actions 50 Hz, chunk 16, ~30 body joints.

@torch.no_grad() def act(obs, task): cond = encoder(obs.imgs, obs.proprio, task) # [1, N, 768], once per 100 ms x = torch.randn(1, 16, 30) for _ in range(4): # 4 denoise steps, ~6 ms each x = denoiser(x, cond) return x[:, :8] # execute 8, replan

That budget is the point: 4 × 6 ms = 24 ms of inference inside a 100 ms camera period, and a 16-step chunk at 50 Hz is 320 ms of motion, of which we commit 160 ms. A dropped frame or a slow forward pass doesn't stall the arm mid-seat.

Data and training. Teleop demos first (VR controller or exoskeleton, a few hundred per task variant) behaviour cloning with the generative head. Then RL fine-tune in sim (Isaac Lab) with domain randomisation over link mass ±20%, friction 0.3–1.0, actuator delay 0–20 ms and camera extrinsics, because seating a part is contact-rich and the sim gap lives in contact. Then on-robot practice with an independent success detector, and every human intervention logged as a corrective label. That loop (fleet data, auto-labelled, retrained) is the same shape as the driving data engine, and it's why one backbone with a task embedding beats a per-task network: a new task becomes a data problem, not a code change.

Failure modes I'd watch. Covariate shift: the policy drifts into states no demo covers and never recovers. Detect it as interventions per 100 cycles climbing while success rate holds, fix with DAgger-style relabelling of the intervention states. Contact sim2real: the part jams 2 mm off; detect via force spike at the fixture, widen the randomisation before touching the architecture. Silent success: the policy 'completes' by dropping the part, so the success check must come from fixture sensing or part pose, never from the policy's own output. Latency: a camera stall with no chunk buffer freezes the arm mid-trajectory.

Evaluation is success rate, interventions per 100 cycles, and cycle time p50/p95, on a held-out set of lighting and bin-layout variations, not on the demo distribution.

Curated: · Written: · Reviewed:

Q&A-21Code multi-robot functionality. Walk me through the design and the code you'd write.

Reported in faang-interview-prep/docs/companies/tesla.md at main · jugaldb/faang-interview-prep

The 90-second answer

Pin the assumptions first: N robots on one floor, a fleet coordinator that is reachable but whose network can drop, and humans walking the same aisles. Then split the problem into three layers, because they fail differently:

  1. Local safety and motion: on the robot, no network in the loop. Lidar/bumper stop, velocity obstacles against neighbours in the local costmap.
  2. Coordination: task assignment and right-of-way, on the fleet side. An optimization layer that is allowed to degrade.
  3. Shared state: one map frame, namespaced TF per robot, synchronized clocks.

The rule that decides the whole design: anything whose failure injures a person lives on the robot; anything whose failure only costs throughput lives in the coordinator. A robot must never need a network round trip to stop.

Right-of-way, and why deadlock is the real problem

Two robots meeting in a one-wide aisle is easy. The hard case is a cycle: robot 3 holds segment A and wants B, robot 7 holds B and wants A. Both wait forever. I prevent it rather than detect it, with wait-die on a fixed robot id:

python

Python 3.11. Fleet-side right-of-way over shared floor segments.

Wait-die: a robot only ever waits on a lower-numbered robot, so every wait

edge strictly decreases and no cycle can form.

class RightOfWay: def init(self): self.owner: dict[str, int] = {} # segment -> robot id

def acquire(self, rid: int, seg: str) -> str:
    cur = self.owner.get(seg)
    if cur is None or cur == rid:
        self.owner[seg] = rid
        return "granted"
    return "wait" if rid < cur else "abort"

def release(self, rid: int) -> None:
    for seg in [s for s, o in self.owner.items() if o == rid]:
        del self.owner[seg]

Trace: 3 holds A, wants B; 7 holds B, wants A. 3 < 7, so 3 gets wait and 7 gets abort. 7 releases B, replans around the block, 3 takes B, finishes, releases both, 7 retries and gets them. One replan, no deadlock. The cost is starvation of high ids: bound it by promoting a robot after three aborts, or the same robot loses every contention on a busy floor.

Choosing the mechanism

ApproachGuaranteesCostWhere it belongs
Velocity obstacles / ORCAcollision-free velocity this tick~1 ms for 10 neighboursalways, last layer on the robot
Segment reservation (above)mutual exclusion, deadlock-free5–20 ms coordinator round tripaisles, intersections, chargers
Prioritized MAPFwhole-fleet plans, fast50–500 ms for 20 agentsdispatch, before execution
CBS / MILPoptimal, completeseconds; impractical past ~30 agentsoffline schedule tuning

Task assignment sits on top: an auction where each robot bids travel time plus expected queue delay, re-run every 500 ms with hysteresis so a robot doesn't flip tasks on a 200 ms estimate change.

Failure modes I'd design for

  • Coordinator unreachable. Grants are leases with a 2 s TTL. On expiry the robot stops at its last safe point and re-requests: it never assumes the segment is free, because the previous owner may still be in it.
  • Clock skew. Reservations are timestamped; 50 ms of skew reorders them. Run PTP (IEEE 1588) or a single /clock source, not per-robot wall clocks.
  • TF collisions. Every robot publishes under /robot_<id>/tf; only the fleet map server writes map -> odom. Two robots writing map -> odom is the classic multi-robot bug and it looks like sensor noise.
  • Map drift. Each robot's SLAM drifts independently. Merge with a pose graph and loop closures at fiducials; until merged, inflate other robots' covariance when planning around them.

Sizing check. A segment held 6 s per traversal with requests arriving at 0.4/s has utilization 2.4: the queue grows without bound and the floor gridlocks even with perfect deadlock avoidance. You need roughly 3× the segments, or a dispatcher that batches requests into convoys. Do that arithmetic before writing the coordinator.

Curated: · Written: · Reviewed:

Q&A-22Walk me through how you would approach optimizing code that runs in a resource constrained embedded environment?

Reported in Tesla Interview Questions & Prep (2026) | Orbyt Labs

The 90-second answer

I measure before I touch anything, and I measure the worst case, not the average. On a robot the constraint is almost never throughput: it's a hard deadline per control cycle. A 1 kHz torque loop on a 480 MHz Cortex-M7 has 480,000 cycles per tick; if the loop's worst-case execution time is 510,000, the joint twitches regardless of how good the mean looks. So step one is a cycle-accurate profile: DWT->CYCCNT around each stage, or a GPIO toggle per stage into a scope when the counter itself perturbs timing.

Then I optimize in order of leverage: algorithm and dataflow first, memory and DMA second, instruction selection last. Compiler flags are the last 10%, not the first.

The ladder

LayerWhat I changeTypical winHow I verify
Algorithmdrop a per-sample sqrt/division, decimate a filter, replace an O(n²) search2–10×cycle count per stage
Dataflowmove ADC→RAM copies to DMA, double-buffer, batch CAN frames20–50% of ISR timescope on ISR entry/exit
Numericsfloat→Q15/Q31, reciprocal LUT2–4× on M0/M3, 1.3–2× on M4Ferror bound vs float reference
Memorystruct-of-arrays, align hot data, LUTs in ITCM10–30%cache counters, WCET
Instructionsintrinsics (__SSAT, __CLZ), -O2 vs -O3 vs -Os5–15%same WCET harness

A worked trace

Field-oriented control, 1 kHz, STM32H7 at 480 MHz. Budget 480k cycles. Measured WCET 612k, overrun, and the scope shows the ISR stretching to 700k when a CAN frame lands mid-loop. Representative numbers from a build I've tuned:

  • 180k cycles: memcpy of three ADC buffers inside the ISR. Moved to DMA with half-transfer interrupts → 4k.
  • 95k cycles: two float divisions in the Park and inverse-Park transforms. Replaced with a Q31 reciprocal from a 256-entry LUT plus one Newton step → 22k, relative error under 1e-5.
  • 60k cycles: sqrtf for magnitude, computed every tick but only needed for telemetry at 100 Hz. Decimated → 6k amortized.
  • 40k cycles: linear search over 64 CAN filter entries. Sorted, binary search → 3k.

New WCET 214k cycles, 45% utilization, jitter under 8k cycles. That headroom is the point: it absorbs the next feature without redoing the analysis.

What breaks

Fixed-point is where people get hurt: a Q15 multiply-accumulate overflows silently, and a torque command that saturates the wrong way is a safety event. I bound every intermediate analytically and add a debug build with saturation traps. DMA and cache on the same buffer cause stale reads that only appear under load: I check coherency with a known pattern and a scope trigger, not by hoping. And -O3 can reorder or vectorize a loop whose timing you depended on, so the WCET harness runs on the target with shipping flags on every commit.

When not to do this

If the loop already meets deadline with 30%+ margin and the product is pre-revenue, a week spent chasing 15% is the wrong trade. I optimize when the profile says a deadline is at risk or a feature is blocked, and I write down before/after numbers so the next person doesn't re-litigate it.

Curated: · Written: · Reviewed:

Q&A-23Describe a situation where you had to debug a problem that spanned both software and physical hardware.

Reported in Tesla Interview Questions & Prep (2026) | Orbyt Labs

The 90-second answer

Optimus knee actuator, intermittent overcurrent fault. It fired on fast extension above roughly 120 °/s, only after the joint had been running ten minutes or so, about one move in 300. Firmware logged it as a current spike; the actuator team's dyno data said the motor was healthy. Both were true, which is why it took four days.

The fault lived in the control loop but the trigger lived in the mechanism. Warm grease damps less, so a resonance that was invisible cold sat right at the velocity loop's crossover once the joint was hot.

How I split it

I stopped guessing and made the two sides separable. Same trajectory, same firmware, joint on the bench with a rigid coupling and a reference encoder: no fault. Same joint back on the robot: fault. That put the mechanism in the loop. Then I replayed the identical trajectory in software-in-the-loop with the measured plant model: no fault, because the model had no temperature-dependent damping. So the model was wrong, not the code, but the code had no margin for being wrong.

HypothesisTestResult
Encoder quantization → velocity spikeFFT of velocity error at 1 kHzbroadband floor, no peak
Current loop instabilitystep response, cold vs warmidentical
Mechanical resonancewarm joint, rigid vs original couplingpeak vanishes with rigid coupling
Thermal drift in encoder offsetre-zero after soakmoved 0.02°, not enough

The trace that settled it

1 kHz ring buffer, triggered on the fault, warm joint, 130 °/s command:

t (ms)vel (°/s)current cmd (A)
013041
412844
814158
1211871
1615284 → trip

Growing oscillation at 180 Hz: period 5.5 ms, matching the row spacing. Cold, the same command held a flat 41 A. Gain margin at 180 Hz measured 12 dB cold and 4 dB warm: the grease was doing 8 dB of the stability work.

Fix

Three parts, and I'd argue all three were needed. A notch at 180 Hz in the velocity path, a gain schedule dropping velocity-loop crossover from 60 Hz to 45 Hz above 45 °C, and a stiffer encoder coupling that moved the resonance to 260 Hz, outside the loop's bandwidth. The notch alone would have been fragile: it only works while the resonance stays at 180 Hz, and it moved 15 Hz between cold and hot.

Verification: 2,000 warm cycles on the robot, zero trips; then a cold/warm sweep at 20/45/70 °C to confirm margin at each corner rather than only at the temperature where I found the bug.

The habit I keep: when a fault needs both a warm joint and a fast move to appear, the bug is in the interaction, and the fastest path is an experiment that removes one side entirely rather than more logging on both.

Curated: · Written: · Reviewed:

Q&A-24Design a predictive maintenance system for factory robots.

Reported in Tesla Interview Process 2026: Rounds, Questions & Timeline

The 90-second answer

Two questions before any modelling: which failures actually stop the line, and what telemetry the drives already publish. On a body shop the arms are 6-axis industrial robots on EtherCAT, and the servo drive already streams commanded vs actual torque, following error, motor temperature and DC-bus ripple at the loop rate: typically 1–4 kHz. That is free instrumentation. I exhaust it before I bolt on an accelerometer.

I'd state the goal explicitly: not "predict failure", but convert unplanned stops into planned ones inside an existing PM window, at a false-alarm rate technicians still trust. Those are different objectives and they pick different thresholds.

Build order is three layers, cheapest first:

  1. Physics thresholds on drive signals: overtorque, following error, motor temperature. Explainable, no training data, catches gross faults in week one.
  2. Per-cycle anomaly detection aligned to the motion program. The key move: segment each cycle by program instruction, so cycle 40,000 of weld segment 12 is compared against cycles 1–39,999 of the same segment. A robot repeating an identical path 1,200 times a shift is a controlled experiment you get for free.
  3. Remaining-useful-life models only where there is a known wear path and enough fleet failures to fit one: gearboxes and dress-pack cables, not "the robot".
Failure modeSignalFeatureTypical lead timeAction
Wrist gearbox wearfollowing error at direction reversalsbacklash in encoder counts2–6 weeksswap in next PM window
Dress-pack cable fatiguemotor torque spikes, intermittent following-error excursionscount of torque spikes per cycledaysinspect harness
Servo bearingaccelerometer on wrist, 10 kHzenvelope spectrum at BPFO1–3 weeksschedule swap
Weld-gun tip weartip voltage/current, shuntresistance drift per weldhourstip change
Gripper vacuum padsvacuum decay timeleak ratedaysreplace pad

Backlash is the one I'd build first, because it is measurable from data already there. At a direction reversal the motor turns but the load doesn't move until the backlash is taken up, so following error steps by the backlash amount:

python

per joint, per cycle; fe = cmd_pos - act_pos in encoder counts, fs = 1 kHz

import numpy as np

def backlash_counts(cmd_vel, fe, fs=1000, win_ms=50): w = int(0.001 * fs * 50) rev = np.where(np.diff(np.sign(cmd_vel)) != 0)[0] est = [] for i in rev: before = np.median(fe[max(0, i - w):i]) after = np.median(fe[i:i + w]) est.append(abs(after - before)) return float(np.median(est)) if est else float('nan')

Track that median per robot per week. A gearbox that has gone from 40 to 180 counts of backlash is a planned swap; the same gearbox at 400 counts is a seized joint mid-shift.

The economics set the threshold, not the model. Illustrative plant numbers: a line at 45 JPH with ~$12k contribution per vehicle burns ~$9k per minute stopped. A seized wrist on a critical-path robot is 45–90 minutes of swap plus restart: call it $400k–$800k. A false alarm costs a technician 30 minutes, or $6k if it triggers an early gearbox swap. Break-even precision is roughly 6,000 / 500,000 ≈ 1%. That asymmetry says optimise recall and lead time; precision barely matters until false alarms start consuming parts. It also says a 3-day-lead alert is worth far less than a 3-week one, because only the latter fits a PM window.

Where this breaks. Program changes shift every feature: a re-taught path invalidates the baseline, so version the baseline by program hash and re-baseline on change. Maintenance records are the labels and they are noisy: "replaced gearbox" doesn't say why, so I'd add a mandatory failure-code field and use the removed part's teardown as ground truth. Sensors fall off; a wrist accelerometer reading flat for a week is a fault in the monitor, not a healthy robot, so alert on the sensor's own health. And validate in shadow mode against historical failures before anyone acts on it: report precision at fixed recall and the lead-time distribution, not accuracy on a 0.1%-positive dataset.

Curated: · Written: · Reviewed:

Q&A-25Walk me through the math to size a BLDC motor for a humanoid joint, and explain the root failure modes you'd design against.

Reported in Rejected after 8 rounds on Optimus

The 90-second answer

First I'd pin down the joint's torque-speed profile and duty cycle. For a humanoid knee, say peak torque 150 Nm for 0.2 s, continuous 50 Nm, joint speed 120 °/s. With an 80:1 planetary reducer, the motor sees 1.875 Nm peak and 0.625 Nm continuous, at 1595 rpm peak. That sets the motor's torque constant and current: with Kt = 0.05 Nm/A, peak current is 37.5 A, continuous 12.5 A. Copper loss I²R with 0.1 Ω winding is 140 W peak, 15.6 W continuous: the peak loss is what drives thermal design, so I'd check the motor's thermal resistance and choose a stator with enough copper and cooling to keep the winding under its insulation class limit (155 °C for class F).

Then the root failures: bearings, winding insulation, magnet demagnetization, sensors, and power electronics. I'd design against each with specific margins and monitoring.

Sizing math and trade-offs

The back-EMF constant Ke (V·s/rad) equals Kt in SI. At 1595 rpm (167 rad/s), back-EMF is 0.05 × 167 = 8.35 V. Add resistive drop at peak current: 37.5 A × 0.1 Ω = 3.75 V, plus inductance drop during commutation. So bus voltage must exceed ~12 V plus margin; a 48 V bus gives headroom for field weakening and transient spikes. If I chose a lower Kt for higher speed, current and copper loss rise for the same torque; higher Kt reduces current but increases back-EMF and limits top speed. That's the core trade-off.

Thermal: continuous copper loss 15.6 W. With a thermal resistance junction-to-ambient of 2 °C/W, that's 31 °C rise: fine. But peak 140 W for 0.2 s is adiabatic: winding thermal mass ~50 J/K, so 140 W × 0.2 s = 28 J, rise 0.56 °C. So peak is not the thermal limit; continuous is. The real constraint is the inverter's current rating and the reducer's torque limit.

Root failure modes and design against them

FailureRoot causeDesign/mitigationDetection
Bearing wearRadial load from belt/gear, inadequate lubricationPreload, sealed bearings, specify L10 life > 20,000 hVibration FFT, temperature
Winding insulation breakdownThermal cycling, voltage spikes from long cablesClass F insulation, snubbers, limit dV/dtInsulation resistance, leakage current
Magnet demagnetizationOvercurrent or overtemp (standard NdFeB > 150 °C)Thermal model, current limit, stator temperature sensorBack-EMF drop, torque loss
Hall sensor failureVibration, thermal stressRedundant sensors, sensorless FOC backupCommutation error, current spike
MOSFET shoot-throughDead-time too short, gate drive failure500 ns dead time, desaturation detectionCurrent sense, fault flag
Capacitor degradationRipple current, temperatureDerate 20%, 105 °C capsESR measurement, ripple voltage

For a Tesla humanoid, I'd also run an FMEA and set test profiles: thermal cycling from -20 to 80 °C, 10 million cycles at continuous torque, vibration per ISO 16750-3. The math says the motor is thermally limited at continuous torque, so the design margin goes into cooling and current limiting, not peak torque.

Curated: · Written: · Reviewed:

Curated: · Written: · Reviewed: