code wiki / (root) / nx_robot_control_gate.nx

nx_robot_control_gate.nx

buildroot/runtime/nx_robot_control_gate.nx

5062 B102 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic robot
docsdependenciesstructsconstsfunctions

about

nx_robot_control_gate.nx -- R-ROBO-2 GATE: closed-loop "true control" + never-brick safety clamp. Drives a plant from position 0 to setpoint 1000 (milli-units) with a constant load disturbance, using only the sovereign no-float P-controller reading the (simulated) position sensor. VERIFIES: (1) CLOSED LOOP CONVERGES to the setpoint within tolerance (it actually controls). (2) it climbed from 0 (reached the target region). (3) OPEN LOOP (fixed feed-forward, no feedback) does NOT converge -> feedback does the real work. (4) NEVER-BRICK clamp: even at a huge error the commanded actuator output never exceeds UMAX. (5) clamp has teeth: the UNCLAMPED command at that error WOULD exceed UMAX. (6) HONEST: P-control leaves a small, measured steady-state error (~ load*100/Kp) -- not "perfect". 100% sovereign, integer-only. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_robot_control.nx nx_robot_control_gate.nx

imports: nx_syscalls.nxnx_robot_control.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap sw sys_write run_closed ctl_p plant_step abs_i sn sys_write ↻ sys_mmap ↻ check sw ↻ run_open plant_step ↻ ctl_p_raw sys_exit

structs

none

consts

none

functions

14func sw(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: checkmain calls 1: sys_write
15func sn(v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
26func check(name: *u8, cond: i64, tot: *i64) -> i64
called by 1: main calls 1: sw
33func abs_i(v: i64) -> i64 { if v < 0 { return 0 - v } return v }
called by 1: main
35func main() -> i64