diff --git a/artifacts/runtime/all-sensor-articulated-20260531-232349/sweep/kiyo-pro-stream-proof-frustum.json b/artifacts/runtime/all-sensor-articulated-20260531-232349/sweep/kiyo-pro-stream-proof-frustum.json new file mode 100644 index 0000000..7f02862 --- /dev/null +++ b/artifacts/runtime/all-sensor-articulated-20260531-232349/sweep/kiyo-pro-stream-proof-frustum.json @@ -0,0 +1,974 @@ +{ + "anchor_sources": [ + "nw-builtin-cam", + "nw-eye-1" + ], + "calibration_id": "stream-proof-kiyo-move-trails", + "confidence": 0.38533796485912397, + "kind": "mimir.stream_proof_frustum_solve.v1", + "mean_reprojection_error_clip": 0.19939056464550242, + "notes": [ + "Nightwing observations define a provisional local witness space, not metric room truth.", + "This receipt is sufficient for an AR trail demo and for feeding Starfire's global residual owner." + ], + "p90_reprojection_error_clip": 0.26962808670417515, + "projection_matrix_row_major": [ + 0.5603854754837644, + 0.0709332080849531, + -0.6933933020955221, + 0.3171526880627816, + 0.3738208616609618, + 0.0561101033966434, + -0.4674286445600272, + 0.21108074938204147, + -0.6259304629690188, + -0.08663561418442428, + 0.7750518214173021, + -0.35105121067042333 + ], + "source_id": "kiyo-pro", + "trail_samples": [ + { + "controller_id": "move-00-06-f5-23-e2-d1", + "event_index": 20, + "observed_time_s": 0.033, + "projected_clip": [ + -0.8791482127998971, + -0.6066291124324684 + ], + "reprojection_error_clip": 0.07789712730612666, + "symbol": 1, + "target_clip": [ + -0.9444828908940552, + -0.5642104575636535 + ], + "world": [ + 0.4550057224032302, + 0.6613541854298968, + 0.8046129734614623 + ] + }, + { + "controller_id": "move-00-06-f5-23-e2-d1", + "event_index": 27, + "observed_time_s": 2.233, + "projected_clip": [ + -0.9154298669408274, + -0.5760080124454962 + ], + "reprojection_error_clip": 0.4690605686458582, + "symbol": 9, + "target_clip": [ + -0.7556513826938969, + -0.13499933562594735 + ], + "world": [ + 0.033348114133089884, + 0.6975472074310756, + 0.65 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 28, + "observed_time_s": 2.6, + "projected_clip": [ + -0.9185633092390114, + -0.5750655247275896 + ], + "reprojection_error_clip": 0.15874776468969756, + "symbol": 0, + "target_clip": [ + -0.9363872634671003, + -0.7328094927569586 + ], + "world": [ + 0.0041766661628288735, + 0.7725870357505362, + 0.65 + ] + }, + { + "controller_id": "move-00-06-f5-23-e2-d1", + "event_index": 29, + "observed_time_s": 2.867, + "projected_clip": [ + -0.9260785801883394, + -0.596413299484144 + ], + "reprojection_error_clip": 0.200158835041353, + "symbol": 1, + "target_clip": [ + -0.9445605572080013, + -0.7957170269218321 + ], + "world": [ + 0.32284454318040456, + 0.4619966154697807, + 0.7579122257472921 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 30, + "observed_time_s": 3.2, + "projected_clip": [ + -0.8898776246689383, + -0.6123385984762059 + ], + "reprojection_error_clip": 0.07240698311732986, + "symbol": 10, + "target_clip": [ + -0.9101514644339245, + -0.542827860993879 + ], + "world": [ + 0.28920004042113495, + 0.5079393807890763, + 0.7066163923237218 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 31, + "observed_time_s": 3.567, + "projected_clip": [ + -0.9000567798091308, + -0.6148720976321779 + ], + "reprojection_error_clip": 0.777490090222322, + "symbol": 0, + "target_clip": [ + -0.6828053183097521, + 0.13164825900272215 + ], + "world": [ + 0.2680836575541342, + 0.471977039229198, + 0.7001388424560799 + ] + }, + { + "controller_id": "move-00-06-f5-23-e2-d1", + "event_index": 33, + "observed_time_s": 4.167, + "projected_clip": [ + -0.8779285775344889, + -0.6146778486430794 + ], + "reprojection_error_clip": 0.09225946233566872, + "symbol": 1, + "target_clip": [ + -0.9039751868344301, + -0.5261714503746893 + ], + "world": [ + 0.36334302658413453, + 0.3889902333047959, + 0.8420843623228649 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 34, + "observed_time_s": 4.5, + "projected_clip": [ + -0.9092291167212068, + -0.5816488797088724 + ], + "reprojection_error_clip": 0.03951123542718797, + "symbol": 0, + "target_clip": [ + -0.9098846739301969, + -0.542143083049035 + ], + "world": [ + 0.009749415525593542, + 0.6673228643800554, + 0.65 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 36, + "observed_time_s": 5.167, + "projected_clip": [ + -0.8817661539245883, + -0.6110060402802908 + ], + "reprojection_error_clip": 0.0886057865162101, + "symbol": 2, + "target_clip": [ + -0.9286732819662155, + -0.6861772232099388 + ], + "world": [ + 0.33415087318268727, + 0.6496052956550742, + 0.6903241734431382 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 37, + "observed_time_s": 5.433, + "projected_clip": [ + -0.8751423826142312, + -0.6041824478532443 + ], + "reprojection_error_clip": 0.11409315508228601, + "symbol": 0, + "target_clip": [ + -0.9304745302126936, + -0.7039602082950007 + ], + "world": [ + 0.45316445225409335, + 0.6062798455030484, + 0.8393111061502192 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 38, + "observed_time_s": 5.767, + "projected_clip": [ + -0.9121771547885212, + -0.5781053069814432 + ], + "reprojection_error_clip": 0.09983524711291265, + "symbol": 2, + "target_clip": [ + -0.9265350242970326, + -0.6769027166097978 + ], + "world": [ + 0.609675289783359, + 0.34021461444946643, + 0.9026787718356276 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 40, + "observed_time_s": 6.367, + "projected_clip": [ + -0.8959235843748068, + -0.6256146683483831 + ], + "reprojection_error_clip": 0.051028029930010044, + "symbol": 0, + "target_clip": [ + -0.9276389712261381, + -0.6655895864272035 + ], + "world": [ + 0.8826714570859733, + 0.5392283577296262, + 1.328993426455828 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 42, + "observed_time_s": 7.067, + "projected_clip": [ + -0.883800743412245, + -0.6635784311162672 + ], + "reprojection_error_clip": 0.07561633040717448, + "symbol": 4, + "target_clip": [ + -0.9241648869292207, + -0.5996365407595694 + ], + "world": [ + 1.1595388539412725, + 0.4550406449370771, + 1.507202568465726 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 43, + "observed_time_s": 7.367, + "projected_clip": [ + -0.9030896995965859, + -0.6286030984903708 + ], + "reprojection_error_clip": 0.022980680619030688, + "symbol": 0, + "target_clip": [ + -0.9231890369722976, + -0.6397443874091275 + ], + "world": [ + 1.1527282933111536, + 0.6576468060465407, + 1.5753242169168749 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 46, + "observed_time_s": 8.333, + "projected_clip": [ + -0.8920112178015882, + -0.6211088664030723 + ], + "reprojection_error_clip": 0.19944796024875366, + "symbol": 0, + "target_clip": [ + -0.9442578861301885, + -0.8135920461771753 + ], + "world": [ + 0.6384832079695005, + 0.4840156230570471, + 1.1023804322541753 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 47, + "observed_time_s": 8.6, + "projected_clip": [ + -0.8489473779280677, + -0.6762854404303741 + ], + "reprojection_error_clip": 0.1632032790256483, + "symbol": 2, + "target_clip": [ + -0.9464346405094111, + -0.8071729643550012 + ], + "world": [ + 0.6970990556791745, + 0.329574101269274, + 1.0866790844103376 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 49, + "observed_time_s": 9.2, + "projected_clip": [ + -1.0285725490193087, + -0.7143971407752353 + ], + "reprojection_error_clip": 0.12337732330109946, + "symbol": 0, + "target_clip": [ + -0.9464523276271589, + -0.8064744623232056 + ], + "world": [ + 0.6887408177515418, + 0.6394429045344123, + 1.0887264765612734 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 50, + "observed_time_s": 9.567, + "projected_clip": [ + -0.8698485679409191, + -0.6427100166819155 + ], + "reprojection_error_clip": 0.1763502202820252, + "symbol": 2, + "target_clip": [ + -0.6977071414613234, + -0.6044121122602797 + ], + "world": [ + 0.7691338366691284, + 0.29601729783049663, + 1.182692183465037 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 53, + "observed_time_s": 10.533, + "projected_clip": [ + -0.9018050496836351, + -0.5731543310414312 + ], + "reprojection_error_clip": 0.04281434317495741, + "symbol": 2, + "target_clip": [ + -0.9057157753202718, + -0.530518967708888 + ], + "world": [ + 0.57947030897418, + 0.4706213241689075, + 0.9326802462812758 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 54, + "observed_time_s": 10.833, + "projected_clip": [ + -0.8898930934349799, + -0.5995856004959185 + ], + "reprojection_error_clip": 0.05556232211998459, + "symbol": 8, + "target_clip": [ + -0.9062240800808523, + -0.5464774983406233 + ], + "world": [ + 0.51506950349516, + 0.5692203595565103, + 0.8109681758119446 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 55, + "observed_time_s": 11.1, + "projected_clip": [ + -0.8741357545087254, + -0.6102822490863554 + ], + "reprojection_error_clip": 0.0645932338290411, + "symbol": 0, + "target_clip": [ + -0.9247110599290244, + -0.6504621487643867 + ], + "world": [ + 0.4513024696409307, + 0.7376766663950891, + 0.800416735751318 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 58, + "observed_time_s": 12.067, + "projected_clip": [ + -0.8866664014082294, + -0.6055672830035839 + ], + "reprojection_error_clip": 0.07003679467256954, + "symbol": 0, + "target_clip": [ + -0.9268458569889106, + -0.6629324637079774 + ], + "world": [ + 0.4062225195173447, + 0.61479708544503, + 0.7217816215365251 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 59, + "observed_time_s": 12.4, + "projected_clip": [ + -0.892241900111704, + -0.603971329314553 + ], + "reprojection_error_clip": 0.13779381162298, + "symbol": 2, + "target_clip": [ + -0.9367396678307217, + -0.7343825373820103 + ], + "world": [ + 0.3571730654892108, + 0.5261903461314121, + 0.6776073803226678 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 61, + "observed_time_s": 13.0, + "projected_clip": [ + -0.8043932843500028, + -0.5805875426080629 + ], + "reprojection_error_clip": 0.019826885547670595, + "symbol": 0, + "target_clip": [ + -0.8009087201951087, + -0.6001058213019144 + ], + "world": [ + 0.1797211808864931, + 0.37892897928910096, + 0.65 + ] + }, + { + "controller_id": "move-00-06-f5-23-e2-d1", + "event_index": 65, + "observed_time_s": 14.333, + "projected_clip": [ + -0.8832210844654748, + -0.6059298663489588 + ], + "reprojection_error_clip": 0.18341108308730059, + "symbol": 3, + "target_clip": [ + -0.9399513409600255, + -0.7803469050731591 + ], + "world": [ + 0.44653243548773597, + 0.6575104816930223, + 0.7678145864005145 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 66, + "observed_time_s": 14.6, + "projected_clip": [ + -0.8777541328483115, + -0.6028486146424588 + ], + "reprojection_error_clip": 0.06542609637672571, + "symbol": 2, + "target_clip": [ + -0.8194560878744526, + -0.5731516107645838 + ], + "world": [ + 0.5619443945980792, + 0.6947250397079097, + 0.8886367971364307 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 67, + "observed_time_s": 14.9, + "projected_clip": [ + -0.8625906951234988, + -0.5908285584967105 + ], + "reprojection_error_clip": 0.18577528385909853, + "symbol": 0, + "target_clip": [ + -0.7653894936990006, + -0.4325112109489362 + ], + "world": [ + 0.6426053924027949, + 0.6707582369077036, + 1.0040654809284173 + ] + }, + { + "controller_id": "move-00-06-f5-23-e2-d1", + "event_index": 68, + "observed_time_s": 15.3, + "projected_clip": [ + -2.2663833035107785, + -2.809173078604754 + ], + "reprojection_error_clip": 2.388473968136785, + "symbol": 3, + "target_clip": [ + -0.9481037279192214, + -0.8174535057117172 + ], + "world": [ + 0.7246153786313193, + 0.6049966747934538, + 1.1063266209861007 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 70, + "observed_time_s": 15.867, + "projected_clip": [ + -0.8984133025341523, + -0.6292194199389068 + ], + "reprojection_error_clip": 0.13343836911709187, + "symbol": 0, + "target_clip": [ + -0.8732830217808946, + -0.7602700488648746 + ], + "world": [ + 0.8385173905382965, + 0.555482702096492, + 1.2698392877053206 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 72, + "observed_time_s": 16.533, + "projected_clip": [ + -0.9148242847714224, + -0.6399850966234948 + ], + "reprojection_error_clip": 0.12753698854316933, + "symbol": 4, + "target_clip": [ + -0.9378794295402615, + -0.7654209118691748 + ], + "world": [ + 0.8635471681605983, + 0.6352995545118262, + 1.2687620973655969 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 73, + "observed_time_s": 16.867, + "projected_clip": [ + -0.8760411502219222, + -0.5988847382013688 + ], + "reprojection_error_clip": 0.13507757121024097, + "symbol": 0, + "target_clip": [ + -0.933536689362441, + -0.7211149031484831 + ], + "world": [ + 0.41236094269201246, + 0.5397936969675786, + 0.825820427334146 + ] + }, + { + "controller_id": "move-00-06-f5-23-e2-d1", + "event_index": 75, + "observed_time_s": 17.467, + "projected_clip": [ + -0.903340599763464, + -0.6303650411336879 + ], + "reprojection_error_clip": 0.20720220280662172, + "symbol": 5, + "target_clip": [ + -0.7516724588482482, + -0.48919306133869234 + ], + "world": [ + 0.9432673823220241, + 0.6117644769316547, + 1.3653914805543814 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 76, + "observed_time_s": 17.767, + "projected_clip": [ + -0.9027230298404102, + -0.6291532158283146 + ], + "reprojection_error_clip": 0.10071720614334483, + "symbol": 0, + "target_clip": [ + -0.9076838351042494, + -0.5285582555944377 + ], + "world": [ + 1.0883868765493652, + 0.6385656643376638, + 1.510684307660253 + ] + }, + { + "controller_id": "move-00-06-f5-23-e2-d1", + "event_index": 77, + "observed_time_s": 18.1, + "projected_clip": [ + -0.9082387252370533, + -0.633363133417485 + ], + "reprojection_error_clip": 0.09422712588796978, + "symbol": 3, + "target_clip": [ + -0.9321207271148934, + -0.7245135653386456 + ], + "world": [ + 1.0619416429624824, + 0.6683402084484671, + 1.4686792077572435 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 78, + "observed_time_s": 18.4, + "projected_clip": [ + -0.9942869231406407, + -0.6988450009097289 + ], + "reprojection_error_clip": 0.11027251484298344, + "symbol": 6, + "target_clip": [ + -0.916533418018064, + -0.6206502442380093 + ], + "world": [ + 0.9816783424197918, + 0.7455904767968399, + 1.3474595456643215 + ] + }, + { + "controller_id": "move-00-06-f5-23-e2-d1", + "event_index": 80, + "observed_time_s": 19.1, + "projected_clip": [ + -0.8785683062175577, + -0.6097114606676594 + ], + "reprojection_error_clip": 0.3628899897733025, + "symbol": 3, + "target_clip": [ + -0.5846915282229066, + -0.3968134004765196 + ], + "world": [ + 0.41881465381109717, + 0.7226933783722339, + 0.7519369374773618 + ] + }, + { + "controller_id": "move-00-06-f5-23-e2-d1", + "event_index": 81, + "observed_time_s": 19.333, + "projected_clip": [ + -0.8932511314502098, + -0.6037520476763464 + ], + "reprojection_error_clip": 0.13293231016296111, + "symbol": 7, + "target_clip": [ + -0.7744566796393737, + -0.5440957210694841 + ], + "world": [ + 0.34750765402133443, + 0.5140347326274995, + 0.65 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 84, + "observed_time_s": 20.367, + "projected_clip": [ + -0.9264590537850987, + -0.5674051845866467 + ], + "reprojection_error_clip": 0.20745348465809058, + "symbol": 8, + "target_clip": [ + -0.9412811984659236, + -0.7743284851688801 + ], + "world": [ + 0.5381849048555366, + 0.31113920079120627, + 0.8713142228967515 + ] + }, + { + "controller_id": "move-00-06-f5-23-e2-d1", + "event_index": 86, + "observed_time_s": 20.933, + "projected_clip": [ + -0.8850352008282428, + -0.6108277258700181 + ], + "reprojection_error_clip": 0.07246762430534573, + "symbol": 3, + "target_clip": [ + -0.9203842200243604, + -0.5475663362683563 + ], + "world": [ + 0.32064344013221785, + 0.5416996368882029, + 0.7261494284007469 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 88, + "observed_time_s": 21.567, + "projected_clip": [ + -0.8977740322776363, + -0.5866412821502801 + ], + "reprojection_error_clip": 0.1326307676872254, + "symbol": 0, + "target_clip": [ + -0.9335627450982306, + -0.7143522392837531 + ], + "world": [ + 0.07287154042005796, + 0.5043399466076959, + 0.65 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 90, + "observed_time_s": 22.2, + "projected_clip": [ + -0.8516938020059152, + -0.6340310849012898 + ], + "reprojection_error_clip": 0.1452344534397858, + "symbol": 10, + "target_clip": [ + -0.9377982109191558, + -0.7509886722210304 + ], + "world": [ + 0.4286425016628102, + 0.15758458672020956, + 0.8835444797205171 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 92, + "observed_time_s": 22.833, + "projected_clip": [ + -1.1391530490524377, + -0.31677894317620464 + ], + "reprojection_error_clip": 0.7694778761150074, + "symbol": 4, + "target_clip": [ + -0.5564758057338148, + 0.1857978489153852 + ], + "world": [ + 0.14581880087821925, + 0.6547361298960647, + 0.65 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 94, + "observed_time_s": 23.5, + "projected_clip": [ + -0.8863054461747846, + -0.6070023453414959 + ], + "reprojection_error_clip": 0.05064624328537799, + "symbol": 0, + "target_clip": [ + -0.9107211464225807, + -0.5626298815792541 + ], + "world": [ + 0.38462487786099325, + 0.679415452265829, + 0.65 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 95, + "observed_time_s": 23.833, + "projected_clip": [ + -0.875546889160156, + -0.6095742765677072 + ], + "reprojection_error_clip": 0.0634080516617856, + "symbol": 4, + "target_clip": [ + -0.8814875216911486, + -0.5464451240256734 + ], + "world": [ + 0.4706267631687632, + 0.7687956996487649, + 0.7988522080649928 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 97, + "observed_time_s": 24.467, + "projected_clip": [ + -0.8913821754038934, + -0.5727151063669901 + ], + "reprojection_error_clip": 0.05878488166116981, + "symbol": 0, + "target_clip": [ + -0.9051403152577566, + -0.5155628894399165 + ], + "world": [ + 0.6961734789759012, + 0.5309183036694326, + 1.02593811442535 + ] + }, + { + "controller_id": "move-00-07-04-a6-be-5f", + "event_index": 98, + "observed_time_s": 24.733, + "projected_clip": [ + -0.9058656156323933, + -0.6288377637637487 + ], + "reprojection_error_clip": 0.0793974925899308, + "symbol": 4, + "target_clip": [ + -0.9082828111193328, + -0.5494770745306905 + ], + "world": [ + 0.850371341740017, + 0.6138649309005824, + 1.2779753956216187 + ] + }, + { + "controller_id": "move-00-06-f5-23-e2-d1", + "event_index": 99, + "observed_time_s": 25.1, + "projected_clip": [ + -0.8951972439648934, + -0.6740433369149873 + ], + "reprojection_error_clip": 0.17177748270940166, + "symbol": 3, + "target_clip": [ + -0.9132210766281885, + -0.5032140507193694 + ], + "world": [ + 1.005210138900337, + 0.5338681642707513, + 1.365657849584086 + ] + } + ], + "truth_status": "provisional_witness_space", + "used_points": 47 +} \ No newline at end of file diff --git a/artifacts/runtime/all-sensor-articulated-20260531-232349/sweep/kiyo-pro-stream-proof-trails.png b/artifacts/runtime/all-sensor-articulated-20260531-232349/sweep/kiyo-pro-stream-proof-trails.png new file mode 100644 index 0000000..6b28019 Binary files /dev/null and b/artifacts/runtime/all-sensor-articulated-20260531-232349/sweep/kiyo-pro-stream-proof-trails.png differ diff --git a/config/mimir-runtime.stream-proof.local.json b/config/mimir-runtime.stream-proof.local.json new file mode 100644 index 0000000..9b3dc6d --- /dev/null +++ b/config/mimir-runtime.stream-proof.local.json @@ -0,0 +1,131 @@ +{ + "bufferSeconds": 5.0, + "audioSync": { + "mode": "passive", + "referenceSourceId": "asio-ch2", + "calibrationGain": 0.0, + "watermarkGain": 0.0, + "complexContourChannelModelPath": "../calibration/bioacoustic/complex-contour-channel-model.json", + "enableComplexContourRuntime": true + }, + "streams": [ + { + "sourceId": "focusrite-asio", + "displayName": "Starfire Scarlett ASIO", + "kind": "Audio", + "origin": "LocalDevice", + "enabled": true, + "adapter": "asio", + "command": "../native/asio_capture/build/Release/mimir_asio_capture.dll", + "sampleRate": 192000, + "acceptSourceIds": [ + "asio-ch0", + "asio-ch1", + "asio-ch2", + "asio-ch3" + ], + "sourceLabels": { + "asio-ch0": "Shotgun hero mic", + "asio-ch1": "Cardioid hero mic", + "asio-ch2": "Raven program loopback L", + "asio-ch3": "Raven program loopback R" + } + }, + { + "sourceId": "leap-stereo-ir", + "displayName": "LeapUVC stereo IR / depth root", + "kind": "Video", + "origin": "LocalDevice", + "enabled": true, + "adapter": "ks-camera", + "command": "../native/camera_capture/build/Release/mimir_camera_capture.dll", + "pathNeedle": "vid_f182&pid_0003&mi_00", + "width": 640, + "height": 240, + "inputFormat": "YUY2", + "pixelFormat": "LeapStereoIr", + "minimumFramesPerSecond": 100.0, + "queueDepth": 8 + }, + { + "sourceId": "kiyo-pro-rgb", + "displayName": "Kiyo Pro AR program view", + "kind": "Video", + "origin": "LocalDevice", + "enabled": true, + "adapter": "ks-camera", + "command": "../native/camera_capture/build/Release/mimir_camera_capture.dll", + "pathNeedle": "vid_1532&pid_0e05&mi_00", + "width": 640, + "height": 480, + "inputFormat": "YUY2", + "pixelFormat": "YUY2", + "minimumFramesPerSecond": 25.0, + "queueDepth": 8 + }, + { + "sourceId": "raven-display", + "displayName": "Raven screen capture", + "clockDomainId": "raven-sync", + "kind": "Video", + "origin": "Network", + "enabled": true, + "adapter": "ffmpeg-rawvideo", + "command": "ffmpeg", + "width": 1920, + "height": 1080, + "pixelFormat": "Bgra8", + "arguments": [ + "-hide_banner", + "-nostdin", + "-loglevel", + "warning", + "-fflags", + "nobuffer", + "-flags", + "low_delay", + "-i", + "srt://0.0.0.0:5200?mode=listener&latency=120000&timeout=5000000", + "-an", + "-f", + "rawvideo", + "-pix_fmt", + "bgra", + "-" + ] + }, + { + "sourceId": "raven-realtk-loopback", + "displayName": "Raven Realtek loopback", + "clockDomainId": "raven-sync", + "kind": "Audio", + "origin": "Network", + "enabled": true, + "adapter": "ffmpeg-pcmaudio", + "command": "ffmpeg", + "sampleRate": 48000, + "channels": 2, + "sampleFormat": "Float32", + "blockFrames": 960, + "arguments": [ + "-hide_banner", + "-nostdin", + "-loglevel", + "warning", + "-fflags", + "nobuffer", + "-f", + "f32le", + "-ar", + "48000", + "-ac", + "2", + "-i", + "srt://0.0.0.0:5202?mode=listener&latency=120000&timeout=5000000", + "-f", + "f32le", + "-" + ] + } + ] +} diff --git a/docs/implementation-plan.md b/docs/implementation-plan.md index 49f9920..6e4b06a 100644 --- a/docs/implementation-plan.md +++ b/docs/implementation-plan.md @@ -486,10 +486,15 @@ a named invariant that the native runtime cannot protect yet. histories through the existing Feature evidence path. Synthetic smoke `--move-controller-overlay-smoke` proves two independent controller histories become one valid FieldEvidence claim/candidate without claiming 6DoF pose. - `config/mimir-runtime.move-stream.local.json` names the first show profile: - Kiyo Pro program view, both PS3 Eyes as Move trackers, Scarlett ASIO channels - labeled as shotgun/cardioid/Raven loopback, and Raven screen capture on SRT - port 5200. + `config/mimir-runtime.stream-proof.local.json` names the current stream-proof + profile: Kiyo Pro AR program view, Leap stereo IR depth root, Raven screen + capture on SRT port 5200, Raven Realtek loopback as decoded f32 PCM on SRT + port 5202, and Scarlett ASIO channels labeled as shotgun/cardioid/local + Raven loopback evidence. Nightwing PS3 Eyes no longer appear as Starfire raw + video sources in this proof; they publish compact Eye/Move observations. + `MimirFfmpegPcmAudioStreamSource` is the network PCM audio owner for Raven + Realtek loopback. `config/mimir-runtime.move-stream.local.json` remains a + local/raw-Eye show reference, not the current split-host authority. The distributed authority split is now explicit: Nightwing owns the local PS3 Eye USB reads, PS Move Bluetooth/HID link, LED schedules, device timestamps, and compact marker/feature extraction receipts. Starfire owns diff --git a/docs/move-controller-stream.md b/docs/move-controller-stream.md index cf4fe1c..80b81d0 100644 --- a/docs/move-controller-stream.md +++ b/docs/move-controller-stream.md @@ -81,7 +81,31 @@ correctly drops the result to `InsufficientWitnesses`. ## Runtime Profile -For the ASAP MVP stream, use the narrower Leap/Eyes/Kiyo Pro profile: +For the current stream-proof demo, use the corrected Starfire/Nightwing/Raven +profile: + +```powershell +E:\Projects\Mimir\scripts\start-stream-proof.ps1 +``` + +This profile keeps Nightwing raw Eye pixels off Starfire. Starfire ingests local +Scarlett ASIO, local Leap stereo IR, local Kiyo Pro RGB, Raven screen capture, +and Raven Realtek loopback PCM. Nightwing publishes compact Eye/Move +observations through `/eve/periwinkle`; those observations are calibration and +overlay evidence, not raw media ownership. + +The profile declares: + +- `leap-stereo-ir`: LeapUVC stereo IR / depth root. +- `kiyo-pro-rgb`: Kiyo Pro AR program view. +- `raven-display`: Raven screen capture over SRT port `5200`, in the + `raven-sync` clock domain. +- `raven-realtk-loopback`: Raven Realtek render loopback as f32 PCM over SRT + port `5202`, also in `raven-sync`. +- `focusrite-asio`: Starfire hero mics plus local Raven/program loopback lanes + on `asio-ch0..asio-ch3`. + +For the narrower Leap/Eyes/Kiyo Pro bring-up path, use: ```powershell E:\Projects\Mimir\scripts\start-mvp-leap-eyes-kiyo.ps1 @@ -140,9 +164,30 @@ On Raven, start screen capture from the logged-in desktop session: E:\Projects\Mimir\scripts\start-raven-screen-capture-sender.ps1 -TargetHost 192.168.1.66 -Port 5200 ``` -Route Raven program audio into the Scarlett path that appears on -`asio-ch2/asio-ch3`. That audio is the timing witness that earns the -`raven-sync` correction for `raven-display`. +Start Realtek render loopback from the same logged-in desktop session: + +```powershell +E:\Projects\Mimir\scripts\raven-audio.ps1 -TargetHost 192.168.1.66 -Port 5202 +``` + +If Raven program audio is also routed into Starfire Scarlett on +`asio-ch2/asio-ch3`, that remains the strongest local timing witness. The +Realtek loopback is now a real network PCM audio source in Mimir, not generic +stdout bytes. + +## Kiyo AR Trail Receipt + +The first offline proof that the Kiyo view can accept Move trails is: + +```powershell +& 'C:\Users\Meta\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe' .\tools\solve_stream_proof_frustum.py .\artifacts\runtime\all-sensor-articulated-20260531-232349\sweep\calibration-observations.json +``` + +That solver uses Nightwing's two matched optical witnesses as a provisional +local witness space, fits the Kiyo Pro observations into it, and writes a +`mimir.stream_proof_frustum_solve.v1` receipt plus an AR trail preview. It is +enough for the stream demo and for Starfire's global residual owner to consume; +it is not final metric room calibration. ## Multiple Move Controllers diff --git a/scripts/raven-audio.ps1 b/scripts/raven-audio.ps1 new file mode 100644 index 0000000..a5fea65 --- /dev/null +++ b/scripts/raven-audio.ps1 @@ -0,0 +1,41 @@ +param( + [string]$TargetHost = "192.168.1.66", + [int]$Port = 5202, + [int]$SampleRate = 48000, + [int]$Channels = 2, + [string]$FfmpegPath = "ffmpeg", + [string]$LogRoot = "C:\Meta\Mimir\logs", + [switch]$DryRun +) + +$ErrorActionPreference = "Stop" + +New-Item -ItemType Directory -Force -Path $LogRoot | Out-Null +$repo = Split-Path -Parent $PSScriptRoot +$timestamp = Get-Date -Format "yyyyMMdd-HHmmss" +$stdoutLog = Join-Path $LogRoot "raven-realtk-loopback-$timestamp.out.log" +$stderrLog = Join-Path $LogRoot "raven-realtk-loopback-$timestamp.err.log" +$endpoint = "srt://${TargetHost}:${Port}?mode=caller&latency=120000" +$captureScript = Join-Path $repo "scripts\wasapi-loopback-capture.ps1" + +$command = "& `"$captureScript`" -Output - -SampleRate $SampleRate -Channels $Channels | & `"$FfmpegPath`" -hide_banner -nostdin -loglevel warning -f f32le -ar $SampleRate -ac $Channels -i pipe:0 -f f32le `"$endpoint`"" + +Write-Host "Raven Realtek loopback sender:" +Write-Host " target: $endpoint" +Write-Host " format: f32le ${Channels}ch ${SampleRate}Hz" +Write-Host " stdout: $stdoutLog" +Write-Host " stderr: $stderrLog" + +if ($DryRun) { + Write-Host $command + exit 0 +} + +Start-Process ` + -FilePath "powershell" ` + -ArgumentList @("-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", $command) ` + -WindowStyle Hidden ` + -RedirectStandardOutput $stdoutLog ` + -RedirectStandardError $stderrLog ` + -PassThru | + ForEach-Object { Write-Host "Started Raven Realtek loopback sender pid=$($_.Id)" } diff --git a/scripts/start-mvp-leap-eyes-kiyo.ps1 b/scripts/start-mvp-leap-eyes-kiyo.ps1 index ebd8e76..7609059 100644 --- a/scripts/start-mvp-leap-eyes-kiyo.ps1 +++ b/scripts/start-mvp-leap-eyes-kiyo.ps1 @@ -72,7 +72,7 @@ if (-not $receiverRunning) { Start-Sleep -Milliseconds 800 } -$remotePublisher = "nohup python3 /tmp/nightwing_typed_witness_publisher.py --url '$WitnessUrl' --track-eyes --interval 0.12 > /tmp/mimir-nightwing-mvp-witness.log 2>&1 &" +$remotePublisher = 'ps -eo pid=,comm=,args= | awk ''$2=="python3" && $0 ~ /\/tmp\/nightwing_typed_witness_publisher.py/ && $0 ~ /--track-eyes/ {print $1}'' | xargs -r kill; nohup python3 /tmp/nightwing_typed_witness_publisher.py --url ''' + $WitnessUrl + ''' --track-eyes --interval 0.12 > /tmp/mimir-nightwing-mvp-witness.log 2>&1 &' ssh $NightwingHost $remotePublisher | Out-Null if ($LASTEXITCODE -ne 0) { throw "Could not start Nightwing typed witness publisher." diff --git a/scripts/start-stream-proof.ps1 b/scripts/start-stream-proof.ps1 new file mode 100644 index 0000000..05aeb28 --- /dev/null +++ b/scripts/start-stream-proof.ps1 @@ -0,0 +1,104 @@ +param( + [switch]$Headless, + [int]$HeadlessWidth = 1280, + [int]$HeadlessHeight = 720, + [string]$CaptureFrame = "", + [string]$NightwingHost = "nightwing", + [string]$WitnessUrl = "ws://192.168.1.66:8796/eve/periwinkle", + [string]$ConfigPath = "E:\Projects\Mimir\config\mimir-runtime.stream-proof.local.json", + [switch]$DryRun +) + +$ErrorActionPreference = "Stop" +$repo = Split-Path -Parent $PSScriptRoot +$logDir = Join-Path $repo "artifacts\runtime\stream-proof" +New-Item -ItemType Directory -Force -Path $logDir | Out-Null + +if ($DryRun) { + Write-Host "MIMIR_RUNTIME_CONFIG=$ConfigPath" + Write-Host "Would stage Nightwing witness tools to $NightwingHost and start --track-eyes publisher at $WitnessUrl" + Write-Host "Would launch: dotnet run --project $repo\src\Mimir.App\Mimir.App.csproj" + Write-Host "Raven screen sender: scripts\start-raven-screen-capture-sender.ps1 -TargetHost 192.168.1.66 -Port 5200" + Write-Host "Raven Realtek sender: scripts\raven-audio.ps1 -TargetHost 192.168.1.66 -Port 5202" + exit 0 +} + +$kiyo = Get-PnpDevice -PresentOnly | Where-Object { $_.InstanceId -match "VID_1532&PID_0E05&MI_00" } | Select-Object -First 1 +$leap = Get-PnpDevice -PresentOnly | Where-Object { $_.InstanceId -match "VID_F182&PID_0003&MI_00" } | Select-Object -First 1 + +if (-not $kiyo) { + throw "Kiyo Pro camera interface is not present. Stream proof needs the Kiyo AR program view." +} + +if (-not $leap) { + throw "LeapUVC camera interface is not present. Replug/wake the Leap before launching this profile." +} + +$nightwingCheck = ssh $NightwingHost "test -e /dev/video2 -a -e /dev/video3 && command -v python3 >/dev/null && echo ok" 2>$null +if ($LASTEXITCODE -ne 0 -or $nightwingCheck -notmatch "ok") { + throw "Nightwing does not expose /dev/video2 + /dev/video3 with python3 available." +} + +scp (Join-Path $repo "tools\nw_eye_cap.py") "${NightwingHost}:/tmp/nw_eye_cap.py" | Out-Null +if ($LASTEXITCODE -ne 0) { + throw "Could not stage nw_eye_cap.py on Nightwing." +} +scp (Join-Path $repo "tools\nw_move_hint.py") "${NightwingHost}:/tmp/nw_move_hint.py" | Out-Null +if ($LASTEXITCODE -ne 0) { + throw "Could not stage nw_move_hint.py on Nightwing." +} +scp (Join-Path $repo "tools\nightwing_typed_witness_publisher.py") "${NightwingHost}:/tmp/nightwing_typed_witness_publisher.py" | Out-Null +if ($LASTEXITCODE -ne 0) { + throw "Could not stage nightwing_typed_witness_publisher.py on Nightwing." +} + +$receiverRunning = Get-CimInstance Win32_Process | + Where-Object { $_.CommandLine -match "Mimir.EveSensorReceiver" -and $_.CommandLine -match "--port 8796" } | + Select-Object -First 1 +if (-not $receiverRunning) { + $receiverOut = Join-Path $logDir "nightwing-witness-receiver.out.log" + $receiverErr = Join-Path $logDir "nightwing-witness-receiver.err.log" + Start-Process -WindowStyle Hidden -FilePath "dotnet" -ArgumentList @( + "run", + "--no-build", + "--project", + (Join-Path $repo "src\Mimir.EveSensorReceiver\Mimir.EveSensorReceiver.csproj"), + "--", + "--port", + "8796", + "--path", + "/eve/periwinkle", + "--source-id", + "nightwing-witness", + "--type", + "cultmesh-observation" + ) -RedirectStandardOutput $receiverOut -RedirectStandardError $receiverErr + Start-Sleep -Milliseconds 800 +} + +$remotePublisher = 'ps -eo pid=,comm=,args= | awk ''$2=="python3" && $0 ~ /\/tmp\/nightwing_typed_witness_publisher.py/ && $0 ~ /--track-eyes/ {print $1}'' | xargs -r kill; nohup python3 /tmp/nightwing_typed_witness_publisher.py --url ''' + $WitnessUrl + ''' --track-eyes --interval 0.12 > /tmp/mimir-nightwing-stream-proof.log 2>&1 &' +ssh $NightwingHost $remotePublisher | Out-Null +if ($LASTEXITCODE -ne 0) { + throw "Could not start Nightwing typed witness publisher." +} + +$env:MIMIR_RUNTIME_CONFIG = $ConfigPath +$args = @("run", "--project", (Join-Path $repo "src\Mimir.App\Mimir.App.csproj")) +if ($Headless) { + $args += "--" + $args += "--headless" + $args += "--headless-width" + $args += "$HeadlessWidth" + $args += "--headless-height" + $args += "$HeadlessHeight" + if ($CaptureFrame) { + $args += "--capture-frame" + $args += $CaptureFrame + } +} + +Write-Host "MIMIR_RUNTIME_CONFIG=$ConfigPath" +Write-Host "Starting stream proof: Leap + Kiyo Pro + Raven screen/audio, Nightwing Eye/Move witness claims" +Write-Host "Raven senders expected: scripts\start-raven-screen-capture-sender.ps1 -TargetHost 192.168.1.66 -Port 5200" +Write-Host "Raven audio expected: scripts\raven-audio.ps1 -TargetHost 192.168.1.66 -Port 5202" +dotnet @args diff --git a/src/Mimir.Runtime/Synchronization/MimirFfmpegPcmAudioStreamSource.cs b/src/Mimir.Runtime/Synchronization/MimirFfmpegPcmAudioStreamSource.cs new file mode 100644 index 0000000..62c0484 --- /dev/null +++ b/src/Mimir.Runtime/Synchronization/MimirFfmpegPcmAudioStreamSource.cs @@ -0,0 +1,168 @@ +using System.Collections.Concurrent; +using System.Diagnostics; + +namespace Mimir.Runtime.Synchronization; + +public sealed record MimirFfmpegPcmAudioStreamSourceOptions( + string Command, + IReadOnlyList Arguments, + int SampleRate, + int Channels, + MimirAudioSampleFormat SampleFormat, + int BlockFrames = 960); + +public sealed class MimirFfmpegPcmAudioStreamSource : IMimirStreamSource +{ + private readonly ConcurrentQueue samples = new(); + private readonly CancellationTokenSource cancellation = new(); + private readonly Process process; + private readonly Task stdoutTask; + private readonly Task stderrTask; + private readonly int blockBytes; + private ulong sequence; + private bool disposed; + + public MimirFfmpegPcmAudioStreamSource( + MimirStreamDescriptor descriptor, + MimirFfmpegPcmAudioStreamSourceOptions options) + { + if (descriptor.Kind != MimirStreamKind.Audio) + { + throw new ArgumentException("Raw FFmpeg PCM sources require an audio descriptor.", nameof(descriptor)); + } + + if (options.SampleRate <= 0 || options.Channels <= 0 || options.BlockFrames <= 0) + { + throw new ArgumentOutOfRangeException(nameof(options), "Raw PCM audio sources require positive sample rate, channels, and block frame count."); + } + + var bytesPerSample = BytesPerSample(options.SampleFormat); + if (bytesPerSample <= 0) + { + throw new ArgumentOutOfRangeException(nameof(options), "Raw PCM audio sources require a known sample format."); + } + + Descriptor = descriptor; + Options = options; + blockBytes = checked(options.BlockFrames * options.Channels * bytesPerSample); + process = StartProcess(options); + stdoutTask = Task.Run(() => ReadStdout(cancellation.Token)); + stderrTask = Task.Run(() => DrainStderr(cancellation.Token)); + } + + public MimirStreamDescriptor Descriptor { get; } + + public MimirFfmpegPcmAudioStreamSourceOptions Options { get; } + + public bool TryRead(out MimirStreamSample sample) + { + return samples.TryDequeue(out sample); + } + + private static Process StartProcess(MimirFfmpegPcmAudioStreamSourceOptions options) + { + var startInfo = new ProcessStartInfo(options.Command) + { + UseShellExecute = false, + RedirectStandardOutput = true, + RedirectStandardError = true, + CreateNoWindow = true, + }; + + foreach (var argument in options.Arguments) + { + startInfo.ArgumentList.Add(argument); + } + + return Process.Start(startInfo) + ?? throw new InvalidOperationException($"Could not start FFmpeg raw PCM source process: {options.Command}"); + } + + private async Task ReadStdout(CancellationToken token) + { + var stream = process.StandardOutput.BaseStream; + while (!token.IsCancellationRequested) + { + var buffer = new byte[blockBytes]; + var offset = 0; + while (offset < buffer.Length) + { + var read = await stream.ReadAsync(buffer.AsMemory(offset, buffer.Length - offset), token).ConfigureAwait(false); + if (read <= 0) + { + return; + } + + offset += read; + } + + var timestampNs = StopwatchTicksToNs(Stopwatch.GetTimestamp()); + samples.Enqueue(new MimirStreamSample( + Descriptor.SourceId, + Descriptor.Kind, + Descriptor.Origin, + timestampNs, + timestampNs, + sequence++, + 0, + buffer.Length, + buffer, + AudioBlock: new MimirAudioBlockDescriptor( + Options.SampleRate, + Options.Channels, + Options.SampleFormat, + Options.BlockFrames, + timestampNs))); + } + } + + private async Task DrainStderr(CancellationToken token) + { + while (!token.IsCancellationRequested) + { + var line = await process.StandardError.ReadLineAsync(token).ConfigureAwait(false); + if (line == null) + { + break; + } + } + } + + private static int BytesPerSample(MimirAudioSampleFormat format) => + format switch + { + MimirAudioSampleFormat.Float32 or MimirAudioSampleFormat.Int32 => 4, + MimirAudioSampleFormat.Int24 => 3, + MimirAudioSampleFormat.Int16 => 2, + _ => 0, + }; + + private static long StopwatchTicksToNs(long ticks) + { + return checked((long)(ticks * (1_000_000_000.0 / Stopwatch.Frequency))); + } + + public void Dispose() + { + if (disposed) + { + return; + } + + disposed = true; + cancellation.Cancel(); + try + { + if (!process.HasExited) + { + process.Kill(entireProcessTree: true); + } + } + catch + { + } + + process.Dispose(); + cancellation.Dispose(); + } +} diff --git a/src/Mimir.Runtime/Synchronization/MimirRuntimeConfiguration.cs b/src/Mimir.Runtime/Synchronization/MimirRuntimeConfiguration.cs index d9cda77..d8c9bb4 100644 --- a/src/Mimir.Runtime/Synchronization/MimirRuntimeConfiguration.cs +++ b/src/Mimir.Runtime/Synchronization/MimirRuntimeConfiguration.cs @@ -255,6 +255,25 @@ public sealed class MimirRuntimeConfiguration stream.StrideBytes))); } + if (string.Equals(stream.Adapter, "ffmpeg-pcmaudio", StringComparison.OrdinalIgnoreCase) + || string.Equals(stream.Adapter, "pcmaudio-process", StringComparison.OrdinalIgnoreCase)) + { + if (string.IsNullOrWhiteSpace(stream.Command)) + { + return null; + } + + return new MimirStreamSourceFactory(descriptor, () => new MimirFfmpegPcmAudioStreamSource( + descriptor, + new MimirFfmpegPcmAudioStreamSourceOptions( + ResolveCommand(stream.Command, configDirectory), + stream.Arguments, + stream.SampleRate, + stream.Channels, + ParseAudioSampleFormat(stream.SampleFormat), + stream.BlockFrames))); + } + if (!string.Equals(stream.Adapter, "process", StringComparison.OrdinalIgnoreCase)) { return null; @@ -324,6 +343,20 @@ public sealed class MimirRuntimeConfiguration _ => MimirVideoPixelFormat.Unknown, }; } + + private static MimirAudioSampleFormat ParseAudioSampleFormat(string value) + { + return string.IsNullOrWhiteSpace(value) + ? MimirAudioSampleFormat.Unknown + : value.Trim().ToUpperInvariant() switch + { + "FLOAT32" or "F32" or "IEEE_FLOAT" => MimirAudioSampleFormat.Float32, + "INT16" or "PCM16" or "S16" => MimirAudioSampleFormat.Int16, + "INT24" or "PCM24" or "S24" => MimirAudioSampleFormat.Int24, + "INT32" or "PCM32" or "S32" => MimirAudioSampleFormat.Int32, + _ => MimirAudioSampleFormat.Unknown, + }; + } } public sealed record MimirStreamSourceFactory( @@ -381,7 +414,7 @@ public sealed class MimirAudioSyncConfig ? fallback.BioacousticWitnessProfileId : BioacousticWitnessProfileId.Trim(), EnableComplexContourRuntime = EnableComplexContourRuntime || fallback.EnableComplexContourRuntime, - }; + }; } private static long StopwatchTicksToNs(long ticks) @@ -426,6 +459,12 @@ public sealed class MimirStreamConfig public int SampleRate { get; set; } = 192_000; + public int Channels { get; set; } = 2; + + public string SampleFormat { get; set; } = "Float32"; + + public int BlockFrames { get; set; } = 960; + public string DriverClsid { get; set; } = ""; public string PathNeedle { get; set; } = ""; diff --git a/state/evidence.jsonl b/state/evidence.jsonl index a9861e3..9c1943b 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -298,3 +298,4 @@ {"ts": "2026-05-31T23:48:00+01:00", "type": "verification", "status": "partial", "note": "Ran an articulated all-sensor sweep from a live Scarlett-derived music plan at artifacts/runtime/all-sensor-articulated-20260531-232349. ASIO loopback channels 2/3 matched 77 chirp events with 0.083/0.292 ms median residuals; Nightwing builtin cam and nw-eye-1 each emitted 100/100 Move observations; Kiyo Pro/Kiyo captured RGB video and offline crunch extracted 47/51 marker observations. tools/crunch_sync_sweep.py wrote 298 total marker observations to calibration-observations.json/csv. Missing witnesses are explicit: nw-eye-0 timed out, Nightwing mic only matched one chirp, Focusrite DShow was unavailable while ASIO succeeded, LeapUVC KS open failed, and Raven/Eve receiver runtime saw no camera textures."} {"ts": "2026-05-31T23:54:00+01:00", "type": "verification", "status": "ok", "note": "The articulated sweep crunch now reports pairwise shared marker events for calibration solve selection. In the 20260531-232349 run: Nightwing builtin cam and nw-eye-1 share 100 events; Kiyo shares 51 with each Nightwing view; Kiyo Pro shares 47 with each Nightwing view; Kiyo and Kiyo Pro share 28. This is enough correspondence substrate for initial multi-view frustum fitting on the sensors that actually saw the Move spheres."} {"ts": "2026-06-01T00:12:00+01:00", "type": "decision", "status": "ok", "note": "Corrected the MVP stream split after user pushback: Starfire should not ingest Nightwing PS3 Eye pixels. The MVP profile now keeps Starfire buffers to local Scarlett ASIO, local Leap stereo IR, and local Kiyo Pro RGB; Nightwing owns PS3 Eye reads and emits compact mimir.move_controller_observation_state.v1 typed witness claims through the /eve/periwinkle CultMesh observation receiver. The launcher refuses to start without LeapUVC enumerated, because Leap is the MVP geometry root."} +{"ts": "2026-06-01T00:07:07+01:00", "type": "decision", "status": "ok", "note": "Stream-proof demo authority is Starfire local Leap/Kiyo/Scarlett plus Raven screen/Realtek loopback as network sources; Nightwing owns raw Eye/Move reads and publishes only compact typed Move observations. Added ffmpeg PCM audio source so Raven Realtek loopback enters Mimir as AudioBlock samples, plus a provisional Kiyo AR trail/frustum receipt generator from articulated sweep observations."} diff --git a/state/map.yaml b/state/map.yaml index 212a36d..38e8193 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -219,6 +219,21 @@ invariants: `nightwing_typed_witness_publisher.py --track-eyes`, so Nightwing publishes compact `mimir.move_controller_observation_state.v1` claims through the `/eve/periwinkle` CultMesh observation receiver. + The stream-proof profile is the live demo cut: + `config/mimir-runtime.stream-proof.local.json` keeps Starfire's canonical + window on local Scarlett ASIO, local Leap stereo IR, local Kiyo Pro RGB, + Raven display over SRT port 5200, and Raven Realtek loopback as decoded + f32 PCM audio over SRT port 5202. `MimirFfmpegPcmAudioStreamSource` owns + that network PCM edge and emits real `MimirAudioBlockDescriptor` samples + instead of generic process bytes. `scripts/start-stream-proof.ps1` stages + Nightwing's compact Eye/Move publisher and keeps only one `--track-eyes` + worker alive; `scripts/raven-audio.ps1` starts the Raven Realtek loopback + sender from the logged-in Raven desktop session. `tools/solve_stream_proof_frustum.py` + turns articulated sweep observations into a provisional Kiyo AR trail + receipt: Nightwing matched views define a temporary local witness space, + Kiyo observations are fit into it, and the output + `mimir.stream_proof_frustum_solve.v1` is calibration evidence for the demo, + not final metric room truth. `MimirMoveControllerTracker` is the first Mimir-native overlay owner for multiple PS Move controllers: it tracks bright sphere observations from PS3 Eye luma frames, keeps a bounded history per `controllerId`, preserves diff --git a/tools/nightwing_typed_witness_publisher.py b/tools/nightwing_typed_witness_publisher.py index 41b41a8..0f6c235 100644 --- a/tools/nightwing_typed_witness_publisher.py +++ b/tools/nightwing_typed_witness_publisher.py @@ -219,6 +219,7 @@ def eye_tracking_observations(args: argparse.Namespace, sequence: int) -> list[b docs: list[bytes] = [] devices = [part for part in args.eye_devices.split(",") if part] for eye_index, device in enumerate(devices): + raw_path = None source_id = f"ps3-eye-{eye_index}" stats_path = f"/tmp/mimir-mvp-{source_id}.json" cap_args = argparse.Namespace( @@ -280,7 +281,7 @@ def eye_tracking_observations(args: argparse.Namespace, sequence: int) -> list[b )) finally: try: - if "raw_path" in locals(): + if raw_path: os.unlink(raw_path) except OSError: pass diff --git a/tools/nw_eye_cap.py b/tools/nw_eye_cap.py index a1fd768..dbc44d9 100644 --- a/tools/nw_eye_cap.py +++ b/tools/nw_eye_cap.py @@ -167,6 +167,7 @@ def yuyv_to_luma(raw: bytes, width: int, height: int, stride: int) -> bytes: def capture(args: argparse.Namespace) -> dict: fd = os.open(args.device, os.O_RDWR | os.O_NONBLOCK) maps: list[mmap.mmap] = [] + stream_stdout = bool(getattr(args, "stdout", False)) out = Path(args.out) if args.out else None if out is not None: out.parent.mkdir(parents=True, exist_ok=True) @@ -203,7 +204,7 @@ def capture(args: argparse.Namespace) -> dict: deadline = start + args.seconds timestamps = [] sequences = [] - frames = sys.stdout.buffer if args.stdout else frames_path.open("wb") # type: ignore[union-attr] + frames = sys.stdout.buffer if stream_stdout else frames_path.open("wb") # type: ignore[union-attr] try: while time.monotonic() < deadline: ready, _, _ = select.select([fd], [], [], 0.25) @@ -222,7 +223,7 @@ def capture(args: argparse.Namespace) -> dict: sequences.append(int(buf.sequence)) xioctl(fd, VIDIOC_QBUF, buf) finally: - if not args.stdout: + if not stream_stdout: frames.close() try: fcntl.ioctl(fd, VIDIOC_STREAMOFF, stream_type) diff --git a/tools/solve_stream_proof_frustum.py b/tools/solve_stream_proof_frustum.py new file mode 100644 index 0000000..0d1e37a --- /dev/null +++ b/tools/solve_stream_proof_frustum.py @@ -0,0 +1,195 @@ +#!/usr/bin/env python3 +"""Build the first stream-proof Kiyo frustum/trail receipt from sweep observations. + +This is intentionally offline and explicit about its authority. Nightwing views +define a provisional canonical witness space from matched Move flashes; Kiyo +observations are fit into that space so we can render an AR trail receipt. The +result is calibration evidence for Starfire, not final room-scale truth. +""" + +from __future__ import annotations + +import argparse +import json +import math +from collections import defaultdict +from pathlib import Path + +import numpy as np +from PIL import Image, ImageDraw + + +COLORS = { + "move-00-07-04-a6-be-5f": (0, 190, 255), + "move-00-06-f5-23-e2-d1": (255, 54, 118), + "move-a": (255, 200, 70), + "move-b": (120, 255, 145), +} + + +def parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("observations_json") + parser.add_argument("--target-source", default="kiyo-pro") + parser.add_argument("--anchor-left", default="nw-builtin-cam") + parser.add_argument("--anchor-right", default="nw-eye-1") + parser.add_argument("--out", default=None) + parser.add_argument("--preview", default=None) + return parser.parse_args() + + +def load_observations(path: Path) -> list[dict]: + data = json.loads(path.read_text(encoding="utf-8")) + return [obs for sensor in data.get("sensors", []) for obs in sensor.get("observations", [])] + + +def by_source_event(observations: list[dict]) -> dict[tuple[str, int], dict]: + return {(str(obs["source_id"]), int(obs["event_index"])): obs for obs in observations} + + +def witness_anchor(left: dict, right: dict) -> np.ndarray: + lx = float(left["clip_x"]) + ly = float(left["clip_y"]) + rx = float(right["clip_x"]) + ry = float(right["clip_y"]) + disparity = lx - rx + vertical = ry - ly + # Provisional Nightwing witness space: two fast/wide views become a stable + # local scaffold until the global room solve owns metric scale. + return np.asarray([ + (lx + rx) * 0.65, + (ly + ry) * 0.45, + float(np.clip(1.60 + disparity * 0.70 + vertical * 0.20, 0.65, 2.80)), + ], dtype=np.float64) + + +def fit_projection(world: np.ndarray, clip: np.ndarray) -> np.ndarray: + rows = [] + for point, uv in zip(world, clip): + x, y, z = point + u, v = uv + rows.append([x, y, z, 1.0, 0.0, 0.0, 0.0, 0.0, -u * x, -u * y, -u * z, -u]) + rows.append([0.0, 0.0, 0.0, 0.0, x, y, z, 1.0, -v * x, -v * y, -v * z, -v]) + _, _, vt = np.linalg.svd(np.asarray(rows, dtype=np.float64)) + matrix = vt[-1].reshape(3, 4) + scale = np.linalg.norm(matrix[2, :3]) + return matrix / scale if scale > 1.0e-9 else matrix + + +def project(matrix: np.ndarray, world: np.ndarray) -> np.ndarray: + homogeneous = np.concatenate([world, np.ones((world.shape[0], 1), dtype=np.float64)], axis=1) + raw = homogeneous @ matrix.T + denom = np.where(np.abs(raw[:, 2]) < 1.0e-9, 1.0e-9, raw[:, 2]) + return raw[:, :2] / denom[:, None] + + +def clip_to_pixel(x: float, y: float, width: int, height: int) -> tuple[float, float]: + return ((x + 1.0) * 0.5 * width, (1.0 - y) * 0.5 * height) + + +def make_preview(path: Path, target: str, matches: list[dict], projection: np.ndarray, preview: Path) -> None: + frame_dir = path.parent / f"{target}-frames" + frames = sorted(frame_dir.glob("frame_*.png")) + if frames: + image = Image.open(frames[len(frames) // 2]).convert("RGB") + else: + image = Image.new("RGB", (1280, 720), (4, 6, 8)) + draw = ImageDraw.Draw(image, "RGBA") + width, height = image.size + groups: dict[str, list[dict]] = defaultdict(list) + for match in matches: + groups[str(match.get("controller_id") or "unknown")].append(match) + for controller, points in groups.items(): + color = COLORS.get(controller, (255, 255, 255)) + observed_pixels = [clip_to_pixel(float(p["target_clip"][0]), float(p["target_clip"][1]), width, height) for p in points] + projected_pixels = [clip_to_pixel(float(p["projected_clip"][0]), float(p["projected_clip"][1]), width, height) for p in points] + if len(observed_pixels) >= 2: + draw.line(observed_pixels, fill=(*color, 210), width=4) + if len(projected_pixels) >= 2: + draw.line(projected_pixels, fill=(*color, 90), width=2) + for observed, projected in zip(observed_pixels, projected_pixels): + ox, oy = observed + px, py = projected + draw.ellipse((ox - 5, oy - 5, ox + 5, oy + 5), fill=(*color, 230)) + draw.line((px - 5, py, px + 5, py), fill=(255, 255, 255, 180), width=1) + draw.line((px, py - 5, px, py + 5), fill=(255, 255, 255, 180), width=1) + preview.parent.mkdir(parents=True, exist_ok=True) + image.save(preview) + + +def main() -> int: + args = parse_args() + path = Path(args.observations_json) + observations = load_observations(path) + lookup = by_source_event(observations) + event_ids = sorted({int(obs["event_index"]) for obs in observations}) + world_points = [] + target_points = [] + matches = [] + for event_id in event_ids: + left = lookup.get((args.anchor_left, event_id)) + right = lookup.get((args.anchor_right, event_id)) + target = lookup.get((args.target_source, event_id)) + if not left or not right or not target: + continue + anchor = witness_anchor(left, right) + target_clip = np.asarray([float(target["clip_x"]), float(target["clip_y"])], dtype=np.float64) + world_points.append(anchor) + target_points.append(target_clip) + matches.append({ + "event_index": event_id, + "controller_id": target.get("controller_id"), + "symbol": target.get("symbol"), + "world": anchor.tolist(), + "target_clip": target_clip.tolist(), + "observed_time_s": target.get("observed_time_s"), + }) + if len(matches) < 6: + raise SystemExit(f"Need at least 6 matched events for a projection solve, found {len(matches)}") + + world = np.vstack(world_points) + target = np.vstack(target_points) + matrix = fit_projection(world, target) + projected = project(matrix, world) + residuals = np.linalg.norm(projected - target, axis=1) + for match, projected_clip, residual in zip(matches, projected, residuals): + match["projected_clip"] = projected_clip.tolist() + match["reprojection_error_clip"] = float(residual) + + mean_error = float(np.mean(residuals)) + p90_error = float(np.percentile(residuals, 90)) + confidence = float(np.clip(1.0 / (1.0 + mean_error * 8.0) * min(1.0, len(matches) / 40.0), 0.0, 1.0)) + document = { + "kind": "mimir.stream_proof_frustum_solve.v1", + "truth_status": "provisional_witness_space", + "source_id": args.target_source, + "anchor_sources": [args.anchor_left, args.anchor_right], + "calibration_id": "stream-proof-kiyo-move-trails", + "used_points": len(matches), + "mean_reprojection_error_clip": mean_error, + "p90_reprojection_error_clip": p90_error, + "confidence": confidence, + "projection_matrix_row_major": matrix.reshape(-1).tolist(), + "notes": [ + "Nightwing observations define a provisional local witness space, not metric room truth.", + "This receipt is sufficient for an AR trail demo and for feeding Starfire's global residual owner.", + ], + "trail_samples": matches, + } + out = Path(args.out) if args.out else path.with_name(f"{args.target_source}-stream-proof-frustum.json") + out.write_text(json.dumps(document, indent=2, sort_keys=True), encoding="utf-8") + preview = Path(args.preview) if args.preview else path.with_name(f"{args.target_source}-stream-proof-trails.png") + make_preview(path, args.target_source, matches, matrix, preview) + print(json.dumps({ + "out": str(out), + "preview": str(preview), + "used_points": len(matches), + "mean_reprojection_error_clip": mean_error, + "p90_reprojection_error_clip": p90_error, + "confidence": confidence, + }, indent=2)) + return 0 if confidence > 0.25 else 1 + + +if __name__ == "__main__": + raise SystemExit(main())