Design and Simulation of Devices
Model a Physical AI device in parametric CAD and prove it out in simulation before any hardware: geometry, mechanisms, dynamics, and the design→simulate→improve loop.
▶ Start the course ← All coursesWhere this sits, and what moves it.
Binding constraint · The friction and contact coefficients your simulator was given. Geometry and inertia a twin gets right by construction; the tangential force at a sliding interface is a measured number, and every judgement about whether a mechanism works is downstream of it.
Judging a mechanism meant machining it. The design-build-test cycle set the pace of every device programme, and the cost of a wrong dimension was measured in material and weeks.
The whole loop runs before any hardware, and this course closes it with sim telemetry driving the next revision. The limit is worth stating: friction, tolerance, and contact are where simulators and reality part company, and a device that works only in a simulator has told you about the simulator.
The bridge is a simulator whose contact and friction parameters are identified from the real machine rather than assumed -- the same calibration loop PAI-230 builds by differentiating through the simulator. When a twin's parameters come from telemetry, 'proved out in simulation' starts to mean what it sounds like.
Every hard thing was impossible until the constraint that made it impossible was named. How we read a frontier →
Parametric Thinking & Your First Part
Turn a real-world shape into parametric CadQuery code and export a clean, dimension-correct solid.
- L0Code is the Clay: Primitives & SolidsYou ask for a 52 x 18 x 9 mm solid and the bounding box reads 18 x 52 x 9. What happened?Create a named solid of specified dimensions in real build123d and inspect it in the 3D viewer. Pass = the solid's bounding box matches the target within tolerance.→
- L1Workplanes & Sketches: 2D Becomes 3DYour plate has the right bounding box but a volume of 31500 mm cubed instead of 30369. What is missing?Place a 2D sketch on a workplane and extrude it into a solid, then cut a feature through it. Pass = the resulting build123d Part has the target bounding box AND the target volume (the through-hole removes the right amount of material).→
- L1Your First Parametric PartYou drive a part from named variables and the volume comes back at exactly the box volume. What does that tell you?Drive a real build123d part from named Python variables instead of magic literals, so one number reshapes the whole solid. Pass = result is a 60 x 40 x 8 mm plate with a centered 6 mm through-hole: bounding box within +/-0.1 mm AND volume within +/-1 mm3 of 18973.81 (box volume minus the drilled cylinder), proving the hole is really cut, not faked.→
Parameters, Constraints & Reusable Design
Make one script generate a correct family of parts driven by named, mathematically-related, constrained parameters, verified by an autograder that regenerates the part across many parameter sets and checks that valid ones build correctly while invalid ones are rejected with a reason.
- L1Driven Dimensions & RelationshipsIn a parametric model you change one driving dimension. What happens to the features built from it?Express a part's dimensions as formulas of a single driver parameter so derived dimensions stay consistent when the driver changes - verified by the bench measuring the real OpenCascade bounding box against an exact target.→
- L1Constraints & Valid Ranges: A Part FamilyThe CAD kernel builds and renders your part with no error. Does that mean the part is VALID?Build a real parametric part that lands inside a fixed spec envelope: drive its dimensions so the solid's bounding box and material volume both fall within tolerance of the published datasheet, proving the part is a legal member of the family rather than an out-of-range variant.→
Assemblies & Mechanisms
Combine multiple parts into a constrained assembly with joints that produce correct, intended motion: place independent solids into one shared coordinate frame so mating faces meet exactly; declare a joint that exposes exactly the degree of freedom intended; and chain joints into a linkage whose driven output traces a target path with zero self-collision across its full range.
- L1Locating Parts in SpaceYour assembly's bounding box is 30 mm tall against a 40 mm target. The pin is centred at z equals zero. Where is it?Position parts in a shared coordinate frame with Pos (and Rot when needed) so the combined assembly fills an exact envelope - placing one solid on top of another and grading the bounding box of the fused part within tolerance.→
- L2Joints & Degrees of FreedomA door hinge is a revolute joint. How many degrees of freedom does it allow?Define a joint between two parts and correctly state and realize its allowed motion - revolute vs. prismatic - exposing exactly one intended degree of freedom and no others.→
- L2A Mechanism That MovesYou drive the crank of a four-bar and the rocker flails instead of tracing its path. What is missing?Compose joints into a linkage and sweep the input through its full range to confirm the output traces the target motion path with no self-collision.→
Simulating Your Device's Physics
Take a CAD assembly into a physics simulator and judge whether it works under gravity, friction, and applied force: giving geometry mass, inertia, collision, and gravity so it settles; driving a joint with an actuator to a measured target; and defining a pass/fail metric to deliver a trustworthy verdict.
- L2From CAD Body to Physics BodyYou drop your CAD part into a physics sim. What must be added that the CAD model didn't have?Turn a geometric body into a physics body by giving it the right mass, then simulate on real MuJoCo until the spring-loaded part settles at the spec deflection (-0.10 m).→
- L2Force Balance: Spring vs GravityA 0.5 kg load on a 20 N/m spring sags to −0.245 m; the spec wants −0.10 m. To lift the resting point to −0.10 m you must…Tune the spring stiffness so the spring force balances the load's weight at the target deflection, reading force equilibrium straight off a real simulation.→
- L2Reading the Verdict: Did It Settle?Your simulated device reaches the target value on its first swing. Does hitting the target mean the design passes?Learn that touching the target once is not passing: add damping so the device truly SETTLES (velocity → 0), and read the simulator's settle verdict correctly.→
Iterate, Validate & Optimize + Capstone
Close the design→simulate→improve loop for real: read sim telemetry, form a data-driven hypothesis about which parameter is wrong and which way to move it, and re-simulate a failing device to spec, then take a fresh device brief from a blank file all the way to a physics-validated, optimized, portfolio-ready artifact with a measurable margin beyond target. Competency arc: L2 (Practitioner), closing a full classical design loop.
- L2The Improvement Loop: Measure → Tune → Re-SimYour device overshoots at 18 percent against a 5 percent limit. You raise the actuator proportional gain. What happens?Diagnose a failing device from sim telemetry and adjust the correct parameter(s) in the correct direction to bring it to spec, and prove the change was driven by the measured data, not by guessing.→
- L2Capstone: Design, Simulate, Validate & Optimize a DeviceYour bracket tops out at z equals 14 mm against a 20 mm spec, with the base plate at 10 mm. What is wrong with the boss?Deliver a complete, multi-feature parametric part to an exact spec: a mounting bracket = base plate + cylindrical boss + through-hole. Build it in real build123d on the OpenCascade kernel, then validate it against the spec by reading its bounding box (60 x 40 x 20 mm) and its volume (~20607.4 mm^3). Geometry valid, spec compliant within tolerance.→
Anatomy demonstrations
The machines behind this course, taken apart three ways, the body, the one rule, and the small learned brain. Guess before you look; an open core proves every number on the page.
From the interactive textbook
The ideas under this course as live explorables, each runs the real Rust library and re-derives its own result.