The Challenge
On brake disc production lines, FANUC robots pick up raw castings and place them in CNC machines. Each disc has characteristic ribs, ventilation holes, and asymmetries that must be precisely oriented relative to the machine chuck. Previously, operators aligned discs manually or relied on a simple single-point sensor — resulting in poor repeatability, longer cycle times, and increased scrap rates. The Keyence LK-H150 laser collects distance profiles at 200 Hz, but raw data contains noise, artifacts, and out-of-range values (-500). Flat disc profiles without distinct features must be recognized and rejected rather than producing a false positioning result. The system must operate in real time, communicating with the FANUC robot controller via the SRTP protocol and 25 hardware registers. Additional challenge: supporting multiple stations with different lasers (dynamic active sensor selection via register R[66]) and different disc types requiring individual parameters.
The Solution
I designed and implemented a complete positioning server as a standalone application packaged into a single .exe file with no external dependencies. Built on Clean Architecture with clear domain, application, and infrastructure layers. The core is a library of 49 positioning algorithms across 7 categories — from simple rib detection through derivative analysis and Savitzky-Golay filtering to Gaussian fitting and pattern correlation. Each algorithm processes the distance profile from the Keyence laser and returns a rotation angle with a confidence score. The system automatically compares results from all algorithms and selects the best one based on scoring that considers profile contrast, signal-to-noise ratio, and detected feature prominence. Flat profile detection and edge trimming eliminate false positives. Communication with the FANUC robot via SRTP protocol across 25 registers (R[40]-R[66]) — the server reads scan parameters and writes results. Register R[66] enables dynamic selection of the active laser from multiple sensors connected to the station. Operator interface (React 19 + TypeScript) with live measurement preview, filterable history, interactive profile chart (uPlot), and algorithm comparison table with historical measurement replay. Report export to PDF and CSV. Dual database: local SQLite for autonomous station operation, optional PostgreSQL for centralized history. Everything packaged by PyInstaller into a single exe — zero installation on the production machine.
Tech stack
Gallery






