--- license: cc-by-4.0 tags: - robotics - mlp - numpy - obstacle-avoidance - simulation pretty_name: Sim Driving MLP (NumPy) --- # Sim Driving MLP — 279-parameter obstacle-avoidance policy (NumPy) A deliberately tiny neural network: **4 ultrasonic distances in, one driving command out.** 279 parameters, float32, trained and verified entirely inside our robot simulation studio. Small enough to read, small enough to run on an MCU-class device. **Trained on simulation data from a virtual map — no real-world or customer data.** ## Architecture ![Architecture: 4 → 16 → 8 → 6](assets/01_architecture.png) | part | meaning | |------|---------| | input (4) | ultrasonic distances: **F**ront, **L**eft, **R**ight, **B**ack (normalized with the included `norm_mean` / `norm_std`) | | output (5 + 1) | 5 command logits — `FWD / LEFT / RIGHT / STOP / BACK` — plus 1 turning-angle regression head | ## Metrics (validation, virtual map) | metric | value | |--------|-------| | command accuracy | **97.2 %** (best epoch 529 / 572) | | turning-angle MAE | ~6.9° | The `.npz` also embeds `meta_json`: the full 572-epoch training history (per-class accuracy, loss, angle MAE per epoch), so the training curve is inspectable. The plot below is drawn directly from that embedded history: ![Training history](assets/02_training_curve.png) ## Load and run (NumPy only, no framework) ```python import numpy as np d = np.load("sim_driving_mlp.npz") x = np.array([[120.0, 45.0, 200.0, 300.0]]) # F, L, R, B distances (mm) x = (x - d["norm_mean"]) / d["norm_std"] h = np.maximum(x @ d["W0"] + d["b0"], 0) h = np.maximum(h @ d["W1"] + d["b1"], 0) y = h @ d["W2"] + d["b2"] cmd = ["FWD", "LEFT", "RIGHT", "STOP", "BACK"][int(np.argmax(y[0, :5]))] angle = float(y[0, 5]) print(cmd, angle) ``` ## The simulator and the target robot The studio stage where the model's four inputs are defined: ultrasonic sensors F/L/R/B with datasheet-based noise models, checked by the built-in self QA/QC checklist. On the right, the local LLM explains a warning from that checklist, citing the stage report as its basis. ![Sensor definition stage in the simulation studio](assets/05_sim_studio_sensors.png) A driving run on the 8 m × 8 m virtual map used for data collection (green: ultrasonic rays from the robot): ![Driving run on the virtual map](assets/06_virtual_map_run.png) And this exact model running in the studio's 3D evaluation stage. The left panel shows the live inference at the current step: the four sensor inputs (F/L/R/B, mm), the softmax over the five commands with FORWARD selected, and the angle head: ![The model driving in the 3D evaluation stage, with live inference panel](assets/07_nn_eval_3d.png) The target hardware: a tracked test robot with the ultrasonic sensors mounted on the hand, the same F-channel placement the simulator reproduces. ![Tracked test robot with hand-mounted ultrasonic sensors](assets/04_real_robot.jpg) ## Where this fits: our 4-layer stack ![NCDTech 4-layer stack](assets/03_four_layer_stack.png) *(Diagram is in Korean; it is the same figure used on our website, demo video, and companion dataset.)* This model is a **layer-2 artifact** of our stack — an edge neural network verified through the 8-stage physics simulation workflow of our robot simulation studio. Every stage of that workflow runs self QA/QC (layer 3) and reports through an on-premise conversational LLM (layer 4); the record formats those layers produce are shown in our companion dataset: [NCDTech/human-gated-qaqc-knowledge-example](https://huggingface.co/datasets/NCDTech/human-gated-qaqc-knowledge-example) ## 한국어 **초음파 4방향 거리(전·좌·우·후)를 넣으면 주행 명령이 나오는 279 파라미터짜리 작은 신경망**입니다. 저희 로봇 시뮬레이션 스튜디오의 8단계 워크플로(데이터 수집 → 학습 → 평가 → 물리 시뮬레이션 검증)를 통과한 계층 2(엣지 신경망) 산출물이며, **가상 맵 시뮬레이션 데이터로만 학습**했습니다 — 실데이터·고객 데이터 없음. 출력은 주행 명령 5클래스(전진/좌회전/우회전/정지/후진) + 회전각 회귀 1개. 검증 정확도 97.2 %, 각도 오차 약 6.9°. 파일 안에 정규화 통계와 572 에포크 학습 이력 전체가 함께 들어 있어 학습 곡선을 그대로 확인할 수 있습니다. Learn more: https://huggingface.co/NCDTech · https://www.ncdtech.org