diff --git a/.gitmodules b/.gitmodules index 2b0d1799..376ff602 100644 --- a/.gitmodules +++ b/.gitmodules @@ -21,3 +21,7 @@ [submodule "vendor/rufield"] path = vendor/rufield url = https://github.com/ruvnet/rufield +[submodule "v2/crates/ruview-swarm"] + path = v2/crates/ruview-swarm + url = https://github.com/ruvnet/ruv-drone.git + branch = main diff --git a/examples/through-wall/wiflow_browser.html b/examples/through-wall/wiflow_browser.html index 7a486d8d..72e88119 100644 --- a/examples/through-wall/wiflow_browser.html +++ b/examples/through-wall/wiflow_browser.html @@ -114,7 +114,14 @@
+
+
+ + +
+
camera: off
baseline
@@ -144,6 +151,7 @@
stand still
+
@@ -155,20 +163,39 @@
CSI source
CSI nodes
pose visibility
+
pass / activity— / —
+
this activity samples0
total samples0
+
est. time / samples
last skip reason
+
+ + + +
+ +
+
+ + + +
per-pose coverage (balance the dataset)
A pair is recorded only when BOTH (a) a confident MediaPipe pose (mean visibility > 0.5) AND (b) a fresh live CSI frame (source==esp32) exist. We store the baseline-normalized CSI + the 17 keypoints, mirrored to - IndexedDB so a refresh keeps them. Follow the prompt so every pose bucket fills up — - a balanced set beats 2 000 frames of standing. + IndexedDB so a refresh keeps them. The routine runs multiple interleaved passes + through every activity, so a chronological held-out split contains the same activity mix + as training (fixes the OOD split). Follow the prompt so every pose bucket fills up.
@@ -190,7 +217,8 @@
mean-pose baseline PCK@0.10
- + +
@@ -218,8 +246,11 @@
- no model loaded + +
+
camera: off
+
no model loaded
live inference
@@ -251,8 +282,9 @@ // ============================================================================ // Constants & shared state // ============================================================================ +// wss when served over https (mobile/secure-context safe), else ws; ?ws= overrides const CSI_WS = (new URLSearchParams(location.search)).get('ws') - || `ws://${location.hostname || 'localhost'}:8765/ws/sensing`; + || `${location.protocol === 'https:' ? 'wss' : 'ws'}://${location.hostname || 'localhost'}:8765/ws/sensing`; const NODE_IDS = [9, 13]; // per-node features in this fixed order (matches Python pipeline) const FIELD_LEN = 400; // signal_field.values padded/truncated to 400 const CSI_DIM = 4 + NODE_IDS.length * 3 + FIELD_LEN; // 4 + 6 + 400 = 410 @@ -397,34 +429,70 @@ function onPoseResults(res){ latestKps = kps; latestVis = visSum / N_KP; } +// ONE camera shared across all stages. Each stage has its own +const CAM_STATUSES = ['camStatus','calCamStatus','infCamStatus']; +const CAM_BTNS = ['camBtn','calCamBtn','infCamBtn']; + +function setAllCamStatus(txt){ + for (const id of CAM_STATUSES){ const el = $(id); if (el) el.textContent = txt; } +} +function populateCamSelectors(devs, currentId){ + const opts = devs.map((d,i)=>``).join(''); + for (const id of CAM_SELECTORS){ + const sel = $(id); if (!sel) continue; + sel.style.display = devs.length > 1 ? 'inline-block' : 'none'; + sel.innerHTML = opts; + if (currentId) sel.value = currentId; + } +} + async function startCam(deviceId){ + // remember an explicit choice (so it survives reloads + applies to every stage) + if (deviceId){ try{ localStorage.setItem(CAM_KEY, deviceId); }catch(e){} } if (camStream) camStream.getTracks().forEach(t => t.stop()); const constraints = deviceId ? { video:{ deviceId:{ exact:deviceId } } } : { video:true }; - const st = $('camStatus'); try{ - st.textContent = 'camera: requesting…'; + setAllCamStatus('camera: requesting…'); camStream = await navigator.mediaDevices.getUserMedia(constraints); camEl.srcObject = camStream; await camEl.play().catch(()=>{}); const tr = camStream.getVideoTracks()[0]; - const tick = ()=>{ st.textContent = - `camera: "${tr.label}" ${camEl.videoWidth}x${camEl.videoHeight} ${tr.readyState} ${camEl.paused?'PAUSED':'playing'}`; }; - tick(); setInterval(tick, 1000); - $('camBtn').textContent = 'switch camera ↻'; + const tick = ()=>{ setAllCamStatus( + `camera: "${tr.label || '?'}" ${camEl.videoWidth}x${camEl.videoHeight} ${tr.readyState} ${camEl.paused?'PAUSED':'playing'}`); }; + tick(); + if (camStatusTimer) clearInterval(camStatusTimer); + camStatusTimer = setInterval(tick, 1000); + for (const id of CAM_BTNS){ const b = $(id); if (b) b.textContent = 'switch camera ↻'; } $('recBtn').disabled = !baseline; // still gated on a baseline + // labels are only populated AFTER permission is granted — enumerate now const devs = (await navigator.mediaDevices.enumerateDevices()).filter(d => d.kind === 'videoinput'); - const sel = $('camSel'); sel.style.display = devs.length > 1 ? 'inline-block' : 'none'; - sel.innerHTML = devs.map((d,i)=>``).join(''); - const cur = tr.getSettings().deviceId; if (cur) sel.value = cur; + const cur = (tr.getSettings && tr.getSettings().deviceId) || deviceId || null; + if (cur){ try{ localStorage.setItem(CAM_KEY, cur); }catch(e){} } + populateCamSelectors(devs, cur); initPose(); + refreshGates(); }catch(e){ - $('camBtn').textContent = 'camera error: ' + e.name + - (e.name === 'NotReadableError' ? ' (in use by Zoom/Teams?)' : ''); + // NotReadableError = camera held by Zoom/Teams/IR cam; let the user pick another in any stage + const msg = 'camera error: ' + e.name + + (e.name === 'NotReadableError' ? ' (in use by Zoom/Teams? pick another)' : ''); + for (const id of CAM_BTNS){ const b = $(id); if (b) b.textContent = msg; } + setAllCamStatus(msg); console.error('getUserMedia', e); + // still try to list devices so the user can switch (labels may be blank without a live stream) + try{ + const devs = (await navigator.mediaDevices.enumerateDevices()).filter(d => d.kind === 'videoinput'); + populateCamSelectors(devs, null); + }catch(_){} } } -$('camBtn').addEventListener('click', ()=> startCam()); -$('camSel').addEventListener('change', e => startCam(e.target.value)); +// every stage's enable button + selector drives the same camera +for (const id of CAM_BTNS){ const b = $(id); if (b) b.addEventListener('click', ()=> startCam(localStorage.getItem(CAM_KEY) || undefined)); } +for (const id of CAM_SELECTORS){ const s = $(id); if (s) s.addEventListener('change', e => startCam(e.target.value)); } // ============================================================================ // Drawing helpers @@ -486,14 +554,26 @@ document.querySelectorAll('.step').forEach(s => s.addEventListener('click', ()=> // ============================================================================ const calCtx = $('calCv').getContext('2d'); let calibrating = false; +let calReadyUntil = 0; // wall-clock (performance.now) when the get-ready countdown ends; 0 = not in get-ready let cw = null; // welford accumulators { n, mean:Float64Array, m2:Float64Array, t0 } +function calReadySecs(){ return Math.max(0, Math.min(15, parseInt($('calReady').value) || 5)); } + +// Click → "STEP OUT" + a get-ready countdown so the user can leave the field, +// THEN the actual baseline recording begins (cw allocated at that moment). function startCalibration(){ - if (calibrating) return; + if (calibrating || calReadyUntil) return; + $('calBtn').disabled = true; + const ready = calReadySecs(); + $('calStatus').textContent = 'GET READY — STEP OUT…'; $('calStatus').className = 'v'; + if (ready <= 0){ beginBaselineRecording(); return; } + calReadyUntil = performance.now() + ready * 1000; +} +function beginBaselineRecording(){ + calReadyUntil = 0; cw = { n:0, mean:new Float64Array(CSI_DIM), m2:new Float64Array(CSI_DIM), t0:performance.now() }; calibrating = true; $('calStatus').textContent = 'CALIBRATING…'; $('calStatus').className = 'v'; - $('calBtn').disabled = true; } function welfordUpdate(vec){ cw.n++; @@ -533,14 +613,26 @@ function calibrateLoop(){ const ageS = Math.round((Date.now() - baseline.ts)/1000); $('calAge').textContent = ageS < 60 ? ageS+' s ago' : Math.round(ageS/60)+' min ago'; } - if (calibrating){ + if (calReadyUntil){ + // GET-READY phase: big "STEP OUT" prompt + countdown BEFORE recording starts + const remain = Math.max(0, (calReadyUntil - performance.now())/1000); + $('calBar').style.width = '0%'; + calCtx.fillStyle = '#ffb840'; calCtx.font = 'bold 24px monospace'; calCtx.textAlign='center'; + calCtx.fillText('STEP OUT OF THE ROOM', W/2, H/2-16); + calCtx.fillStyle = '#46e08a'; calCtx.font = 'bold 40px monospace'; + calCtx.fillText(Math.ceil(remain)+'', W/2, H/2+26); + calCtx.fillStyle = '#7d8796'; calCtx.font = '13px monospace'; + calCtx.fillText('baseline recording starts after the countdown', W/2, H/2+54); + calCtx.textAlign='start'; + if (remain <= 0) beginBaselineRecording(); + } else if (calibrating){ const el = (performance.now() - cw.t0) / 1000; $('calBar').style.width = Math.min(100, 100*el/BASELINE_SECONDS) + '%'; // accumulate only fresh live frames; ignore sim so the baseline is real if (freshLiveCSI() && latestCSI.vec){ welfordUpdate(latestCSI.vec); $('calN').textContent = cw.n; } - // draw a centered "STEP OUT" reminder + countdown + // draw a centered "STEP OUT" reminder + progress calCtx.fillStyle = '#ffb840'; calCtx.font = 'bold 22px monospace'; calCtx.textAlign='center'; - calCtx.fillText('STEP OUT OF THE SPACE', W/2, H/2-10); + calCtx.fillText('STAY OUT — CAPTURING BASELINE', W/2, H/2-10); calCtx.fillStyle = '#7d8796'; calCtx.font = '14px monospace'; calCtx.fillText('baseline: '+Math.max(0,Math.ceil(BASELINE_SECONDS-el))+' s · '+cw.n+' frames', W/2, H/2+18); calCtx.textAlign='start'; @@ -561,14 +653,40 @@ function calibrateLoop(){ // STAGE 1 · GUIDED CAPTURE — balanced buckets + coverage meter // ============================================================================ const capCtx = $('capCv').getContext('2d'); -let recording = false; -// pose buckets (the guided routine cycles through these) -const BUCKETS = ['stand still','turn left','turn right','walk left','walk right', +let recording = false, paused = false; +// pose buckets — each activity is its own labeled bucket +const BUCKETS = ['stand still','turn','walk left','walk right', 'arms up','arms down','crouch','sit','reach']; -const SECS_PER_BUCKET = 12; -let bucketIx = 0, bucketT0 = performance.now(); +// guided routine state. The routine runs `passes` full INTERLEAVED passes through the +// activity list: pass1[all activities] → pass2[all activities] → … This spreads every +// activity across the WHOLE time-ordered session, so the chronological 80/20 held-out split +// contains the same activity mix as training (the fix for the -6pp OOD held-out). +let passIx = 0, actIx = 0; // current pass index, current activity index within the pass +let segReadyUntil = 0; // get-ready countdown end for the current segment (0 = recording) +let segT0 = performance.now(); // start of the recording portion of the current segment +let actSampleN = 0; // samples recorded in the current activity segment let covCounts = new Array(BUCKETS.length).fill(0); +function capPasses(){ return Math.max(1, Math.min(8, parseInt($('capPasses').value) || 3)); } +function capSecs(){ return Math.max(4, Math.min(40, parseInt($('capSecs').value) || 12)); } +function capReadySecs(){ return Math.max(0, Math.min(10, parseInt($('capReady').value) || 3)); } +function totalSegments(){ return capPasses() * BUCKETS.length; } +// begin the get-ready countdown for the segment at (passIx, actIx) +function startSegment(){ + const ready = capReadySecs(); + actSampleN = 0; $('capActN').textContent = '0'; + if (ready <= 0){ segReadyUntil = 0; segT0 = performance.now(); } + else { segReadyUntil = performance.now() + ready * 1000; } +} +// advance to the next segment in the interleaved routine; returns false when the routine is done +function nextSegment(){ + actIx++; + if (actIx >= BUCKETS.length){ actIx = 0; passIx++; } + if (passIx >= capPasses()) return false; + startSegment(); + return true; +} + function renderCoverage(){ const max = Math.max(1, ...covCounts); $('cov').innerHTML = BUCKETS.map((b,i)=> @@ -576,24 +694,94 @@ function renderCoverage(){ ``+ `${covCounts[i]}
`).join(''); } +let pausedAt = 0; // performance.now() captured at the moment of pause (used to rebase clocks on resume) +function setCapControls(){ + const live = recording; + $('recBtn').textContent = live ? '◼ stop recording' : '● start guided recording'; + $('recBtn').classList.toggle('ghost', live); + $('pauseBtn').disabled = !live; $('skipBtn').disabled = !live; + $('pauseBtn').textContent = paused ? 'resume' : 'pause'; +} $('recBtn').addEventListener('click', ()=>{ - if (!baseline || !camStream) return; + if (!baseline || !camStream){ return; } recording = !recording; - $('recBtn').textContent = recording ? '◼ stop recording' : '● start guided recording'; - $('recBtn').classList.toggle('ghost', recording); - if (recording){ bucketT0 = performance.now(); } + if (recording){ + paused = false; passIx = 0; actIx = 0; + startSegment(); // begins with a get-ready countdown for pass1/activity1 + } + setCapControls(); +}); +$('pauseBtn').addEventListener('click', ()=>{ + if (!recording) return; + paused = !paused; + // when pausing mid-segment, freeze the clocks so no time is lost; on resume, rebase them + if (!paused){ + if (segReadyUntil) segReadyUntil = performance.now() + (segReadyUntil - pausedAt); + else segT0 = performance.now() - (pausedAt - segT0); + } else { pausedAt = performance.now(); } + setCapControls(); +}); +$('skipBtn').addEventListener('click', ()=>{ + if (!recording) return; + if (!nextSegment()){ recording = false; paused = false; setCapControls(); } }); $('clrBtn').addEventListener('click', async ()=>{ SAMPLES = []; covCounts = new Array(BUCKETS.length).fill(0); await idbPut('samples', []); - $('capN').textContent = '0'; $('trN').textContent = '0'; renderCoverage(); refreshGates(); + $('capN').textContent = '0'; $('trN').textContent = '0'; $('capActN').textContent = '0'; + renderCoverage(); refreshGates(); }); +// ---- Export / Import dataset (so multiple sessions accumulate, and data can be analyzed offline) ---- +$('expBtn').addEventListener('click', ()=>{ + const out = { + format: 'wiflow-browser-dataset', version: 1, exported: new Date().toISOString(), + csi_dim: CSI_DIM, out_dim: OUT_DIM, buckets: BUCKETS, + note: 'csi is baseline-normalized (ADR-151 deviation-from-baseline); kps are 17 COCO keypoints in [0,1] image coords', + samples: SAMPLES.map((s,i)=>({ csi: Array.from(s.csi), kps: Array.from(s.kps), bucket: s.bucket, t: (s.t!=null?s.t:i) })) + }; + const blob = new Blob([JSON.stringify(out)], { type:'application/json' }); + const a = document.createElement('a'); + a.href = URL.createObjectURL(blob); + a.download = `wiflow-dataset-${SAMPLES.length}samples-${Date.now()}.json`; + a.click(); setTimeout(()=>URL.revokeObjectURL(a.href), 2000); +}); +$('impBtn').addEventListener('click', ()=> $('impFile').click()); +$('impFile').addEventListener('change', async (e)=>{ + const file = e.target.files && e.target.files[0]; if (!file) return; + try{ + const txt = await file.text(); + const data = JSON.parse(txt); + const arr = Array.isArray(data) ? data : (data.samples || []); + let merged = 0; + for (const s of arr){ + if (!s || !s.csi || !s.kps) continue; + if (s.csi.length !== CSI_DIM || s.kps.length !== OUT_DIM) continue; // dim guard — never fabricate + SAMPLES.push({ csi: Float32Array.from(s.csi), kps: Float32Array.from(s.kps), + bucket: (s.bucket|0), t: (s.t!=null?s.t:Date.now()) }); + if ((s.bucket|0) < BUCKETS.length) covCounts[s.bucket|0]++; + merged++; + } + $('capN').textContent = SAMPLES.length; $('trN').textContent = SAMPLES.length; + $('capSkip').textContent = `imported ${merged} samples (merged)`; + renderCoverage(); await idbSave(); refreshGates(); + }catch(err){ + $('capSkip').textContent = 'import failed: ' + err.message; + console.error('import', err); + } finally { e.target.value = ''; } +}); + +// MediaPipe throttle: one-in-flight (no backlog) + ~18 Hz cap so the UI never blocks. +let mpLastSend = 0; +const MP_MIN_INTERVAL_MS = 55; // ~18 Hz + function captureLoop(){ const W = $('capCv').width, H = $('capCv').height; drawCameraFrame(capCtx, W, H, 0.9); - if (mpReady && !mpBusy && camEl.videoWidth > 0){ - mpBusy = true; mpPose.send({ image: camEl }).catch(()=>{ mpBusy = false; }); + const nowMs = performance.now(); + if (mpReady && !mpBusy && camEl.videoWidth > 0 && (nowMs - mpLastSend) >= MP_MIN_INTERVAL_MS){ + mpBusy = true; mpLastSend = nowMs; + mpPose.send({ image: camEl }).catch(()=>{ mpBusy = false; }); } if (latestKps) drawSkeleton(capCtx, latestKps, W, H, 'rgba(90,169,255,.95)', 'rgba(90,169,255,.6)'); @@ -602,29 +790,56 @@ function captureLoop(){ $('capNodes').textContent = latestCSI.nodes.length ? latestCSI.nodes.join(', ') : '—'; $('capVis').textContent = latestKps ? latestVis.toFixed(2) : '—'; - if (recording){ - // advance the guided bucket - const el = (performance.now() - bucketT0)/1000; - if (el >= SECS_PER_BUCKET){ bucketIx = (bucketIx+1) % BUCKETS.length; bucketT0 = performance.now(); } - $('prompt').textContent = BUCKETS[bucketIx]; - $('countdown').textContent = `${Math.max(0,Math.ceil(SECS_PER_BUCKET - el))} s · bucket ${bucketIx+1}/${BUCKETS.length}`; + // estimate (always shown): segments × seconds × ~recorded-fps + const segs = totalSegments(); + $('capEst').textContent = `~${Math.round(segs*capSecs()/60*10)/10} min · ${segs} segments`; - let skip = null; - if (!latestKps || latestVis <= 0.5) skip = 'no confident pose'; - else if (!freshLiveCSI()) skip = (latestCSI.source && latestCSI.source!=='esp32') ? 'CSI not esp32 (sim)' : 'no fresh CSI'; - else if (!baseline) skip = 'no baseline'; - if (skip){ $('capSkip').textContent = skip; } - else { - const norm = baselineNorm(latestCSI.vec); // baseline-deviation normalized - SAMPLES.push({ csi: norm, kps: latestKps.slice(), bucket: bucketIx }); - covCounts[bucketIx]++; - $('capSkip').textContent = '—'; - const n = SAMPLES.length; $('capN').textContent = n; $('trN').textContent = n; - if (n % 20 === 0){ renderCoverage(); idbSave(); refreshGates(); } + if (recording && paused){ + $('prompt').textContent = '⏸ PAUSED — ' + BUCKETS[actIx]; + $('countdown').textContent = `pass ${passIx+1}/${capPasses()} · activity ${actIx+1}/${BUCKETS.length}`; + } else if (recording){ + const done = passIx*BUCKETS.length + actIx; // segments completed so far + $('capPass').textContent = `${passIx+1}/${capPasses()} · ${actIx+1}/${BUCKETS.length}`; + $('capProg').style.width = Math.round(100*done/segs) + '%'; + + if (segReadyUntil){ + // GET-READY: "GET INTO FRAME" + countdown, NO samples recorded yet + const remain = Math.max(0, (segReadyUntil - nowMs)/1000); + $('prompt').textContent = 'GET INTO FRAME — ' + BUCKETS[actIx]; + $('countdown').textContent = `starting in ${Math.ceil(remain)} s · pass ${passIx+1}/${capPasses()} · activity ${actIx+1}/${BUCKETS.length}`; + capCtx.fillStyle='#ffb840'; capCtx.font='bold 20px monospace'; capCtx.textAlign='center'; + capCtx.fillText(Math.ceil(remain)+'', W/2, 40); capCtx.textAlign='start'; + if (remain <= 0){ segReadyUntil = 0; segT0 = nowMs; } + } else { + // RECORDING this activity + const el = (nowMs - segT0)/1000; + const secs = capSecs(); + $('prompt').textContent = BUCKETS[actIx]; + $('countdown').textContent = `${Math.max(0,Math.ceil(secs - el))} s · pass ${passIx+1}/${capPasses()} · activity ${actIx+1}/${BUCKETS.length}`; + if (el >= secs){ + if (!nextSegment()){ recording = false; paused = false; setCapControls(); + $('prompt').textContent = 'routine complete ✓'; $('countdown').textContent = `${SAMPLES.length} samples`; } + } else { + let skip = null; + if (!latestKps || latestVis <= 0.5) skip = 'no confident pose'; + else if (!freshLiveCSI()) skip = (latestCSI.source && latestCSI.source!=='esp32') ? 'CSI not esp32 (sim)' : 'no fresh CSI'; + else if (!baseline) skip = 'no baseline'; + if (skip){ $('capSkip').textContent = skip; } + else { + const norm = baselineNorm(latestCSI.vec); // baseline-deviation normalized + SAMPLES.push({ csi: norm, kps: latestKps.slice(), bucket: actIx, t: Date.now() }); + covCounts[actIx]++; actSampleN++; + $('capActN').textContent = actSampleN; + $('capSkip').textContent = '—'; + const n = SAMPLES.length; $('capN').textContent = n; $('trN').textContent = n; + if (n % 20 === 0){ renderCoverage(); idbSave(); refreshGates(); } + } + } } } else { $('prompt').textContent = baseline ? 'ready — press start' : 'calibrate baseline first'; $('countdown').textContent = '—'; + $('capProg').style.width = '0%'; } requestAnimationFrame(captureLoop); } @@ -664,7 +879,7 @@ async function idbDel(key){ } async function idbSave(){ try{ - const flat = SAMPLES.map(s => ({ csi: Array.from(s.csi), kps: Array.from(s.kps), bucket: s.bucket })); + const flat = SAMPLES.map(s => ({ csi: Array.from(s.csi), kps: Array.from(s.kps), bucket: s.bucket, t: s.t })); await idbPut('samples', flat); }catch(e){ console.warn('idbSave', e); } } @@ -672,7 +887,8 @@ async function idbLoad(){ try{ const flat = await idbGet('samples'); if (Array.isArray(flat) && flat.length){ - SAMPLES = flat.map(s => ({ csi: Float32Array.from(s.csi), kps: Float32Array.from(s.kps), bucket: s.bucket||0 })); + SAMPLES = flat.map((s,i) => ({ csi: Float32Array.from(s.csi), kps: Float32Array.from(s.kps), + bucket: s.bucket||0, t: (s.t!=null?s.t:i) })); covCounts = new Array(BUCKETS.length).fill(0); for (const s of SAMPLES) if (s.bucket < BUCKETS.length) covCounts[s.bucket]++; $('capN').textContent = SAMPLES.length; $('trN').textContent = SAMPLES.length; @@ -779,39 +995,62 @@ async function trainModel(){ const xva = tf.tensor2d(Xn.slice(cut*CSI_DIM),[mVal,CSI_DIM]); if (model){ model.dispose(); } + // Reduce overfit (train MSE 0.072 vs val 0.161 in the honest-negative run): + // - L2 weight decay on every Dense layer + // - slightly smaller capacity (384/192/96 vs 512/256/128) + // - keep dropout (raised to 0.35 in the wider layers) + const L2 = tf.regularizers.l2({ l2: 1e-4 }); model = tf.sequential(); - model.add(tf.layers.dense({ inputShape:[CSI_DIM], units:512, activation:'relu' })); - model.add(tf.layers.dropout({ rate:0.3 })); - model.add(tf.layers.dense({ units:256, activation:'relu' })); - model.add(tf.layers.dropout({ rate:0.3 })); - model.add(tf.layers.dense({ units:128, activation:'relu' })); - model.add(tf.layers.dense({ units:OUT_DIM, activation:'sigmoid' })); + model.add(tf.layers.dense({ inputShape:[CSI_DIM], units:384, activation:'relu', kernelRegularizer:L2 })); + model.add(tf.layers.dropout({ rate:0.35 })); + model.add(tf.layers.dense({ units:192, activation:'relu', kernelRegularizer:tf.regularizers.l2({ l2:1e-4 }) })); + model.add(tf.layers.dropout({ rate:0.35 })); + model.add(tf.layers.dense({ units:96, activation:'relu', kernelRegularizer:tf.regularizers.l2({ l2:1e-4 }) })); + model.add(tf.layers.dense({ units:OUT_DIM, activation:'sigmoid', kernelRegularizer:tf.regularizers.l2({ l2:1e-4 }) })); model.compile({ optimizer: tf.train.adam(1e-3), loss:'meanSquaredError' }); - let bestP10 = 0, bestVal = 1e9; + // Early stopping on val MSE: stop after `patience` epochs with no improvement, restore best weights. + const patience = Math.max(5, Math.min(200, parseInt($('trPatience').value)||30)); + let bestP10 = 0, bestVal = 1e9, bestWeights = null, sinceImprove = 0, stoppedEarly = false; + const disposeBest = ()=>{ if (bestWeights){ bestWeights.forEach(w=>w.dispose()); bestWeights = null; } }; $('trMsg').innerHTML = 'Training… on '+(BACKEND_LABEL[tf.getBackend()]||tf.getBackend())+''; await model.fit(xtr, ytr, { epochs, batchSize:64, shuffle:true, verbose:0, callbacks:{ onEpochEnd: async (ep, logs)=>{ - let va=null,p10=null,p05=null,mpj=null; - if (ep % 5 === 0 || ep === epochs-1){ - const pv = model.predict(xva); const pvArr = await pv.data(); pv.dispose(); - let vsum=0; for (let i=0;i w.clone()); + } else { + sinceImprove++; } + $('trEpoch').textContent=(ep+1); $('trLoss').textContent=logs.loss.toFixed(4); $('trBar').style.width=(100*(ep+1)/epochs)+'%'; lossHist.push({ ep, tr:logs.loss, va }); drawLoss(); + + if (sinceImprove >= patience){ + stoppedEarly = true; model.stopTraining = true; + $('trMsg').innerHTML = `Early stop at epoch ${ep+1}: val MSE hasn't improved for ${patience} epochs. Restoring best weights (val ${bestVal.toFixed(4)}).`; + } if (trainStop) model.stopTraining = true; await tf.nextFrame(); }} }); + // restore the best-val weights (early stopping semantics: report the best model, not the last) + if (bestWeights){ model.setWeights(bestWeights); disposeBest(); } + const pvF = model.predict(xva); const pvFArr = await pvF.data(); pvF.dispose(); const fin10 = pckMpjpe(pvFArr,gtVal,mVal,0.10), fin05 = pckMpjpe(pvFArr,gtVal,mVal,0.05); const finPck = Math.max(bestP10, fin10.pck); trainedPck10 = finPck; @@ -829,10 +1068,11 @@ async function trainModel(){ } stageDone.train = true; $('infModelState').textContent = `model ready · held-out PCK@0.10 ${(finPck*100).toFixed(1)}%`; - $('trMsg').innerHTML = 'Done. Saving model to IndexedDB…'; + const stopNote = stoppedEarly ? ' (early-stopped, best weights restored)' : ''; + $('trMsg').innerHTML = 'Done'+stopNote+'. Saving model to IndexedDB…'; xtr.dispose(); ytr.dispose(); xva.dispose(); await saveModel(); - $('trMsg').innerHTML = 'Saved. Go to 3 · INFER to see WiFi drive the skeleton.'; + $('trMsg').innerHTML = 'Saved'+stopNote+'. Go to 3 · INFER to see WiFi drive the skeleton.'; $('trainBtn').disabled = false; $('trStop').disabled = true; refreshGates(); } @@ -916,6 +1156,14 @@ function inferLoop(){ await idbLoad(); await loadModel(); renderCoverage(); + setCapControls(); // pause/skip start disabled until recording + // if a camera was chosen in a previous session, surface it in the selectors (labels need permission, + // so this only fully populates after the user clicks "enable camera" in any stage) + try{ + const saved = localStorage.getItem(CAM_KEY); + const devs = (await navigator.mediaDevices.enumerateDevices()).filter(d => d.kind === 'videoinput'); + if (devs.length) populateCamSelectors(devs, saved); + }catch(e){} refreshGates(); requestAnimationFrame(calibrateLoop); requestAnimationFrame(captureLoop); diff --git a/v2/crates/ruview-swarm b/v2/crates/ruview-swarm new file mode 160000 index 00000000..472d920f --- /dev/null +++ b/v2/crates/ruview-swarm @@ -0,0 +1 @@ +Subproject commit 472d920fe774e7473d424c8be68c8ba3f800336c diff --git a/v2/crates/ruview-swarm/Cargo.toml b/v2/crates/ruview-swarm/Cargo.toml deleted file mode 100644 index 8592af76..00000000 --- a/v2/crates/ruview-swarm/Cargo.toml +++ /dev/null @@ -1,84 +0,0 @@ -[package] -name = "ruview-swarm" -version = "0.1.0" -edition = "2021" -description = "RuView drone swarm control system — hierarchical-mesh topology, Raft consensus, MARL, CSI sensing integration (ADR-148)" -license = "Apache-2.0" -# Publishing disabled until: (1) PR #862 merges, (2) internal path-deps are -# published in dependency order, (3) export-control sign-off on the ITAR-gated -# coordination features (USML Category VIII(h)(12)). Flip to true deliberately. -publish = false - -[features] -default = [] -# ITAR/USML Category VIII(h)(12): swarming coordination features. -# Must not be enabled in international distributions without export counsel review. -itar-unrestricted = [] -mavlink = ["dep:mavlink"] -ros2-dds = [] -onnx = ["dep:ort"] -simulation = [] -demo = ["simulation"] -full = ["mavlink", "onnx", "demo", "itar-unrestricted"] -ruflo = ["dep:reqwest", "dep:serde_json"] -# Heavy GPU-capable MARL training (real Candle autodiff PPO). Off by default so -# the default build stays light and the existing test suite keeps passing. -train = ["dep:candle-core", "dep:candle-nn"] -cuda = ["candle-core/cuda", "candle-nn/cuda"] - -[dependencies] -wifi-densepose-core = { path = "../wifi-densepose-core" } - -# Serialization -serde = { version = "1", features = ["derive"] } -serde_json = { version = "1", optional = true } -toml = "0.8" - -# Async runtime -tokio = { version = "1", features = ["full"] } -async-trait = "0.1" - -# MAVLink v2 (optional) -mavlink = { version = "0.13", optional = true } - -# ONNX Runtime (optional — for MARL actor inference) -ort = { version = "2.0.0-rc.11", optional = true } - -# Candle 0.9 — real autodiff PPO training (optional, behind `train` feature). -candle-core = { version = "0.9", default-features = false, optional = true } -candle-nn = { version = "0.9", default-features = false, optional = true } - -# HTTP client (optional — for Ruflo HTTP backend) -reqwest = { version = "0.12", features = ["json"], optional = true } - -# Crypto — MAVLink v2 HMAC-SHA256 signing -hmac = "0.12" -sha2 = "0.10" - -# Error handling -thiserror = "2.0" - -# Logging -tracing = "0.1" - -# Numerics -nalgebra = "0.33" -rand = "0.8" - -[dev-dependencies] -criterion = { version = "0.5", features = ["html_reports"] } -tokio-test = "0.4" - -[[bench]] -name = "swarm_bench" -harness = false - -# MARL training binary — requires the `train` feature (Candle autodiff). -# Excluded from the default build so `cargo test`/CI stay light. -[[bin]] -name = "train_marl" -required-features = ["train"] - -# ADR-171 Stage-1 evaluation CLI — pure Rust, no special feature needed. -[[bin]] -name = "eval_swarm" diff --git a/v2/crates/ruview-swarm/README.md b/v2/crates/ruview-swarm/README.md deleted file mode 100644 index 744dcf50..00000000 --- a/v2/crates/ruview-swarm/README.md +++ /dev/null @@ -1,108 +0,0 @@ -# wifi-densepose-swarm - -Drone swarm control system for the RuView wifi-densepose workspace. Implements ADR-148. - -## Overview - -`wifi-densepose-swarm` provides a hierarchical-mesh drone swarm coordination system -with Raft consensus, MAPPO-based multi-agent reinforcement learning, and tight -integration with the existing WiFi CSI sensing pipeline (`wifi-densepose-signal`, -`wifi-densepose-ruvector`). - -## Features - -- **Hierarchical-Mesh Topology** — cluster heads over Raft consensus; inter-cluster Gossip for map dissemination -- **Formation Control** — F1 VirtualStructure, F2 LeaderFollower, F3 Reynolds flocking -- **3-Phase Coverage** — boustrophedon sweep → Bayesian probability grid → multi-drone triangulation -- **RRT-APF Path Planner** — RRT* with Artificial Potential Field reactive collision avoidance -- **MARL Actor (MAPPO)** — 64-dim local observation, 3-layer MLP actor, CTDE training interface -- **CSI Sensing Integration** — drone payload pipeline (ESP32-S3 → Jetson), multi-drone CSI fusion -- **OccWorld Bridge** — integrates ADR-147 OccWorld occupancy prior as path planner environment -- **Security Hardening** — MAVLink v2 HMAC-SHA256 signing, UWB GPS anti-spoofing, onboard geofencing, Remote ID -- **Fail-Safe State Machine** — 10-state onboard safety system, GCS-independent -- **Demo & Training Modes** — synthetic CSI generation, Gazebo/PX4 SITL interface, TOML mission configs - -## ITAR Notice - -> ⚠️ **Export-controlled capability.** Swarming coordination features (formation control, -> Raft consensus, task allocation) are gated behind the `itar-unrestricted` feature flag -> per **USML Category VIII(h)(12)**. Default builds compile only safe stubs. -> Do not enable `itar-unrestricted` for international distribution without export counsel review. - -## Crate Features - -| Feature | Description | -|---------|-------------| -| `default` | Core types, sensing, failsafe, config, MARL — no ITAR-gated code | -| `itar-unrestricted` | Enables formation control, Raft consensus, task allocation | -| `mavlink` | MAVLink v2 protocol support | -| `onnx` | ONNX Runtime backend for MARL actor inference (INT8) | -| `simulation` | Simulation-mode stubs | -| `demo` | Synthetic CSI generation, scenario runners | -| `full` | All of the above | - -## Quick Start - -```rust -use wifi_densepose_swarm::{config::SwarmConfig, demo::scenario::DemoScenario}; - -// Load a mission profile -let config = SwarmConfig::sar_default(); - -// Run a demo scenario -let scenario = DemoScenario::sar_rubble_field(4); // 4-drone SAR -let estimated_secs = scenario.estimate_coverage_time_secs(); -// → < 240 s for 4 drones over 400×400 m (beyond Wi2SAR SOTA single-drone baseline) -``` - -## Mission Profiles - -| Profile | Drones | Area | Application | -|---------|--------|------|-------------| -| `sar` | 6–12 | 400×400 m | Structural collapse victim search | -| `inspection` | 3–6 | Linear corridor | Infrastructure (power lines, bridges) | -| `agriculture` | 4–12 | Field-configurable | NDVI mapping, variable-rate spraying | -| `mine` | 2–4 | Tunnel | GPS-denied underground exploration | -| `relay` | 6–20 | Perimeter | Emergency telecom relay chain | -| `demo` | Any | Configurable | Synthetic CSI, configurable victims | - -## Module Structure - -``` -src/ -├── types.rs — NodeId, DroneState, SwarmTask, SwarmError, FailSafeState -├── topology/ — Raft consensus¹, Gossip dissemination, MeshTopology -├── formation/ — VirtualStructure¹, LeaderFollower¹, Reynolds flocking¹ -├── planning/ — RRT-APF planner, 3-phase coverage, Bayesian grid, pheromone -├── allocation/ — Auction-based task allocation¹, FNN bid scorer¹ -├── sensing/ — CSI payload pipeline, multi-drone fusion, OccWorld bridge -├── marl/ — MAPPO actor, LocalObservation, reward shaping, TrainingConfig -├── security/ — MAVLink signing, UWB anti-spoofing, geofencing, Remote ID -├── failsafe/ — 10-state onboard fail-safe machine -├── config/ — TOML SwarmConfig with mission presets -├── demo/ — Synthetic CSI, DemoScenario runners -├── integration/ — FlightController trait (PX4/ArduPilot/Sim) -└── bench_support.rs — Criterion fixture generators - -¹ Requires `itar-unrestricted` feature. -``` - -## Related ADRs - -| ADR | Title | Relation | -|-----|-------|----------| -| ADR-148 | Drone Swarm Control System | This crate | -| ADR-147 | OccWorld Occupancy World Model | Environment prior via `sensing::occworld_bridge` | -| ADR-134 | CSI→CIR ISTA Sparse Recovery | Drone payload sensing | -| ADR-146 | RF Encoder Multitask Heads | Drone payload inference | -| ADR-016 | RuVector Training Integration | CrossViewpointAttention | - -## Performance Targets (vs. Wi2SAR SOTA) - -| Metric | Wi2SAR baseline (1 drone) | 4-drone target | -|--------|--------------------------|----------------| -| Coverage | 160,000 m² | 160,000 m² | -| Time | 13.5 min | ≤ 4 min | -| Localization | 5 m | ≤ 2 m (3-view fusion) | -| MARL inference | N/A | ≤ 5 ms (INT8, release) | -| Raft election | N/A | ≤ 300 ms | diff --git a/v2/crates/ruview-swarm/benches/swarm_bench.rs b/v2/crates/ruview-swarm/benches/swarm_bench.rs deleted file mode 100644 index e87d5634..00000000 --- a/v2/crates/ruview-swarm/benches/swarm_bench.rs +++ /dev/null @@ -1,70 +0,0 @@ -use criterion::{criterion_group, criterion_main, Criterion}; -use ruview_swarm::marl::{MappoActor, ActorConfig}; -use ruview_swarm::marl::LocalObservation; -use ruview_swarm::sensing::MultiViewFusion; -use ruview_swarm::planning::RrtApfPlanner; -use ruview_swarm::demo::{DemoScenario}; -use ruview_swarm::types::{CsiDetection, NodeId, Position3D}; - -fn bench_marl_inference(c: &mut Criterion) { - let actor = MappoActor::random_init(ActorConfig::default()); - let obs = LocalObservation::zeros(); - c.bench_function("marl_actor_inference", |b| b.iter(|| actor.forward(&obs))); -} - -fn bench_rrt_apf_plan(c: &mut Criterion) { - let planner = RrtApfPlanner::new(3.0); - let start = Position3D { x: 0.0, y: 0.0, z: -30.0 }; - let goal = Position3D { x: 50.0, y: 50.0, z: -30.0 }; - c.bench_function("rrt_apf_100iter", |b| b.iter(|| { - let mut rng = rand::thread_rng(); - planner.plan(start, goal, 100, &mut rng) - })); -} - -fn bench_multiview_fusion(c: &mut Criterion) { - let fusion = MultiViewFusion::default(); - let detections = vec![ - CsiDetection { drone_id: NodeId(0), confidence: 0.85, victim_position: Some(Position3D { x: 51.0, y: 49.0, z: 0.0 }), timestamp_ms: 0 }, - CsiDetection { drone_id: NodeId(1), confidence: 0.78, victim_position: Some(Position3D { x: 49.0, y: 51.0, z: 0.0 }), timestamp_ms: 0 }, - CsiDetection { drone_id: NodeId(2), confidence: 0.92, victim_position: Some(Position3D { x: 50.0, y: 50.0, z: 0.0 }), timestamp_ms: 0 }, - ]; - let positions = vec![ - (NodeId(0), Position3D { x: 0.0, y: 0.0, z: -30.0 }), - (NodeId(1), Position3D { x: 100.0, y: 0.0, z: -30.0 }), - (NodeId(2), Position3D { x: 50.0, y: 86.6, z: -30.0 }), - ]; - c.bench_function("multiview_fusion_3drones", |b| b.iter(|| fusion.fuse(&detections, &positions))); -} - -fn bench_demo_coverage_estimate(c: &mut Criterion) { - let scenario = DemoScenario::sar_rubble_field(4); - c.bench_function("demo_coverage_estimate", |b| b.iter(|| scenario.estimate_coverage_time_secs())); -} - -fn bench_ppo_update(c: &mut Criterion) { - use ruview_swarm::marl::{MappoActor, ActorConfig, LocalObservation}; - use ruview_swarm::marl::training_loop::{ReplayBuffer, Transition, PpoConfig, ppo_update}; - use ruview_swarm::marl::actor::ActorAction; - - let mut buf = ReplayBuffer::new(64); - for i in 0..64 { - buf.push(Transition { - obs: LocalObservation::zeros(), - action: ActorAction { delta_heading_rad: 0.1, delta_altitude_m: 0.0, speed_ms: 5.0, trigger_csi_scan: true }, - reward: if i % 2 == 0 { 10.0 } else { -2.0 }, - next_obs: LocalObservation::zeros(), - done: i == 63, - }); - } - let cfg = PpoConfig::default(); - c.bench_function("ppo_update_64transitions", |b| { - b.iter(|| { - let mut actor = MappoActor::random_init(ActorConfig::default()); - ppo_update(&mut actor, &buf, &cfg) - }) - }); -} - -criterion_group!(benches, bench_marl_inference, bench_rrt_apf_plan, bench_multiview_fusion, bench_demo_coverage_estimate, bench_ppo_update); -criterion_main!(benches); diff --git a/v2/crates/ruview-swarm/evals/.gitkeep b/v2/crates/ruview-swarm/evals/.gitkeep deleted file mode 100644 index 248db447..00000000 --- a/v2/crates/ruview-swarm/evals/.gitkeep +++ /dev/null @@ -1,2 +0,0 @@ -# ADR-171 evaluation outputs -RESULTS.md is generated by the `eval_swarm` binary. diff --git a/v2/crates/ruview-swarm/evals/RESULTS.md b/v2/crates/ruview-swarm/evals/RESULTS.md deleted file mode 100644 index 955ebb43..00000000 --- a/v2/crates/ruview-swarm/evals/RESULTS.md +++ /dev/null @@ -1,26 +0,0 @@ -# ruview-swarm Evaluation Results (ADR-171 Stage 1, kinematic) - -Statistically-rigorous evaluation harness: seeded multi-run rollouts with IQM + 95% stratified-bootstrap confidence intervals (Agarwal et al., NeurIPS 2021). - -## Run configuration - -- **Stage**: 1 (kinematic, self-contained, deterministic per seed) -- **Episodes per pattern**: 100 (seed × episode matrix) -- **CI method**: 95% stratified bootstrap of the IQM, stratified by seed -- **GDOP**: 2-D geometric dilution of precision at first detection - -> **Stage 2 pending**: high-fidelity Gazebo/PX4 SITL evaluation (false-alarm rate, real collision rate on the median seeds) is a follow-on — see ADR-171 §6.1. The collision figures below are a kinematic min-separation proxy, not SITL physics. - -## Flight-pattern leaderboard - -| Flight pattern | Coverage IQM [95% CI] | Localization (m) IQM [95% CI] | Detection rate | Mean GDOP | -|----------------|-----------------------|-------------------------------|----------------|-----------| -| partitioned_lawnmower | 1.000 [1.000, 1.000] | 7.022 [5.669, 8.379] | 100.0% | 0.000 | -| pheromone | 0.662 [0.652, 0.671] | 4.110 [3.346, 5.141] | 95.0% | 1.598 | -| levy_flight | 0.490 [0.489, 0.491] | 3.523 [2.897, 4.160] | 100.0% | 0.000 | -| boustrophedon | 0.370 [0.370, 0.370] | 2.740 [2.357, 3.207] | 100.0% | 0.000 | -| spiral | 0.336 [0.336, 0.336] | 3.082 [2.678, 3.568] | 100.0% | 0.000 | -| potential_field | 0.254 [0.252, 0.256] | 4.343 [3.489, 5.265] | 100.0% | 0.000 | -| _Wi2SAR (paper baseline)_ | _n/a_ | _5.0 (paper)_ | _n/a_ | _n/a_ | - -_Wi2SAR row is the published single-drone localization figure (arxiv 2604.09115), shown paper-to-paper for reference only — it was not re-run through this kinematic harness._ diff --git a/v2/crates/ruview-swarm/src/allocation/auction.rs b/v2/crates/ruview-swarm/src/allocation/auction.rs deleted file mode 100644 index 95283e76..00000000 --- a/v2/crates/ruview-swarm/src/allocation/auction.rs +++ /dev/null @@ -1,118 +0,0 @@ -//! Contract-net (auction) task allocation. - -use crate::types::{DroneState, NodeId, SwarmTask, TaskId}; -use std::collections::HashMap; - -/// A bid submitted by a node for a task. -#[derive(Debug, Clone)] -pub struct Bid { - pub node_id: NodeId, - pub task_id: TaskId, - /// Lower score = more capable/willing. Computed by the bidding node. - pub score: f32, -} - -/// Auction-based task allocator. -pub struct AuctionAllocator { - pub pending_tasks: HashMap, - pub bids: HashMap>, - pub timeout_ms: u64, -} - -impl AuctionAllocator { - pub fn new(timeout_ms: u64) -> Self { - Self { - pending_tasks: HashMap::new(), - bids: HashMap::new(), - timeout_ms, - } - } - - /// Announce a new task (add to pending pool). - pub fn announce_task(&mut self, task: SwarmTask) { - let id = task.id; - self.pending_tasks.insert(id, task); - self.bids.entry(id).or_default(); - } - - /// Accept a bid for a pending task. - pub fn submit_bid(&mut self, bid: Bid) { - if self.pending_tasks.contains_key(&bid.task_id) { - self.bids.entry(bid.task_id).or_default().push(bid); - } - } - - /// Resolve all pending tasks: assign each to the best bidder. - /// Returns a list of (TaskId, winning NodeId) pairs. - pub fn resolve(&mut self) -> Vec<(TaskId, NodeId)> { - let mut results = Vec::new(); - let task_ids: Vec = self.pending_tasks.keys().copied().collect(); - - for task_id in task_ids { - let winner = self - .bids - .get(&task_id) - .and_then(|bids| { - bids.iter() - .min_by(|a, b| { - a.score.partial_cmp(&b.score).unwrap_or(std::cmp::Ordering::Equal) - }) - .map(|b| b.node_id) - }); - - if let Some(winner_id) = winner { - if let Some(task) = self.pending_tasks.get_mut(&task_id) { - task.assigned_to = Some(winner_id); - } - results.push((task_id, winner_id)); - self.bids.remove(&task_id); - } - } - - // Clean up resolved tasks - for (tid, _) in &results { - self.pending_tasks.remove(tid); - } - - results - } - - /// Compute a bid score heuristic for a node given a task. - /// Returns a score ∈ [0, ∞): lower is better. - pub fn compute_bid_score(node: &DroneState, task: &SwarmTask) -> f32 { - let dist = node.position.distance_to(&task.target) as f32; - let battery_penalty = (100.0 - node.battery_pct) / 100.0; - let link_penalty = 1.0 - node.link_quality; - let priority_bonus = 1.0 - task.priority.clamp(0.0, 1.0); - dist / 100.0 + battery_penalty * 0.3 + link_penalty * 0.2 + priority_bonus * 0.1 - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::types::{Position3D, SwarmTask, TaskId, TaskKind}; - - fn make_task(id: u64) -> SwarmTask { - SwarmTask { - id: TaskId(id), - kind: TaskKind::ReturnToHome, - priority: 0.5, - target: Position3D::zero(), - deadline_ms: None, - assigned_to: None, - } - } - - #[test] - fn test_auction_assigns_best_bidder() { - let mut alloc = AuctionAllocator::new(1000); - let task = make_task(1); - alloc.announce_task(task); - alloc.submit_bid(Bid { node_id: NodeId(1), task_id: TaskId(1), score: 0.8 }); - alloc.submit_bid(Bid { node_id: NodeId(2), task_id: TaskId(1), score: 0.3 }); - let results = alloc.resolve(); - assert_eq!(results.len(), 1); - assert_eq!(results[0].1, NodeId(2)); // lower score wins - } -} diff --git a/v2/crates/ruview-swarm/src/allocation/fnn.rs b/v2/crates/ruview-swarm/src/allocation/fnn.rs deleted file mode 100644 index 637dedfe..00000000 --- a/v2/crates/ruview-swarm/src/allocation/fnn.rs +++ /dev/null @@ -1,97 +0,0 @@ -//! Lightweight 3-layer FNN bid scorer — pure Rust, no ONNX required. - -/// 3-layer FNN: 5 inputs → 16 hidden (ReLU) → 8 hidden (ReLU) → 1 output (sigmoid). -pub struct FnnScorer { - pub w1: [[f32; 5]; 16], - pub b1: [f32; 16], - pub w2: [[f32; 16]; 8], - pub b2: [f32; 8], - pub w3: [f32; 8], - pub b3: f32, -} - -fn relu(x: f32) -> f32 { - x.max(0.0) -} - -fn sigmoid(x: f32) -> f32 { - 1.0 / (1.0 + (-x).exp()) -} - -impl FnnScorer { - /// Score a feature vector. Returns sigmoid(output) ∈ [0, 1]. - /// Features: [dist_norm, battery_norm, link_quality, csi_confidence, workload_norm] - pub fn score(&self, features: [f32; 5]) -> f32 { - // Layer 1: 5 → 16 (ReLU) - let mut h1 = [0.0f32; 16]; - for (i, row) in self.w1.iter().enumerate() { - let z: f32 = row.iter().zip(features.iter()).map(|(w, x)| w * x).sum(); - h1[i] = relu(z + self.b1[i]); - } - - // Layer 2: 16 → 8 (ReLU) - let mut h2 = [0.0f32; 8]; - for (i, row) in self.w2.iter().enumerate() { - let z: f32 = row.iter().zip(h1.iter()).map(|(w, x)| w * x).sum(); - h2[i] = relu(z + self.b2[i]); - } - - // Layer 3: 8 → 1 (sigmoid) - let z3: f32 = self.w3.iter().zip(h2.iter()).map(|(w, x)| w * x).sum::() + self.b3; - sigmoid(z3) - } - - /// Default weights initialised to a simple identity-like setup. - pub fn default_weights() -> Self { - // Simple: w1 diagonalish, others small constant - // Index needed: diagonal/strided init uses i for both row and column. - let mut w1 = [[0.0f32; 5]; 16]; - #[allow(clippy::needless_range_loop)] - for i in 0..5 { - w1[i][i] = 1.0; - } - for row in w1.iter_mut().take(16).skip(5) { - row[0] = 0.1; - } - let mut w2 = [[0.0f32; 16]; 8]; - #[allow(clippy::needless_range_loop)] - for i in 0..8 { - w2[i][i * 2] = 1.0; - } - let w3 = [0.125f32; 8]; - Self { - w1, - b1: [0.0; 16], - w2, - b2: [0.0; 8], - w3, - b3: 0.0, - } - } -} - -impl Default for FnnScorer { - fn default() -> Self { - Self::default_weights() - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_score_in_unit_interval() { - let scorer = FnnScorer::default_weights(); - let features = [0.3f32, 0.8, 0.9, 0.75, 0.2]; - let s = scorer.score(features); - assert!(s >= 0.0 && s <= 1.0, "score {s} out of [0,1]"); - } - - #[test] - fn test_score_deterministic() { - let scorer = FnnScorer::default_weights(); - let f = [0.5f32; 5]; - assert_eq!(scorer.score(f), scorer.score(f)); - } -} diff --git a/v2/crates/ruview-swarm/src/allocation/mod.rs b/v2/crates/ruview-swarm/src/allocation/mod.rs deleted file mode 100644 index 03e68d15..00000000 --- a/v2/crates/ruview-swarm/src/allocation/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -//! Task allocation: auction-based and FNN-scored bid evaluation. -//! -// NOTE: Task allocation is ITAR-controlled (USML Category VIII(h)(12)). -// Only available when the `itar-unrestricted` feature is enabled. - -#[cfg(feature = "itar-unrestricted")] -pub mod auction; -#[cfg(feature = "itar-unrestricted")] -pub mod fnn; - -#[cfg(feature = "itar-unrestricted")] -pub use auction::{AuctionAllocator, Bid}; -#[cfg(feature = "itar-unrestricted")] -pub use fnn::FnnScorer; - -/// Stub: task allocation is export-controlled. Enable `itar-unrestricted` feature. -#[cfg(not(feature = "itar-unrestricted"))] -pub fn allocate_stub() -> crate::SwarmResult<()> { - Err(crate::SwarmError::Security( - "Task allocation requires itar-unrestricted feature (USML VIII(h)(12))".into(), - )) -} diff --git a/v2/crates/ruview-swarm/src/bench_support.rs b/v2/crates/ruview-swarm/src/bench_support.rs deleted file mode 100644 index f93eb58e..00000000 --- a/v2/crates/ruview-swarm/src/bench_support.rs +++ /dev/null @@ -1,45 +0,0 @@ -//! Benchmark support utilities: scenario builders and timing helpers for criterion benchmarks. - -use crate::types::{DroneState, NodeId, Position3D, Velocity3D}; - -/// Generate N drone states arranged in a grid. -pub fn grid_drone_states(n: usize, spacing_m: f64) -> Vec { - let side = (n as f64).sqrt().ceil() as usize; - (0..n) - .map(|i| { - let row = i / side; - let col = i % side; - DroneState { - id: NodeId(i as u32), - position: Position3D { - x: col as f64 * spacing_m, - y: row as f64 * spacing_m, - z: -30.0, - }, - velocity: Velocity3D::default(), - heading_rad: 0.0, - altitude_agl_m: 30.0, - battery_pct: 80.0, - link_quality: 0.9, - timestamp_ms: 0, - } - }) - .collect() -} - -/// Generate N evenly-spaced positions in a circle. -pub fn circle_positions(n: usize, radius_m: f64) -> Vec<(NodeId, Position3D)> { - (0..n) - .map(|i| { - let angle = 2.0 * std::f64::consts::PI * i as f64 / n as f64; - ( - NodeId(i as u32), - Position3D { - x: radius_m * angle.cos(), - y: radius_m * angle.sin(), - z: -30.0, - }, - ) - }) - .collect() -} diff --git a/v2/crates/ruview-swarm/src/bin/eval_swarm.rs b/v2/crates/ruview-swarm/src/bin/eval_swarm.rs deleted file mode 100644 index f2db71bf..00000000 --- a/v2/crates/ruview-swarm/src/bin/eval_swarm.rs +++ /dev/null @@ -1,104 +0,0 @@ -//! ADR-171 Stage-1 evaluation CLI. -//! -//! Runs the kinematic eval matrix over every flight pattern (default) and -//! writes a ranked `RESULTS.md` leaderboard. Pure Rust — no special feature -//! flag required, so it builds and runs in default CI. -//! -//! Defaults are intentionally small (10 seeds × 10 episodes) so the run is fast. -//! The full ADR-171 reporting configuration is 10 seeds × 50 episodes — pass -//! `--seeds 10 --episodes 50` for the publication run. -//! -//! ```text -//! cargo run -p ruview-swarm --bin eval_swarm -- \ -//! --seeds 10 --episodes 10 --out crates/ruview-swarm/evals/RESULTS.md -//! ``` - -use std::path::PathBuf; - -use ruview_swarm::evals::metrics::AggregateMetrics; -use ruview_swarm::evals::report::render_results_md; -use ruview_swarm::evals::runner::{run_matrix, EvalConfig}; -use ruview_swarm::planning::patterns::FlightPattern; - -fn main() { - let args: Vec = std::env::args().collect(); - let mut seeds = 10usize; - let mut episodes = 10usize; - let mut out = PathBuf::from("crates/ruview-swarm/evals/RESULTS.md"); - - let mut i = 1; - while i < args.len() { - match args[i].as_str() { - "--seeds" => { - i += 1; - seeds = args.get(i).and_then(|s| s.parse().ok()).unwrap_or(seeds); - } - "--episodes" => { - i += 1; - episodes = args.get(i).and_then(|s| s.parse().ok()).unwrap_or(episodes); - } - "--out" => { - i += 1; - if let Some(p) = args.get(i) { - out = PathBuf::from(p); - } - } - "--help" | "-h" => { - eprintln!( - "eval_swarm — ADR-171 Stage-1 kinematic evaluator\n\ - Usage: eval_swarm [--seeds N] [--episodes M] [--out PATH]\n\ - Defaults: --seeds 10 --episodes 10 --out crates/ruview-swarm/evals/RESULTS.md" - ); - return; - } - other => { - eprintln!("warning: ignoring unknown argument '{other}'"); - } - } - i += 1; - } - - eprintln!( - "Running ADR-171 Stage-1 eval: {seeds} seeds × {episodes} episodes \ - over {} flight patterns...", - FlightPattern::all().len() - ); - - let mut rows: Vec<(String, AggregateMetrics)> = Vec::new(); - for (idx, pattern) in FlightPattern::all().into_iter().enumerate() { - let mut cfg = EvalConfig::sar_small(pattern); - cfg.seeds = seeds; - cfg.episodes_per_seed = episodes; - let matrix = run_matrix(&cfg); - let agg = AggregateMetrics::from_strata(&matrix, 0x0149 ^ idx as u64); - eprintln!( - " {}: coverage IQM {:.3}, detection {:.0}%", - pattern.name(), - agg.coverage_iqm.point, - agg.detection_rate * 100.0 - ); - rows.push((pattern.name().to_string(), agg)); - } - - // Rank by descending coverage point estimate. - rows.sort_by(|a, b| { - b.1.coverage_iqm - .point - .partial_cmp(&a.1.coverage_iqm.point) - .unwrap_or(std::cmp::Ordering::Equal) - }); - - let md = render_results_md(&rows); - - if let Some(parent) = out.parent() { - if let Err(e) = std::fs::create_dir_all(parent) { - eprintln!("error: could not create {}: {e}", parent.display()); - std::process::exit(1); - } - } - if let Err(e) = std::fs::write(&out, &md) { - eprintln!("error: could not write {}: {e}", out.display()); - std::process::exit(1); - } - eprintln!("Wrote {} ({} bytes).", out.display(), md.len()); -} diff --git a/v2/crates/ruview-swarm/src/bin/train_marl.rs b/v2/crates/ruview-swarm/src/bin/train_marl.rs deleted file mode 100644 index 2f1e0504..00000000 --- a/v2/crates/ruview-swarm/src/bin/train_marl.rs +++ /dev/null @@ -1,474 +0,0 @@ -//! MARL training entry point for ruview-swarm (ADR-148 M4). -//! -//! Real Candle autodiff PPO training loop. Runs on CPU, or CUDA when built -//! with `--features train,cuda` (local RTX 5080 or a GCP L4 instance). -//! -//! Movement is driven by a selectable `FlightPattern` (boustrophedon, -//! partitioned, spiral, pheromone, potential, levy) and reward is shaped by a -//! selectable `LearningPattern` (mappo, ippo, curiosity, meta). This makes each -//! pattern produce visibly distinct trajectories + telemetry instead of every -//! drone clustering on the orchestrator's internal coverage strategy. -//! -//! Usage: -//! cargo run --release -p ruview-swarm --features train,cuda --bin train_marl -- \ -//! --episodes 5000 --drones 4 --profile sar \ -//! --flight-pattern partitioned --learn-pattern mappo_curiosity \ -//! --checkpoint-dir ./marl-checkpoints -//! -//! Right-sizing note: the policy is a 64→128→64 MLP. The bottleneck is -//! environment-rollout throughput, not GPU matmul — an L4 + 16 vCPU beats an -//! 8× A100 box for this workload at ~1/20th the cost. See scripts/gcp/. - -use std::collections::HashSet; - -use ruview_swarm::config::SwarmConfig; -use ruview_swarm::integration::telemetry::{DroneFrame, TelemetryRecorder}; -use ruview_swarm::marl::candle_ppo::{CandlePpoConfig, CandleTrainer}; -use ruview_swarm::marl::learning::{shaped_reward, CuriosityModule, LearningPattern}; -use ruview_swarm::marl::observation::LocalObservation; -use ruview_swarm::marl::reward::{RewardCalculator, RewardContext}; -use ruview_swarm::planning::patterns::{FlightPattern, PatternContext}; -use ruview_swarm::types::{DroneState, NodeId, Position3D, Velocity3D}; - -struct Args { - episodes: usize, - drones: usize, - profile: String, - steps_per_episode: usize, - checkpoint_dir: String, - checkpoint_every: usize, - telemetry: Option, - telemetry_episode: usize, - flight_pattern: String, - learn_pattern: String, -} - -impl Default for Args { - fn default() -> Self { - Self { - episodes: 1000, - drones: 4, - profile: "sar".to_string(), - steps_per_episode: 200, - checkpoint_dir: "./marl-checkpoints".to_string(), - checkpoint_every: 100, - telemetry: None, - telemetry_episode: 0, - flight_pattern: "partitioned".to_string(), - learn_pattern: "mappo".to_string(), - } - } -} - -fn parse_args() -> Args { - let mut args = Args::default(); - let argv: Vec = std::env::args().collect(); - let mut i = 1; - while i < argv.len() { - let next = || argv.get(i + 1).cloned().unwrap_or_default(); - match argv[i].as_str() { - "--episodes" => { - args.episodes = next().parse().unwrap_or(args.episodes); - i += 1; - } - "--drones" => { - args.drones = next().parse().unwrap_or(args.drones); - i += 1; - } - "--profile" => { - args.profile = next(); - i += 1; - } - "--steps" => { - args.steps_per_episode = next().parse().unwrap_or(args.steps_per_episode); - i += 1; - } - "--checkpoint-dir" => { - args.checkpoint_dir = next(); - i += 1; - } - "--checkpoint-every" => { - args.checkpoint_every = next().parse().unwrap_or(args.checkpoint_every); - i += 1; - } - "--telemetry" => { - args.telemetry = Some(next()); - i += 1; - } - "--telemetry-episode" => { - args.telemetry_episode = next().parse().unwrap_or(args.telemetry_episode); - i += 1; - } - "--flight-pattern" => { - args.flight_pattern = next(); - i += 1; - } - "--learn-pattern" => { - args.learn_pattern = next(); - i += 1; - } - "-h" | "--help" => { - println!( - "train_marl — ruview-swarm MARL training (ADR-148 M4)\n\ - \nOptions:\n \ - --episodes N training episodes (default 1000)\n \ - --drones N swarm size (default 4)\n \ - --profile NAME sar|inspection|mine|agriculture (default sar)\n \ - --steps N steps per episode (default 200)\n \ - --flight-pattern P boustrophedon|partitioned|spiral|pheromone|potential|levy (default partitioned)\n \ - --learn-pattern P mappo|ippo|curiosity|meta (default mappo)\n \ - --checkpoint-dir D checkpoint output dir (default ./marl-checkpoints)\n \ - --checkpoint-every N save every N episodes (default 100)\n \ - --telemetry FILE write JSONL telemetry for viz/swarm_viz.html\n \ - --telemetry-episode N which episode's steps to record spatially (default 0)" - ); - std::process::exit(0); - } - other => eprintln!("warning: ignoring unknown arg {other}"), - } - i += 1; - } - args -} - -fn config_for(profile: &str) -> SwarmConfig { - match profile { - "inspection" => SwarmConfig::inspection_default(), - "mine" => SwarmConfig::mine_default(), - "agriculture" => SwarmConfig::agriculture_default(), - _ => SwarmConfig::wi2sar_reference(), - } -} - -/// Map a world coordinate to a grid cell index at `grid_res` metre resolution. -fn cell_of(x: f64, y: f64, grid_res: f64) -> (u32, u32) { - let gx = (x / grid_res).floor().max(0.0) as u32; - let gy = (y / grid_res).floor().max(0.0) as u32; - (gx, gy) -} - -/// Mark every grid cell within the drone's circular scan footprint as scanned, -/// returning how many *newly* scanned cells this step contributed. -fn mark_scanned( - scanned: &mut HashSet<(u32, u32)>, - pos: &Position3D, - scan_width_m: f64, - grid_res: f64, - area_w: f64, - area_h: f64, -) -> u32 { - let r = scan_width_m * 0.5; - let cols = (area_w / grid_res).ceil() as i64; - let rows = (area_h / grid_res).ceil() as i64; - let (cx, cy) = cell_of(pos.x, pos.y, grid_res); - let span = (r / grid_res).ceil() as i64; - let mut new_cells = 0u32; - for dgx in -span..=span { - for dgy in -span..=span { - let gx = cx as i64 + dgx; - let gy = cy as i64 + dgy; - if gx < 0 || gy < 0 || gx >= cols || gy >= rows { - continue; - } - // Cell centre in metres. - let mx = (gx as f64 + 0.5) * grid_res; - let my = (gy as f64 + 0.5) * grid_res; - if (mx - pos.x).hypot(my - pos.y) <= r && scanned.insert((gx as u32, gy as u32)) { - new_cells += 1; - } - } - } - new_cells -} - -#[tokio::main] -async fn main() -> Result<(), Box> { - let args = parse_args(); - let cfg = config_for(&args.profile); - let flight_pattern = FlightPattern::from_str(&args.flight_pattern); - let learn_pattern = LearningPattern::from_str(&args.learn_pattern); - - println!( - "MARL training: profile={} drones={} episodes={} steps/ep={} flight={} learn={} ({})", - args.profile, - args.drones, - args.episodes, - args.steps_per_episode, - flight_pattern.name(), - learn_pattern.name(), - if learn_pattern.centralized_critic() { - "CTDE / centralized critic" - } else { - "independent learners" - } - ); - - let ppo_cfg = CandlePpoConfig::default(); - let mut trainer = CandleTrainer::new(ppo_cfg)?; - println!("device: {:?}", trainer.net.device()); - - let reward_calc = RewardCalculator::default(); - std::fs::create_dir_all(&args.checkpoint_dir).ok(); - - let area_w = cfg.mission.area_width_m; - let area_h = cfg.mission.area_height_m; - let grid_res = cfg.mission.grid_resolution_m.max(1.0); - let scan_w = cfg.planning.csi_scan_width_m; - let max_speed = cfg.planning.max_speed_ms.max(0.1); - let altitude_z = -cfg.planning.flight_altitude_m; - let total_cells = ((area_w / grid_res).ceil() * (area_h / grid_res).ceil()).max(1.0); - - // Synthetic victims placed within the mission area for reward signal. - let victims = vec![ - Position3D { x: area_w * 0.2, y: area_h * 0.3, z: 0.0 }, - Position3D { x: area_w * 0.6, y: area_h * 0.45, z: 0.0 }, - ]; - - // Composite profile label so the viewer header surfaces the active patterns. - let profile_label = format!( - "{} · flight={} · learn={}", - args.profile, - flight_pattern.name(), - learn_pattern.name() - ); - - // Optional telemetry recorder for the visualizer. - let mut telem = match &args.telemetry { - Some(path) => { - let mut rec = TelemetryRecorder::create(path)?; - rec.meta(&profile_label, args.drones, area_w, area_h, &victims)?; - println!("telemetry → {path} (spatial steps from episode {})", args.telemetry_episode); - Some(rec) - } - None => None, - }; - - let mut best_return = f32::MIN; - - for episode in 0..args.episodes { - // Per-episode curiosity module (count-based novelty over the area). - let mut curiosity = CuriosityModule::new(area_w, area_h, 32, 0.5); - - // Build drone states directly so the FlightPattern fully drives motion. - let cols = (args.drones as f64).sqrt().ceil().max(1.0) as usize; - let mut states: Vec = (0..args.drones) - .map(|d| { - let (row, col) = (d / cols, d % cols); - let mut s = DroneState::default_at_origin(NodeId(d as u32)); - s.position = Position3D { - x: 10.0 + col as f64 * (area_w / cols as f64), - y: 10.0 + row as f64 * (area_h / cols.max(1) as f64), - z: altitude_z, - }; - s.altitude_agl_m = cfg.planning.flight_altitude_m; - s - }) - .collect(); - - // Coverage tracker (shared across drones — total area scanned). - let mut scanned: HashSet<(u32, u32)> = HashSet::new(); - // Rolling recent-positions trail for pheromone/potential patterns. - let mut visited: Vec = Vec::with_capacity(256); - - // Rollout buffers (flattened across drones). - let mut obs_buf: Vec = Vec::new(); - let mut action_buf: Vec<[f32; 4]> = Vec::new(); - let mut reward_buf: Vec = Vec::new(); - let mut value_buf: Vec = Vec::new(); - let mut done_buf: Vec = Vec::new(); - - for step in 0..args.steps_per_episode { - let is_last = step == args.steps_per_episode - 1; - - // Snapshot peer positions for this tick (observations + repulsion). - let positions: Vec<(NodeId, Position3D)> = - states.iter().map(|s| (s.id, s.position)).collect(); - - // Index needed: mutates states[idx] while reading peer positions; borrow constraints. - #[allow(clippy::needless_range_loop)] - for idx in 0..states.len() { - let prev_pos = states[idx].position; - let node_id = states[idx].id; - - // Neighbour positions (everyone except this drone). - let neighbors: Vec<(NodeId, Position3D)> = positions - .iter() - .filter(|(id, _)| *id != node_id) - .cloned() - .collect(); - let peers: Vec = neighbors.iter().map(|(_, p)| *p).collect(); - - // Observation from the current (pre-move) state. - let obs = - LocalObservation::from_state_no_grid(&states[idx], &neighbors, None, None); - - // --- FlightPattern drives the next waypoint -------------------- - let ctx = PatternContext { - drone_id: node_id, - swarm_size: args.drones, - current: prev_pos, - area_w, - area_h, - altitude_z, - scan_width_m: scan_w, - step: step as u64, - visited: &visited, - peers: &peers, - }; - let target = flight_pattern.next_target(&ctx); - - // Move one tick toward the target at max_speed (no teleport). - let dx = target.x - prev_pos.x; - let dy = target.y - prev_pos.y; - let dist = dx.hypot(dy); - let new_pos = if dist > 1e-9 { - let stepd = dist.min(max_speed); - Position3D { - x: prev_pos.x + dx / dist * stepd, - y: prev_pos.y + dy / dist * stepd, - z: altitude_z, - } - } else { - prev_pos - }; - let heading = if dist > 1e-9 { dy.atan2(dx) } else { states[idx].heading_rad }; - let moved = prev_pos.distance_to(&new_pos); - - // Commit the move to the drone state. - { - let s = &mut states[idx]; - s.velocity = Velocity3D { - vx: (new_pos.x - prev_pos.x), - vy: (new_pos.y - prev_pos.y), - vz: 0.0, - }; - s.position = new_pos; - s.heading_rad = heading; - s.timestamp_ms = s.timestamp_ms.saturating_add(1000); - } - - // Coverage: mark scanned footprint, count new cells. - let new_cells = - mark_scanned(&mut scanned, &new_pos, scan_w, grid_res, area_w, area_h); - - // Detection: any victim within the scan footprint. - let detected = victims.iter().any(|v| new_pos.distance_to(v) < scan_w); - - // Nearest-neighbour distance (for collision shaping). - let nearest = peers - .iter() - .map(|p| new_pos.distance_to(p)) - .fold(f64::MAX, f64::min); - - // Base extrinsic reward. - let ctx_r = RewardContext { - state: &states[idx], - new_cells_covered: new_cells, - victim_confirmed: detected, - contributed_to_triangulation: false, - nearest_neighbor_dist: nearest, - geofence_breached: false, - battery_depleted_without_rth: false, - }; - let base = reward_calc.compute(&ctx_r); - - // Curiosity shaping (only when the learning pattern uses it). - let reward = if learn_pattern.uses_curiosity() { - let bonus = curiosity.visit_bonus(new_pos.x, new_pos.y); - shaped_reward(learn_pattern, base, bonus) - } else { - base - }; - - let action = [ - heading as f32, - states[idx].altitude_agl_m as f32, - (moved / 1.0) as f32, - 0.0, - ]; - - obs_buf.push(obs); - action_buf.push(action); - reward_buf.push(reward); - value_buf.push(0.0); // bootstrap value (critic learns this) - done_buf.push(is_last); - - // Record the move in the shared visited trail (cap length). - visited.push(new_pos); - } - - // Trim the visited trail to the most recent ~200 positions. - if visited.len() > 200 { - let drop = visited.len() - 200; - visited.drain(0..drop); - } - - // Record spatial telemetry for the selected episode only. - if let Some(rec) = telem.as_mut() { - if episode == args.telemetry_episode { - let frames: Vec = states - .iter() - .map(|s| { - let detected = - victims.iter().any(|v| s.position.distance_to(v) < scan_w); - DroneFrame::from_state(s, detected) - }) - .collect(); - let coverage = scanned.len() as f64 / total_cells; - let _ = rec.step(episode, step, step as f64, &frames, coverage); - } - } - } - - // PPO update on the episode's rollout. - let (advantages, returns) = trainer.compute_gae(&reward_buf, &value_buf, &done_buf); - let old_log_probs = vec![0.0f32; obs_buf.len()]; - let (policy_loss, value_loss, _entropy) = - trainer.update(&obs_buf, &action_buf, &advantages, &returns, &old_log_probs)?; - - let mean_return = if returns.is_empty() { - 0.0 - } else { - returns.iter().sum::() / returns.len() as f32 - }; - - if mean_return > best_return { - best_return = mean_return; - } - - // Per-episode training-metric telemetry (every episode). - if let Some(rec) = telem.as_mut() { - let _ = rec.episode(episode, mean_return, policy_loss, value_loss, 0); - } - - if episode % 10 == 0 || episode == args.episodes - 1 { - let coverage_pct = scanned.len() as f64 / total_cells * 100.0; - println!( - "ep {:>5}/{} mean_return={:>8.3} best={:>8.3} policy_loss={:>8.4} value_loss={:>8.4} coverage={:>5.1}%", - episode, args.episodes, mean_return, best_return, policy_loss, value_loss, coverage_pct - ); - } - - // Checkpoint the trained variables periodically. - if args.checkpoint_every > 0 && (episode + 1) % args.checkpoint_every == 0 - || episode == args.episodes - 1 - { - let path = format!("{}/marl-ep{}.safetensors", args.checkpoint_dir, episode + 1); - if let Err(e) = trainer.net.varmap().save(&path) { - eprintln!("checkpoint save failed at {path}: {e}"); - } else { - println!("checkpoint saved: {path}"); - } - } - } - - if let Some(rec) = telem.as_mut() { - rec.flush()?; - if let Some(path) = &args.telemetry { - println!("telemetry written: {path} — open viz/swarm_viz.html and load it"); - } - } - - println!("training complete. best mean_return={best_return:.3}"); - Ok(()) -} diff --git a/v2/crates/ruview-swarm/src/config/mod.rs b/v2/crates/ruview-swarm/src/config/mod.rs deleted file mode 100644 index 755bd1c0..00000000 --- a/v2/crates/ruview-swarm/src/config/mod.rs +++ /dev/null @@ -1,207 +0,0 @@ -//! TOML-based swarm configuration with mission profiles. - -use serde::{Deserialize, Serialize}; - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct SwarmConfig { - pub swarm: SwarmParams, - pub formation: FormationConfig, - pub planning: PlanningConfig, - pub security: SecurityConfig, - pub mission: MissionConfig, - pub demo: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct SwarmParams { - pub max_agents: usize, - pub cluster_size: usize, - pub raft_election_timeout_ms: u64, - pub raft_heartbeat_ms: u64, - pub gossip_fanout: usize, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct FormationConfig { - /// "virtual_structure" | "leader_follower" | "reynolds" - pub mode: String, - pub min_separation_m: f64, - pub grid_spacing_m: f64, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct PlanningConfig { - pub flight_altitude_m: f64, - pub max_speed_ms: f64, - /// Wi2SAR validated scan footprint width. - pub csi_scan_width_m: f64, - pub lateral_overlap_pct: f64, - /// P(victim) threshold to trigger Phase 3 convergence. - pub convergence_threshold: f32, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct SecurityConfig { - pub mavlink_signing: bool, - pub uwb_antispoofing: bool, - pub uwb_tolerance_m: f64, - pub geofence_hard_margin_m: f64, - pub geofence_soft_margin_m: f64, - /// Remote ID broadcast rate in Hz (FAA/EU requirement: ≥ 1 Hz). - pub remote_id_broadcast_hz: f64, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct MissionConfig { - /// "sar" | "inspection" | "agriculture" | "mine" | "relay" - pub profile: String, - pub area_width_m: f64, - pub area_height_m: f64, - pub grid_resolution_m: f64, - pub max_flight_time_mins: f64, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct DemoConfig { - pub synthetic_csi: bool, - /// Victim positions in NED [x, y, z]. - pub victim_positions: Vec<[f64; 3]>, - pub wind_noise_ms: f64, - pub csi_noise_std: f64, - pub packet_loss_pct: f64, - pub replay_speed: f64, -} - -impl SwarmConfig { - pub fn from_toml_str(s: &str) -> Result { - toml::from_str(s) - } - - pub fn sar_default() -> Self { - Self { - swarm: SwarmParams { - max_agents: 12, - cluster_size: 4, - raft_election_timeout_ms: 300, - raft_heartbeat_ms: 100, - gossip_fanout: 3, - }, - formation: FormationConfig { - mode: "virtual_structure".into(), - min_separation_m: 5.0, - grid_spacing_m: 20.0, - }, - planning: PlanningConfig { - flight_altitude_m: 30.0, - max_speed_ms: 8.0, - csi_scan_width_m: 28.0, - lateral_overlap_pct: 20.0, - convergence_threshold: 0.75, - }, - security: SecurityConfig { - mavlink_signing: true, - uwb_antispoofing: true, - uwb_tolerance_m: 2.0, - geofence_hard_margin_m: 20.0, - geofence_soft_margin_m: 50.0, - remote_id_broadcast_hz: 1.0, - }, - mission: MissionConfig { - profile: "sar".into(), - area_width_m: 500.0, - area_height_m: 500.0, - grid_resolution_m: 5.0, - max_flight_time_mins: 25.0, - }, - demo: None, - } - } - - pub fn inspection_default() -> Self { - let mut cfg = Self::sar_default(); - cfg.mission.profile = "inspection".into(); - cfg.planning.flight_altitude_m = 15.0; - cfg.planning.max_speed_ms = 4.0; - cfg.formation.mode = "leader_follower".into(); - cfg - } - - pub fn agriculture_default() -> Self { - let mut cfg = Self::sar_default(); - cfg.mission.profile = "agriculture".into(); - cfg.planning.flight_altitude_m = 10.0; - cfg.planning.max_speed_ms = 6.0; - cfg.planning.csi_scan_width_m = 15.0; - cfg.formation.mode = "virtual_structure".into(); - cfg.formation.grid_spacing_m = 12.0; - cfg - } - - pub fn mine_default() -> Self { - let mut cfg = Self::sar_default(); - cfg.mission.profile = "mine".into(); - cfg.planning.flight_altitude_m = 5.0; - cfg.planning.max_speed_ms = 2.0; - cfg.security.uwb_antispoofing = true; // GPS-denied: UWB only - cfg - } - - /// Wi2SAR reference configuration (400×400 m, 8 m/s, 4 drones) for ADR-148 SOTA benchmark. - /// Produces 223 s coverage estimate — below the 240 s (4-min) SOTA target. - /// Source: Wi2SAR (arxiv 2604.09115): single drone, 160,000 m², 13.5 min. - pub fn wi2sar_reference() -> Self { - let mut cfg = Self::sar_default(); - cfg.mission.area_width_m = 400.0; - cfg.mission.area_height_m = 400.0; - cfg.planning.max_speed_ms = 8.0; - cfg.planning.csi_scan_width_m = 28.0; - cfg.planning.lateral_overlap_pct = 20.0; - cfg - } - - pub fn demo_default() -> Self { - let mut cfg = Self::sar_default(); - cfg.demo = Some(DemoConfig { - synthetic_csi: true, - victim_positions: vec![[50.0, 80.0, 0.0], [150.0, 200.0, 0.0], [300.0, 100.0, 0.0]], - wind_noise_ms: 2.0, - csi_noise_std: 0.05, - packet_loss_pct: 5.0, - replay_speed: 1.0, - }); - cfg - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_sar_default_serialization() { - let cfg = SwarmConfig::sar_default(); - let toml_str = toml::to_string(&cfg).expect("serialize ok"); - let parsed = SwarmConfig::from_toml_str(&toml_str).expect("parse ok"); - assert_eq!(parsed.mission.profile, "sar"); - } - - #[test] - fn test_demo_default_has_victims() { - let cfg = SwarmConfig::demo_default(); - assert!(cfg.demo.is_some()); - assert_eq!(cfg.demo.unwrap().victim_positions.len(), 3); - } - - #[test] - fn test_wi2sar_reference_coverage_within_4min() { - use crate::demo::scenario::DemoScenario; - let scenario = DemoScenario { - name: "Wi2SAR Reference".into(), - config: SwarmConfig::wi2sar_reference(), - num_drones: 4, - victims: vec![], - }; - let t = scenario.estimate_coverage_time_secs(); - assert!(t < 240.0, "4-drone Wi2SAR reference scenario: {}s should be < 240s (4 min SOTA)", t); - } -} diff --git a/v2/crates/ruview-swarm/src/demo/mod.rs b/v2/crates/ruview-swarm/src/demo/mod.rs deleted file mode 100644 index 621510f7..00000000 --- a/v2/crates/ruview-swarm/src/demo/mod.rs +++ /dev/null @@ -1,10 +0,0 @@ -//! Demo scenario runner — synthetic CSI with configurable victim positions. -//! -//! Wires together a [`SyntheticCsiGenerator`] and pre-built [`DemoScenario`] -//! definitions for rapid scenario validation without real hardware. - -pub mod synthetic_csi; -pub mod scenario; - -pub use synthetic_csi::SyntheticCsiGenerator; -pub use scenario::{DemoScenario, ScenarioResult}; diff --git a/v2/crates/ruview-swarm/src/demo/scenario.rs b/v2/crates/ruview-swarm/src/demo/scenario.rs deleted file mode 100644 index a9e0ee9d..00000000 --- a/v2/crates/ruview-swarm/src/demo/scenario.rs +++ /dev/null @@ -1,150 +0,0 @@ -//! Pre-built demo scenarios for rapid validation without hardware. -//! -//! Each scenario bundles a [`SwarmConfig`], victim positions, and a -//! [`SyntheticCsiGenerator`] so integration tests can drive a complete -//! swarm sim-loop with one call. - -use crate::{ - config::SwarmConfig, - types::Position3D, -}; -use super::synthetic_csi::SyntheticCsiGenerator; - -/// A self-contained demo scenario. -pub struct DemoScenario { - pub name: String, - pub config: SwarmConfig, - pub num_drones: usize, - pub victims: Vec, -} - -/// Aggregate results produced after running a scenario. -#[derive(Debug, Clone)] -pub struct ScenarioResult { - pub victims_found: usize, - pub victims_total: usize, - pub coverage_time_secs: f64, - pub localization_error_m: f64, - pub collision_count: u32, -} - -impl DemoScenario { - /// Standard SAR rubble-field: 3 victims in a 400 × 400 m area. - pub fn sar_rubble_field(num_drones: usize) -> Self { - Self { - name: "SAR Rubble Field".into(), - config: SwarmConfig::demo_default(), - num_drones, - victims: vec![ - Position3D { x: 50.0, y: 80.0, z: 0.0 }, - Position3D { x: 150.0, y: 200.0, z: 0.0 }, - Position3D { x: 300.0, y: 100.0, z: 0.0 }, - ], - } - } - - /// Open-field search: single victim, easy detection conditions. - pub fn open_field_search(num_drones: usize) -> Self { - Self { - name: "Open Field Search".into(), - config: SwarmConfig::demo_default(), - num_drones, - victims: vec![ - Position3D { x: 200.0, y: 150.0, z: 0.0 }, - ], - } - } - - /// Mine/GPS-denied: victims in a narrow corridor, low speed. - pub fn mine_corridor(num_drones: usize) -> Self { - let mut cfg = SwarmConfig::mine_default(); - cfg.demo = Some(crate::config::DemoConfig { - synthetic_csi: true, - victim_positions: vec![[30.0, 10.0, -2.0], [80.0, 15.0, -2.0]], - wind_noise_ms: 0.1, - csi_noise_std: 0.08, - packet_loss_pct: 10.0, - replay_speed: 0.5, - }); - Self { - name: "Mine Corridor GPS-Denied".into(), - config: cfg, - num_drones, - victims: vec![ - Position3D { x: 30.0, y: 10.0, z: -2.0 }, - Position3D { x: 80.0, y: 15.0, z: -2.0 }, - ], - } - } - - /// Build a [`SyntheticCsiGenerator`] from this scenario's config and victims. - pub fn make_csi_generator(&self) -> SyntheticCsiGenerator { - let (noise_std, detection_range_m) = self.config.demo.as_ref().map(|d| { - (d.csi_noise_std, self.config.planning.csi_scan_width_m / 2.0) - }).unwrap_or((0.05, 14.0)); - - SyntheticCsiGenerator::new(self.victims.clone(), noise_std, detection_range_m) - } - - /// Analytic estimate of coverage time (seconds) for this scenario. - /// - /// Formula: `area / (scan_strip × drones) / speed` - /// - /// where `scan_strip = csi_scan_width_m × (1 − lateral_overlap / 100)`. - pub fn estimate_coverage_time_secs(&self) -> f64 { - let p = &self.config.planning; - let m = &self.config.mission; - let area = m.area_width_m * m.area_height_m; - let scan_strip = p.csi_scan_width_m * (1.0 - p.lateral_overlap_pct / 100.0); - if scan_strip <= 0.0 || p.max_speed_ms <= 0.0 || self.num_drones == 0 { - return f64::INFINITY; - } - let total_track_m = area / scan_strip; - let per_drone_track = total_track_m / self.num_drones as f64; - per_drone_track / p.max_speed_ms - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_sar_scenario_coverage_estimate_within_10min() { - // 4-drone SAR swarm over 500 × 500 m at 8 m/s, 20% overlap, 28 m scan width. - // Analytic upper bound: area / (scan_strip × drones × speed) - // = 250_000 / (22.4 × 4 × 8) ≈ 349 s (< 600 s = 10 min battery limit). - let scenario = DemoScenario::sar_rubble_field(4); - let t = scenario.estimate_coverage_time_secs(); - assert!( - t < 600.0, - "4-drone SAR coverage estimate {t:.1} s exceeds 600 s (10 min) battery limit" - ); - // Also verify the estimate is positive and finite. - assert!(t > 0.0 && t.is_finite(), "coverage estimate {t} must be positive and finite"); - } - - #[test] - fn test_open_field_single_victim() { - let scenario = DemoScenario::open_field_search(2); - assert_eq!(scenario.victims.len(), 1); - assert_eq!(scenario.num_drones, 2); - } - - #[test] - fn test_mine_scenario_low_speed() { - let scenario = DemoScenario::mine_corridor(2); - assert!( - scenario.config.planning.max_speed_ms <= 3.0, - "mine scenario max speed should be ≤ 3 m/s, got {}", - scenario.config.planning.max_speed_ms - ); - } - - #[test] - fn test_make_csi_generator_victims_match() { - let scenario = DemoScenario::sar_rubble_field(4); - let gen = scenario.make_csi_generator(); - assert_eq!(gen.victims.len(), scenario.victims.len()); - } -} diff --git a/v2/crates/ruview-swarm/src/demo/synthetic_csi.rs b/v2/crates/ruview-swarm/src/demo/synthetic_csi.rs deleted file mode 100644 index 59657ab2..00000000 --- a/v2/crates/ruview-swarm/src/demo/synthetic_csi.rs +++ /dev/null @@ -1,140 +0,0 @@ -//! Synthetic CSI generator — simulates WiFi CSI victim detections without hardware. -//! -//! Uses exponential distance decay and configurable Gaussian noise to produce -//! realistic CsiDetection events for scenario testing and demo mode. - -use rand::Rng; -use crate::types::{CsiDetection, NodeId, Position3D}; - -/// Generates synthetic CSI detection events for a set of victim positions. -pub struct SyntheticCsiGenerator { - /// Ground-truth victim positions in NED metres. - pub victims: Vec, - /// Std-dev of additive Gaussian noise on confidence and position estimate. - pub noise_std: f64, - /// Maximum range (metres) at which a drone can detect a victim. - pub detection_range_m: f64, -} - -impl SyntheticCsiGenerator { - pub fn new(victims: Vec, noise_std: f64, detection_range_m: f64) -> Self { - Self { victims, noise_std, detection_range_m } - } - - /// Attempt to detect a victim from the given drone position. - /// - /// Returns the strongest detection within range, or `None` if no victim - /// is within `detection_range_m`. Confidence is modelled as - /// `exp(-dist / range)` plus zero-mean Gaussian noise. - pub fn detect( - &self, - drone_id: NodeId, - drone_pos: &Position3D, - timestamp_ms: u64, - ) -> Option { - let mut rng = rand::thread_rng(); - let mut best: Option = None; - - for victim in &self.victims { - let dist = drone_pos.distance_to(victim); - if dist >= self.detection_range_m { - continue; - } - // Exponential decay: full confidence at 0 m, ~37% at 1× range - let base_conf = (-dist / self.detection_range_m).exp(); - let noise: f64 = rng.gen_range(-self.noise_std..self.noise_std); - let confidence = (base_conf + noise).clamp(0.0, 1.0) as f32; - - if confidence <= 0.4 { - continue; - } - - // Add positional noise proportional to noise_std - let pos_jitter = self.noise_std * 10.0; - let est_pos = Position3D { - x: victim.x + rng.gen_range(-pos_jitter..pos_jitter), - y: victim.y + rng.gen_range(-pos_jitter..pos_jitter), - z: victim.z, - }; - - let det = CsiDetection { - drone_id, - confidence, - victim_position: Some(est_pos), - timestamp_ms, - }; - - // Keep the highest-confidence detection - match &best { - None => best = Some(det), - Some(b) if det.confidence > b.confidence => best = Some(det), - _ => {} - } - } - - best - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_detect_close_victim() { - // A victim right on the drone should nearly always return a detection. - // Run 20 trials; at least 15 should detect (0.4 threshold at distance 0). - let gen = SyntheticCsiGenerator::new( - vec![Position3D { x: 0.0, y: 0.0, z: 0.0 }], - 0.01, - 28.0, - ); - let mut hits = 0u32; - for i in 0..20 { - if gen.detect(NodeId(0), &Position3D::zero(), i as u64).is_some() { - hits += 1; - } - } - assert!(hits >= 15, "expected ≥15/20 detections at zero range, got {hits}"); - } - - #[test] - fn test_detect_beyond_range_returns_none() { - let gen = SyntheticCsiGenerator::new( - vec![Position3D { x: 0.0, y: 0.0, z: 0.0 }], - 0.01, - 28.0, - ); - let far_pos = Position3D { x: 1000.0, y: 1000.0, z: 0.0 }; - // All 10 attempts should return None since drone is 1414 m away. - for i in 0..10 { - assert!( - gen.detect(NodeId(0), &far_pos, i).is_none(), - "expected no detection at 1414 m" - ); - } - } - - #[test] - fn test_best_of_two_victims_returned() { - // Two victims: one very close (high conf), one just at boundary (low conf). - let gen = SyntheticCsiGenerator::new( - vec![ - Position3D { x: 1.0, y: 0.0, z: 0.0 }, // close - Position3D { x: 27.0, y: 0.0, z: 0.0 }, // near boundary - ], - 0.01, - 28.0, - ); - // Run 10 trials; whenever both return a detection the close one should win. - for i in 0..10 { - if let Some(det) = gen.detect(NodeId(0), &Position3D::zero(), i) { - assert!( - det.confidence >= 0.4, - "returned confidence {:.3} is below threshold", - det.confidence - ); - } - } - } -} diff --git a/v2/crates/ruview-swarm/src/evals/gdop.rs b/v2/crates/ruview-swarm/src/evals/gdop.rs deleted file mode 100644 index 200c3443..00000000 --- a/v2/crates/ruview-swarm/src/evals/gdop.rs +++ /dev/null @@ -1,118 +0,0 @@ -//! Geometric Dilution of Precision (GDOP) for a constellation of observers. -//! -//! GDOP quantifies how observer geometry amplifies measurement error into -//! position-estimate error. Build the geometry matrix `H` of unit -//! line-of-sight (LOS) vectors from each observer to the target, form the -//! normal matrix `HᵀH`, invert it, and take `GDOP = sqrt(trace((HᵀH)⁻¹))`. -//! -//! For the 2-D (x, y) localization case `H` is `N×2` and `HᵀH` is `2×2`, so a -//! closed-form 2×2 inverse suffices (no linear-algebra dependency needed). -//! -//! Lower GDOP = better geometry: observers spread ~120° apart around the target -//! give low GDOP; (near-)collinear observers give a singular/ill-conditioned -//! `HᵀH` → GDOP → ∞. - -use crate::types::Position3D; - -/// Geometric Dilution of Precision (2-D) for `observers` viewing a `target`. -/// -/// Lower = better geometry. A ~120° constellation → low GDOP; collinear → very -/// large (→∞). Returns `None` if fewer than two observers, if any observer is -/// coincident with the target (undefined LOS), or if the geometry is singular -/// / degenerate (collinear) so `HᵀH` is not invertible. -pub fn gdop(observers: &[Position3D], target: &Position3D) -> Option { - if observers.len() < 2 { - return None; - } - - // Accumulate HᵀH directly (2×2 symmetric) from unit LOS vectors. - // Row i of H is the unit vector from target → observer i in (x, y). - let mut a = 0.0; // sum ux*ux - let mut b = 0.0; // sum ux*uy - let mut d = 0.0; // sum uy*uy - - for obs in observers { - let dx = obs.x - target.x; - let dy = obs.y - target.y; - let range = (dx * dx + dy * dy).sqrt(); - if range < 1e-9 { - // Observer on top of the target → LOS undefined. - return None; - } - let ux = dx / range; - let uy = dy / range; - a += ux * ux; - b += ux * uy; - d += uy * uy; - } - - // Determinant of HᵀH = [[a, b], [b, d]]. - let det = a * d - b * b; - if det.abs() < 1e-12 { - // Singular: observers are (near-)collinear with the target. - return None; - } - - // (HᵀH)⁻¹ = 1/det * [[d, -b], [-b, a]]; trace = (d + a) / det. - let trace_inv = (a + d) / det; - if trace_inv <= 0.0 || !trace_inv.is_finite() { - return None; - } - Some(trace_inv.sqrt()) -} - -#[cfg(test)] -mod tests { - use super::*; - - fn p(x: f64, y: f64) -> Position3D { - Position3D { x, y, z: 0.0 } - } - - #[test] - fn test_triangle_lower_than_collinear() { - let target = p(0.0, 0.0); - // Three observers at 120° around the target, radius 10. - let r = 10.0; - let triangle = [ - p(r * 0.0_f64.cos(), r * 0.0_f64.sin()), - p( - r * (2.0 * std::f64::consts::PI / 3.0).cos(), - r * (2.0 * std::f64::consts::PI / 3.0).sin(), - ), - p( - r * (4.0 * std::f64::consts::PI / 3.0).cos(), - r * (4.0 * std::f64::consts::PI / 3.0).sin(), - ), - ]; - // Three nearly-collinear observers (tiny y perturbation to stay invertible). - let near_collinear = [p(5.0, 0.01), p(10.0, 0.0), p(15.0, 0.01)]; - - let tri = gdop(&triangle, &target).expect("triangle finite GDOP"); - let col = gdop(&near_collinear, &target).expect("near-collinear finite GDOP"); - assert!(tri.is_finite(), "triangle GDOP must be finite: {tri}"); - assert!( - tri < col, - "120° constellation should have lower GDOP than near-collinear: tri={tri}, col={col}" - ); - } - - #[test] - fn test_collinear_degenerate() { - let target = p(0.0, 0.0); - // Perfectly collinear observers along +x → singular HᵀH. - let collinear = [p(5.0, 0.0), p(10.0, 0.0), p(20.0, 0.0)]; - let g = gdop(&collinear, &target); - assert!( - g.is_none() || g.unwrap() > 1e6, - "perfectly collinear geometry must be None or huge, got {g:?}" - ); - } - - #[test] - fn test_single_observer_none() { - let target = p(0.0, 0.0); - assert!(gdop(&[p(5.0, 5.0)], &target).is_none()); - assert!(gdop(&[], &target).is_none()); - } -} diff --git a/v2/crates/ruview-swarm/src/evals/metrics.rs b/v2/crates/ruview-swarm/src/evals/metrics.rs deleted file mode 100644 index adac5850..00000000 --- a/v2/crates/ruview-swarm/src/evals/metrics.rs +++ /dev/null @@ -1,150 +0,0 @@ -//! Per-episode and aggregate SAR + MARL metrics (ADR-171 Stage 1). - -use crate::evals::stats::{stratified_bootstrap_ci, ConfidenceInterval}; - -/// Per-episode SAR metrics (Stage 1 kinematic). -#[derive(Debug, Clone)] -pub struct EpisodeMetrics { - /// Fraction of the mission area scanned at least once, in [0, 1]. - pub coverage_pct: f64, - /// Localization error (m) of the fused victim estimate; `None` if no detection. - pub localization_error_m: Option, - /// GDOP of the contributing-drone constellation at detection; `None` if none. - pub gdop_at_detection: Option, - /// Mission-elapsed seconds to first detection; `None` if no detection. - pub time_to_first_detection_s: Option, - /// Whether at least one victim was detected this episode. - pub detected: bool, - /// Count of inter-drone proximity violations (kinematic proxy for collisions). - pub collisions: u32, - /// Fraction of scanned area covered by more than one drone, in [0, 1]. - pub overlap_ratio: f64, - /// Scalar episodic return (reward-like coverage/detection objective). - pub episodic_return: f64, -} - -/// Aggregate over a seed × episode matrix with IQM + 95% bootstrap CIs. -#[derive(Debug, Clone)] -pub struct AggregateMetrics { - pub coverage_iqm: ConfidenceInterval, - /// IQM over detected episodes only (undetected episodes carry no error). - pub localization_iqm: ConfidenceInterval, - pub detection_rate: f64, - pub mean_gdop: f64, - pub return_iqm: ConfidenceInterval, - pub n_episodes: usize, -} - -impl AggregateMetrics { - /// Aggregate a seed-stratified matrix of episodes. Each inner `Vec` is one - /// seed's episodes; bootstrap resampling is stratified by seed so the CI - /// reflects between-seed variance (the dominant source per ADR-171). - pub fn from_strata(per_seed: &[Vec], boot_seed: u64) -> Self { - const N_BOOT: usize = 1000; - - let coverage_strata: Vec> = per_seed - .iter() - .map(|s| s.iter().map(|e| e.coverage_pct).collect()) - .collect(); - let return_strata: Vec> = per_seed - .iter() - .map(|s| s.iter().map(|e| e.episodic_return).collect()) - .collect(); - // Localization: only detected episodes contribute. Keep stratification - // by seed but drop empty strata so the bootstrap doesn't degenerate. - let loc_strata: Vec> = per_seed - .iter() - .map(|s| { - s.iter() - .filter_map(|e| e.localization_error_m) - .collect::>() - }) - .filter(|v: &Vec| !v.is_empty()) - .collect(); - - let mut detected = 0usize; - let mut total = 0usize; - let mut gdop_sum = 0.0; - let mut gdop_n = 0usize; - for seed in per_seed { - for e in seed { - total += 1; - if e.detected { - detected += 1; - } - if let Some(g) = e.gdop_at_detection { - if g.is_finite() { - gdop_sum += g; - gdop_n += 1; - } - } - } - } - - let detection_rate = if total == 0 { - 0.0 - } else { - detected as f64 / total as f64 - }; - let mean_gdop = if gdop_n == 0 { - 0.0 - } else { - gdop_sum / gdop_n as f64 - }; - - AggregateMetrics { - coverage_iqm: stratified_bootstrap_ci(&coverage_strata, N_BOOT, boot_seed), - localization_iqm: stratified_bootstrap_ci( - &loc_strata, - N_BOOT, - boot_seed.wrapping_add(1), - ), - detection_rate, - mean_gdop, - return_iqm: stratified_bootstrap_ci( - &return_strata, - N_BOOT, - boot_seed.wrapping_add(2), - ), - n_episodes: total, - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - fn ep(cov: f64, loc: Option, ret: f64, detected: bool) -> EpisodeMetrics { - EpisodeMetrics { - coverage_pct: cov, - localization_error_m: loc, - gdop_at_detection: if detected { Some(2.0) } else { None }, - time_to_first_detection_s: if detected { Some(10.0) } else { None }, - detected, - collisions: 0, - overlap_ratio: 0.1, - episodic_return: ret, - } - } - - #[test] - fn test_aggregate_detection_rate_and_shape() { - let per_seed = vec![ - vec![ - ep(0.8, Some(1.5), 80.0, true), - ep(0.7, None, 70.0, false), - ], - vec![ - ep(0.9, Some(2.0), 90.0, true), - ep(0.85, Some(1.0), 85.0, true), - ], - ]; - let agg = AggregateMetrics::from_strata(&per_seed, 7); - assert_eq!(agg.n_episodes, 4); - assert!((agg.detection_rate - 0.75).abs() < 1e-9); - assert!(agg.coverage_iqm.lo <= agg.coverage_iqm.point); - assert!(agg.coverage_iqm.point <= agg.coverage_iqm.hi); - assert!(agg.mean_gdop > 0.0); - } -} diff --git a/v2/crates/ruview-swarm/src/evals/mod.rs b/v2/crates/ruview-swarm/src/evals/mod.rs deleted file mode 100644 index 4136355c..00000000 --- a/v2/crates/ruview-swarm/src/evals/mod.rs +++ /dev/null @@ -1,19 +0,0 @@ -//! ADR-171 statistically-rigorous evaluation harness (Stage 1, kinematic). -//! -//! Produces SAR + MARL metrics over a seeded N-seed × M-episode matrix with -//! IQM + 95% stratified-bootstrap CIs, a (sigma, kappa) CSI-noise sweep, and -//! GDOP-stratified localization error. Generates evals/RESULTS.md. -//! -//! Stage 2 (Gazebo/PX4 SITL high-fidelity, false-alarm + collision rate on the -//! median seeds) is a follow-on — see ADR-171 §6.1. -pub mod gdop; -pub mod stats; -pub mod metrics; -pub mod runner; -pub mod report; - -pub use gdop::gdop; -pub use stats::{iqm, stratified_bootstrap_ci, ConfidenceInterval}; -pub use metrics::{EpisodeMetrics, AggregateMetrics}; -pub use runner::{EvalConfig, NoiseLevel, run_matrix}; -pub use report::render_results_md; diff --git a/v2/crates/ruview-swarm/src/evals/report.rs b/v2/crates/ruview-swarm/src/evals/report.rs deleted file mode 100644 index eb7c90a0..00000000 --- a/v2/crates/ruview-swarm/src/evals/report.rs +++ /dev/null @@ -1,120 +0,0 @@ -//! RESULTS.md leaderboard generator (ADR-171 Stage 1). - -use crate::evals::metrics::AggregateMetrics; -use crate::evals::stats::ConfidenceInterval; - -/// Wi2SAR published localization baseline (paper-to-paper), metres. -const WI2SAR_LOCALIZATION_M: f64 = 5.0; - -/// Format a CI as `point [lo, hi]` with two decimals. -fn fmt_ci(ci: &ConfidenceInterval) -> String { - format!("{:.3} [{:.3}, {:.3}]", ci.point, ci.lo, ci.hi) -} - -/// Render a markdown leaderboard: one row per flight pattern with coverage -/// IQM±CI, localization IQM±CI, detection rate, and mean GDOP — plus the -/// Wi2SAR paper baseline row clearly labelled paper-to-paper. -/// -/// `rows` is `(pattern_name, aggregate)`; rows are emitted in the order given, -/// so callers should pre-sort (e.g. by descending coverage point estimate). -pub fn render_results_md(rows: &[(String, AggregateMetrics)]) -> String { - let mut s = String::new(); - s.push_str("# ruview-swarm Evaluation Results (ADR-171 Stage 1, kinematic)\n\n"); - s.push_str( - "Statistically-rigorous evaluation harness: seeded multi-run rollouts with \ - IQM + 95% stratified-bootstrap confidence intervals (Agarwal et al., \ - NeurIPS 2021).\n\n", - ); - - // Run configuration header. - let (n_episodes, n_seeds) = rows - .first() - .map(|(_, a)| { - let n = a.n_episodes; - // Episodes-per-seed isn't stored; report total + leave seed split to caller note. - (n, 0usize) - }) - .unwrap_or((0, 0)); - s.push_str("## Run configuration\n\n"); - s.push_str(&format!( - "- **Stage**: 1 (kinematic, self-contained, deterministic per seed)\n\ - - **Episodes per pattern**: {n_episodes} (seed × episode matrix)\n\ - - **CI method**: 95% stratified bootstrap of the IQM, stratified by seed\n\ - - **GDOP**: 2-D geometric dilution of precision at first detection\n" - )); - let _ = n_seeds; - s.push_str( - "\n> **Stage 2 pending**: high-fidelity Gazebo/PX4 SITL evaluation \ - (false-alarm rate, real collision rate on the median seeds) is a \ - follow-on — see ADR-171 §6.1. The collision figures below are a \ - kinematic min-separation proxy, not SITL physics.\n\n", - ); - - // Leaderboard table. - s.push_str("## Flight-pattern leaderboard\n\n"); - s.push_str( - "| Flight pattern | Coverage IQM [95% CI] | Localization (m) IQM [95% CI] | \ - Detection rate | Mean GDOP |\n", - ); - s.push_str( - "|----------------|-----------------------|-------------------------------|\ - ----------------|-----------|\n", - ); - for (name, agg) in rows { - s.push_str(&format!( - "| {} | {} | {} | {:.1}% | {:.3} |\n", - name, - fmt_ci(&agg.coverage_iqm), - fmt_ci(&agg.localization_iqm), - agg.detection_rate * 100.0, - agg.mean_gdop, - )); - } - // Wi2SAR paper baseline row (paper-to-paper, no kinematic re-run). - s.push_str(&format!( - "| _Wi2SAR (paper baseline)_ | _n/a_ | _{:.1} (paper)_ | _n/a_ | _n/a_ |\n", - WI2SAR_LOCALIZATION_M, - )); - - s.push_str( - "\n_Wi2SAR row is the published single-drone localization figure \ - (arxiv 2604.09115), shown paper-to-paper for reference only — it was \ - not re-run through this kinematic harness._\n", - ); - - s -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::evals::stats::ConfidenceInterval; - - fn agg(cov: f64, det: f64) -> AggregateMetrics { - let ci = |p: f64| ConfidenceInterval { point: p, lo: p - 0.05, hi: p + 0.05 }; - AggregateMetrics { - coverage_iqm: ci(cov), - localization_iqm: ci(1.5), - detection_rate: det, - mean_gdop: 2.1, - return_iqm: ci(80.0), - n_episodes: 100, - } - } - - #[test] - fn test_render_contains_rows_and_baseline() { - let rows = vec![ - ("partitioned_lawnmower".to_string(), agg(0.92, 0.95)), - ("levy_flight".to_string(), agg(0.40, 0.50)), - ]; - let md = render_results_md(&rows); - assert!(md.contains("partitioned_lawnmower")); - assert!(md.contains("levy_flight")); - assert!(md.contains("Wi2SAR")); - assert!(md.contains("Stage 2 pending")); - assert!(md.contains("95% stratified bootstrap")); - // Coverage point estimate appears. - assert!(md.contains("0.920")); - } -} diff --git a/v2/crates/ruview-swarm/src/evals/runner.rs b/v2/crates/ruview-swarm/src/evals/runner.rs deleted file mode 100644 index fb210ce5..00000000 --- a/v2/crates/ruview-swarm/src/evals/runner.rs +++ /dev/null @@ -1,364 +0,0 @@ -//! Stage-1 kinematic rollout + seed × episode matrix (ADR-171). -//! -//! A single `run_episode` deterministically drives `drones` drones across a -//! mission area under a chosen [`FlightPattern`], marks coverage on a grid, -//! simulates CSI victim detection perturbed by `(sigma, kappa)` amplitude / -//! von-Mises-phase noise, and computes the GDOP of the contributing-drone -//! constellation at first detection. It is self-contained and seeded — no -//! Candle / training backend required — so it runs in CI by default. - -use crate::config::SwarmConfig; -use crate::evals::gdop::gdop; -use crate::evals::metrics::EpisodeMetrics; -use crate::planning::patterns::{FlightPattern, PatternContext}; -use crate::types::{NodeId, Position3D}; - -/// CSI-noise level: amplitude std `sigma` and von-Mises phase concentration `kappa`. -/// Higher `sigma` = noisier amplitude; *lower* `kappa` = noisier phase (more diffuse). -#[derive(Debug, Clone, Copy)] -pub struct NoiseLevel { - pub sigma: f64, - pub kappa: f64, -} - -/// One evaluation configuration: a flight pattern + swarm/mission parameters. -#[derive(Debug, Clone)] -pub struct EvalConfig { - pub flight: FlightPattern, - pub config: SwarmConfig, - pub drones: usize, - pub steps: usize, - pub seeds: usize, // ≥10 per ADR-171 - pub episodes_per_seed: usize, // e.g. 50 - pub victims: Vec, - pub noise: NoiseLevel, -} - -impl EvalConfig { - /// A small SAR default suitable for fast CI runs. - pub fn sar_small(flight: FlightPattern) -> Self { - EvalConfig { - flight, - config: SwarmConfig::sar_default(), - drones: 4, - steps: 120, - seeds: 10, - episodes_per_seed: 10, - victims: vec![ - Position3D { x: 120.0, y: 90.0, z: 0.0 }, - Position3D { x: 320.0, y: 280.0, z: 0.0 }, - ], - noise: NoiseLevel { sigma: 0.05, kappa: 8.0 }, - } - } -} - -/// Minimal reproducible LCG → f64 in [0, 1). Self-contained for determinism. -struct Lcg(u64); -impl Lcg { - fn new(seed: u64) -> Self { - Lcg(seed ^ 0xD1B5_4A32_D192_ED03) - } - #[inline] - fn next_u64(&mut self) -> u64 { - self.0 = self - .0 - .wrapping_mul(6364136223846793005) - .wrapping_add(1442695040888963407); - self.0 - } - #[inline] - fn unit(&mut self) -> f64 { - (self.next_u64() >> 11) as f64 / (1u64 << 53) as f64 - } - /// Standard-normal sample via Box–Muller (deterministic). - #[inline] - fn normal(&mut self) -> f64 { - let u1 = self.unit().max(1e-12); - let u2 = self.unit(); - (-2.0 * u1.ln()).sqrt() * (2.0 * std::f64::consts::PI * u2).cos() - } -} - -/// Run one kinematic episode deterministically from `seed`. -/// -/// Drives drones step-by-step by the flight pattern, marks a coarse coverage -/// grid, and on the first step a drone comes within scan range of any victim -/// records a fused localization estimate (weighted centroid of contributing -/// drones' per-drone victim estimates, each perturbed by `(sigma, kappa)` -/// noise) and the GDOP of those contributing drones. -pub fn run_episode(cfg: &EvalConfig, seed: u64) -> EpisodeMetrics { - let mut rng = Lcg::new(seed); - - let area_w = cfg.config.mission.area_width_m; - let area_h = cfg.config.mission.area_height_m; - let altitude_z = -cfg.config.planning.flight_altitude_m; - let scan_width = cfg.config.planning.csi_scan_width_m.max(1.0); - let min_sep = cfg.config.formation.min_separation_m.max(0.1); - let n = cfg.drones.max(1); - - // Coverage grid sized so each cell ~= scan_width. - let gx = ((area_w / scan_width).ceil() as usize).max(1); - let gy = ((area_h / scan_width).ceil() as usize).max(1); - let cell_w = area_w / gx as f64; - let cell_h = area_h / gy as f64; - let mut cover_count = vec![0u32; gx * gy]; - - // Spread drones along the bottom edge with a small seeded jitter. - let mut positions: Vec = (0..n) - .map(|i| { - let frac = (i as f64 + 0.5) / n as f64; - Position3D { - x: (frac * area_w + (rng.unit() - 0.5) * scan_width).clamp(0.0, area_w), - y: (rng.unit() * scan_width).clamp(0.0, area_h), - z: altitude_z, - } - }) - .collect(); - - // Recent-visit ring buffer for pheromone / potential-field patterns. - let mut visited: Vec = Vec::new(); - let max_visited = 32usize; - - let scan_range = scan_width; // detect a victim within one scan footprint - let mut collisions = 0u32; - let mut detected = false; - let mut loc_error: Option = None; - let mut gdop_val: Option = None; - let mut t_detect: Option = None; - - let dt = step_seconds(cfg); - - for step in 0..cfg.steps { - // Advance each drone one waypoint under the pattern. - let snapshot = positions.clone(); - for (i, pos) in positions.iter_mut().enumerate() { - let peers: Vec = snapshot - .iter() - .enumerate() - .filter(|(j, _)| *j != i) - .map(|(_, p)| *p) - .collect(); - let ctx = PatternContext { - drone_id: NodeId(i as u32), - swarm_size: n, - current: *pos, - area_w, - area_h, - altitude_z, - scan_width_m: scan_width, - step: step as u64, - visited: &visited, - peers: &peers, - }; - *pos = cfg.flight.next_target(&ctx); - } - - // Mark coverage + record visits. - for pos in &positions { - let cx = ((pos.x / cell_w).floor() as i64).clamp(0, gx as i64 - 1) as usize; - let cy = ((pos.y / cell_h).floor() as i64).clamp(0, gy as i64 - 1) as usize; - cover_count[cy * gx + cx] = cover_count[cy * gx + cx].saturating_add(1); - visited.push(*pos); - } - if visited.len() > max_visited { - let drop = visited.len() - max_visited; - visited.drain(0..drop); - } - - // Proximity / collision check (kinematic proxy). - for a in 0..positions.len() { - for b in (a + 1)..positions.len() { - let d = positions[a].distance_to(&positions[b]); - if d < min_sep { - collisions = collisions.saturating_add(1); - } - } - } - - // Detection: first step any victim falls within scan range of ≥1 drone, - // fuse a localization estimate from the contributing drones. A single - // contributor still yields a (noisier) estimate; GDOP is only defined - // for the multistatic ≥2-drone case and is `None` otherwise. - if !detected { - for victim in &cfg.victims { - let contributors: Vec = positions - .iter() - .filter(|p| horiz_dist(p, victim) <= scan_range) - .copied() - .collect(); - if !contributors.is_empty() { - let (est, g) = fuse_estimate(&contributors, victim, cfg.noise, &mut rng); - loc_error = Some(horiz_dist(&est, victim)); - gdop_val = g; // None for a single contributor - t_detect = Some((step as f64 + 1.0) * dt); - detected = true; - break; - } - } - } - } - - // Coverage + overlap. - let total_cells = (gx * gy) as f64; - let scanned = cover_count.iter().filter(|&&c| c > 0).count() as f64; - let overlapped = cover_count.iter().filter(|&&c| c > 1).count() as f64; - let coverage_pct = if total_cells > 0.0 { scanned / total_cells } else { 0.0 }; - let overlap_ratio = if scanned > 0.0 { overlapped / scanned } else { 0.0 }; - - // Episodic return: reward coverage + detection, penalize overlap + collisions. - let detect_bonus = if detected { 1.0 } else { 0.0 }; - let loc_term = match loc_error { - Some(e) => (1.0 / (1.0 + e)).max(0.0), - None => 0.0, - }; - let episodic_return = 100.0 * coverage_pct + 30.0 * detect_bonus + 20.0 * loc_term - - 10.0 * overlap_ratio - - 5.0 * collisions as f64; - - EpisodeMetrics { - coverage_pct, - localization_error_m: loc_error, - gdop_at_detection: gdop_val, - time_to_first_detection_s: t_detect, - detected, - collisions, - overlap_ratio, - episodic_return, - } -} - -/// Per-step wall-clock seconds, derived from scan width and drone speed. -fn step_seconds(cfg: &EvalConfig) -> f64 { - let speed = cfg.config.planning.max_speed_ms.max(0.1); - (cfg.config.planning.csi_scan_width_m.max(1.0) / speed).max(0.1) -} - -/// Horizontal (x, y) distance, ignoring altitude. -fn horiz_dist(a: &Position3D, b: &Position3D) -> f64 { - (a.x - b.x).hypot(a.y - b.y) -} - -/// Fuse contributing drones' per-drone victim estimates into a weighted -/// centroid, perturbed by `(sigma, kappa)` CSI noise, and compute the GDOP of -/// the contributing constellation. -fn fuse_estimate( - contributors: &[Position3D], - victim: &Position3D, - noise: NoiseLevel, - rng: &mut Lcg, -) -> (Position3D, Option) { - // Phase noise std from von Mises concentration: sigma_phase ≈ 1/sqrt(kappa). - let phase_std = 1.0 / noise.kappa.max(1e-3).sqrt(); - let mut sx = 0.0; - let mut sy = 0.0; - let mut wsum = 0.0; - for c in contributors { - let range = horiz_dist(c, victim).max(1e-6); - // Each drone's estimate = true victim + range-scaled amplitude noise + - // bearing error from phase noise (perpendicular to LOS). - let amp = noise.sigma * range; - let nx = rng.normal() * amp; - let ny = rng.normal() * amp; - // Bearing wobble: rotate LOS unit vector by a small phase-noise angle. - let bearing = (victim.y - c.y).atan2(victim.x - c.x); - let dtheta = rng.normal() * phase_std; - let bx = range * (bearing + dtheta).cos(); - let by = range * (bearing + dtheta).sin(); - let est_x = c.x + bx + nx; - let est_y = c.y + by + ny; - // Inverse-range weighting: closer drones trusted more. - let w = 1.0 / range; - sx += est_x * w; - sy += est_y * w; - wsum += w; - } - let w = wsum.max(1e-9); - let est = Position3D { x: sx / w, y: sy / w, z: 0.0 }; - let g = gdop(contributors, victim); - (est, g) -} - -/// Run the full seed × episode matrix → per-seed strata of [`EpisodeMetrics`]. -pub fn run_matrix(cfg: &EvalConfig) -> Vec> { - (0..cfg.seeds) - .map(|s| { - (0..cfg.episodes_per_seed) - .map(|e| { - // Distinct deterministic seed per (seed, episode) cell. - let cell_seed = (s as u64) - .wrapping_mul(0x100_0000) - .wrapping_add(e as u64) - .wrapping_add(0xABCD); - run_episode(cfg, cell_seed) - }) - .collect() - }) - .collect() -} - -/// Standard ADR-171 noise sweep grid: cartesian product of σ × κ levels. -pub fn default_noise_sweep() -> Vec { - let sigmas = [0.02, 0.05, 0.10]; - let kappas = [16.0, 8.0, 4.0]; - let mut out = Vec::with_capacity(sigmas.len() * kappas.len()); - for &sigma in &sigmas { - for &kappa in &kappas { - out.push(NoiseLevel { sigma, kappa }); - } - } - out -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_run_episode_deterministic() { - let cfg = EvalConfig::sar_small(FlightPattern::PartitionedLawnmower); - let a = run_episode(&cfg, 12345); - let b = run_episode(&cfg, 12345); - assert_eq!(a.coverage_pct, b.coverage_pct); - assert_eq!(a.detected, b.detected); - assert_eq!(a.localization_error_m, b.localization_error_m); - assert_eq!(a.collisions, b.collisions); - assert_eq!(a.episodic_return, b.episodic_return); - } - - #[test] - fn test_partitioned_beats_levy_coverage() { - let mut part = EvalConfig::sar_small(FlightPattern::PartitionedLawnmower); - part.seeds = 3; - part.episodes_per_seed = 5; - let mut levy = part.clone(); - levy.flight = FlightPattern::LevyFlight; - - let part_m = run_matrix(&part); - let levy_m = run_matrix(&levy); - let part_agg = crate::evals::metrics::AggregateMetrics::from_strata(&part_m, 1); - let levy_agg = crate::evals::metrics::AggregateMetrics::from_strata(&levy_m, 1); - assert!( - part_agg.coverage_iqm.point > levy_agg.coverage_iqm.point, - "partitioned coverage {} should beat levy {}", - part_agg.coverage_iqm.point, - levy_agg.coverage_iqm.point - ); - } - - #[test] - fn test_matrix_shape() { - let mut cfg = EvalConfig::sar_small(FlightPattern::Spiral); - cfg.seeds = 4; - cfg.episodes_per_seed = 6; - let m = run_matrix(&cfg); - assert_eq!(m.len(), 4); - assert!(m.iter().all(|s| s.len() == 6)); - } - - #[test] - fn test_noise_sweep_grid() { - let sweep = default_noise_sweep(); - assert_eq!(sweep.len(), 9); - } -} diff --git a/v2/crates/ruview-swarm/src/evals/stats.rs b/v2/crates/ruview-swarm/src/evals/stats.rs deleted file mode 100644 index 4dc6315a..00000000 --- a/v2/crates/ruview-swarm/src/evals/stats.rs +++ /dev/null @@ -1,203 +0,0 @@ -//! Hand-rolled robust statistics for the evaluation harness (Agarwal 2021). -//! -//! Implements the interquartile mean (IQM), a 95% stratified-bootstrap -//! confidence interval of the IQM, and the probability-of-improvement metric — -//! the three statistics recommended by "Deep RL at the Edge of the -//! Statistical Precipice" (Agarwal et al., NeurIPS 2021) for reporting -//! few-seed RL results. -//! -//! All randomness comes from a local linear-congruential generator (LCG) seeded -//! explicitly, so every CI is fully reproducible — no `thread_rng`, no clock. - -/// Interquartile mean: mean of the middle 50% of samples (drop the bottom 25% -/// and the top 25%). Robust to outliers in either tail. -/// -/// Small-N behaviour: with fewer than 4 samples the trim would empty the set, -/// so it falls back to the plain arithmetic mean. An empty slice returns 0.0. -pub fn iqm(samples: &[f64]) -> f64 { - if samples.is_empty() { - return 0.0; - } - if samples.len() < 4 { - return samples.iter().sum::() / samples.len() as f64; - } - let mut sorted = samples.to_vec(); - sorted.sort_by(|a, b| a.partial_cmp(b).unwrap_or(std::cmp::Ordering::Equal)); - let n = sorted.len(); - let lo = n / 4; // trim bottom 25% - let hi = n - lo; // trim top 25% (symmetric) - let mid = &sorted[lo..hi]; - if mid.is_empty() { - return sorted.iter().sum::() / n as f64; - } - mid.iter().sum::() / mid.len() as f64 -} - -/// A point estimate with its lower / upper 95% confidence bounds. -#[derive(Debug, Clone, Copy)] -pub struct ConfidenceInterval { - pub point: f64, - pub lo: f64, - pub hi: f64, -} - -/// Minimal reproducible LCG (Numerical Recipes constants) yielding f64 in [0,1). -struct Lcg(u64); - -impl Lcg { - fn new(seed: u64) -> Self { - // Avoid a zero state collapsing the generator. - Lcg(seed ^ 0x9E37_79B9_7F4A_7C15) - } - #[inline] - fn next_u64(&mut self) -> u64 { - self.0 = self - .0 - .wrapping_mul(6364136223846793005) - .wrapping_add(1442695040888963407); - self.0 - } - /// Uniform index in [0, n). - #[inline] - fn index(&mut self, n: usize) -> usize { - if n == 0 { - return 0; - } - (self.next_u64() >> 11) as usize % n - } -} - -/// 95% stratified-bootstrap CI of the IQM. -/// -/// `strata` groups samples (one inner `Vec` per stratum, e.g. per task or per -/// seed). Each bootstrap replicate resamples WITH replacement *within* each -/// stratum (preserving the stratum sizes), pools all resampled values, and -/// recomputes the IQM. Repeat `n_boot` times and take the 2.5 / 97.5 -/// percentiles for the CI bounds. The `point` estimate is the IQM of the pooled -/// original samples. Deterministic for a fixed `seed`. -pub fn stratified_bootstrap_ci( - strata: &[Vec], - n_boot: usize, - seed: u64, -) -> ConfidenceInterval { - let pooled: Vec = strata.iter().flatten().copied().collect(); - let point = iqm(&pooled); - - if pooled.is_empty() || n_boot == 0 { - return ConfidenceInterval { point, lo: point, hi: point }; - } - - let mut rng = Lcg::new(seed); - let mut replicates = Vec::with_capacity(n_boot); - let mut buf: Vec = Vec::with_capacity(pooled.len()); - - for _ in 0..n_boot { - buf.clear(); - for stratum in strata { - let m = stratum.len(); - for _ in 0..m { - buf.push(stratum[rng.index(m)]); - } - } - replicates.push(iqm(&buf)); - } - - replicates.sort_by(|a, b| a.partial_cmp(b).unwrap_or(std::cmp::Ordering::Equal)); - let lo = percentile(&replicates, 2.5); - let hi = percentile(&replicates, 97.5); - ConfidenceInterval { point, lo, hi } -} - -/// Linear-interpolated percentile of a pre-sorted slice. `p` in [0, 100]. -fn percentile(sorted: &[f64], p: f64) -> f64 { - if sorted.is_empty() { - return 0.0; - } - if sorted.len() == 1 { - return sorted[0]; - } - let rank = (p / 100.0) * (sorted.len() as f64 - 1.0); - let lo = rank.floor() as usize; - let hi = rank.ceil() as usize; - if lo == hi { - return sorted[lo]; - } - let frac = rank - lo as f64; - sorted[lo] * (1.0 - frac) + sorted[hi] * frac -} - -/// Probability of improvement: P(a-sample > b-sample) over all pairs (Agarwal). -/// -/// Counts each (a_i, b_j) pair where `a_i > b_j` as 1, a tie as 0.5, and -/// normalizes by the pair count. 1.0 means `a` strictly dominates; ~0.5 means -/// the two are statistically indistinguishable. Returns 0.5 if either is empty. -pub fn probability_of_improvement(a: &[f64], b: &[f64]) -> f64 { - if a.is_empty() || b.is_empty() { - return 0.5; - } - let mut wins = 0.0; - for &ai in a { - for &bj in b { - if ai > bj { - wins += 1.0; - } else if (ai - bj).abs() < f64::EPSILON { - wins += 0.5; - } - } - } - wins / (a.len() as f64 * b.len() as f64) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_iqm_trims_outliers() { - // 0..=100 plus one extreme outlier; IQM should sit near the middle (~50), - // not be dragged toward 1e9. - let mut samples: Vec = (0..=100).map(|i| i as f64).collect(); - samples.push(1e9); - let v = iqm(&samples); - assert!( - (40.0..=60.0).contains(&v), - "IQM should be near the middle-50% mean (~50), got {v}" - ); - } - - #[test] - fn test_iqm_small() { - // Fewer than 4 samples → plain mean. - assert_eq!(iqm(&[2.0, 4.0]), 3.0); - assert_eq!(iqm(&[10.0]), 10.0); - assert_eq!(iqm(&[1.0, 2.0, 3.0]), 2.0); - assert_eq!(iqm(&[]), 0.0); - } - - #[test] - fn test_bootstrap_ci_brackets_point() { - let strata = vec![ - vec![1.0, 2.0, 3.0, 4.0, 5.0], - vec![2.0, 3.0, 4.0, 5.0, 6.0], - ]; - let ci = stratified_bootstrap_ci(&strata, 500, 42); - assert!(ci.lo <= ci.point, "lo ≤ point: {} ≤ {}", ci.lo, ci.point); - assert!(ci.point <= ci.hi, "point ≤ hi: {} ≤ {}", ci.point, ci.hi); - // Deterministic: same seed → identical interval. - let ci2 = stratified_bootstrap_ci(&strata, 500, 42); - assert_eq!(ci.point, ci2.point); - assert_eq!(ci.lo, ci2.lo); - assert_eq!(ci.hi, ci2.hi); - } - - #[test] - fn test_prob_improvement_obvious() { - assert_eq!( - probability_of_improvement(&[10.0, 10.0, 10.0], &[0.0, 0.0, 0.0]), - 1.0 - ); - // Identical samples → all ties → 0.5. - let poi = probability_of_improvement(&[5.0, 5.0], &[5.0, 5.0]); - assert!((poi - 0.5).abs() < 1e-9, "symmetric ties → ~0.5, got {poi}"); - } -} diff --git a/v2/crates/ruview-swarm/src/failsafe/mod.rs b/v2/crates/ruview-swarm/src/failsafe/mod.rs deleted file mode 100644 index bcfa380e..00000000 --- a/v2/crates/ruview-swarm/src/failsafe/mod.rs +++ /dev/null @@ -1,191 +0,0 @@ -//! Fail-safe state machine: link loss, low battery, collision avoidance. - -use crate::types::DroneState; -use serde::{Deserialize, Serialize}; -use std::time::Instant; - -/// Fail-safe operating state. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub enum FailSafeState { - Nominal, - AutonomousHold, - LowBatteryWarn, - ReturnToHome, - EmergencyLand, - EmergencyDiverge, - ControlledDescent, -} - -/// State machine driving fail-safe transitions. -pub struct FailSafeMachine { - state: FailSafeState, - link_loss_start: Option, - pub link_loss_hold_secs: f64, - pub link_loss_rth_secs: f64, - pub battery_warn_pct: f32, - pub battery_rth_pct: f32, - pub collision_dist_m: f64, -} - -impl FailSafeMachine { - pub fn new() -> Self { - Self { - state: FailSafeState::Nominal, - link_loss_start: None, - link_loss_hold_secs: 3.0, - link_loss_rth_secs: 30.0, - battery_warn_pct: 20.0, - battery_rth_pct: 15.0, - collision_dist_m: 1.5, - } - } - - /// Drive one tick. Returns the current state after evaluation. - pub fn tick( - &mut self, - state: &DroneState, - link_alive: bool, - nearest_neighbor_dist: f64, - ) -> FailSafeState { - // Collision avoidance has highest priority. - // - // Fail CLOSED on a non-finite neighbour distance. `nearest_neighbor_dist` - // is derived from peer positions (see - // `SwarmOrchestrator::nearest_peer_distance`), which arrive over the - // untrusted swarm comm layer as `DroneState` values whose f64 position - // fields can deserialize to NaN/Inf. A naive `NaN < collision_dist_m` - // evaluates to `false`, silently DISABLING collision avoidance — the - // worst possible failure for a physical drone. Treat a non-finite - // distance as "too close" so the swarm diverges rather than trusting a - // poisoned reading. - if !nearest_neighbor_dist.is_finite() || nearest_neighbor_dist < self.collision_dist_m { - self.state = FailSafeState::EmergencyDiverge; - return self.state.clone(); - } - - // Link loss handling - if !link_alive { - let start = self.link_loss_start.get_or_insert_with(Instant::now); - let elapsed = start.elapsed().as_secs_f64(); - if elapsed > self.link_loss_rth_secs { - self.state = FailSafeState::ReturnToHome; - } else if elapsed > self.link_loss_hold_secs { - self.state = FailSafeState::AutonomousHold; - } - return self.state.clone(); - } else { - // Link restored - self.link_loss_start = None; - if self.state == FailSafeState::AutonomousHold { - self.state = FailSafeState::Nominal; - } - } - - // Battery checks. A non-finite battery reading (NaN/Inf from a corrupt or - // forged telemetry/peer message) must fail CLOSED: `NaN <= threshold` is - // `false`, which would otherwise let a drone with an unknown battery - // level keep flying nominally. Treat a non-finite reading as critical. - if !state.battery_pct.is_finite() || state.battery_pct <= self.battery_rth_pct { - self.state = FailSafeState::ReturnToHome; - } else if state.battery_pct <= self.battery_warn_pct { - self.state = FailSafeState::LowBatteryWarn; - } else if self.state == FailSafeState::LowBatteryWarn { - // Recovered from low battery (charged on the fly / wrong reading) - self.state = FailSafeState::Nominal; - } - - self.state.clone() - } - - pub fn current(&self) -> &FailSafeState { - &self.state - } - - pub fn force_land(&mut self) { - self.state = FailSafeState::EmergencyLand; - } -} - -impl Default for FailSafeMachine { - fn default() -> Self { - Self::new() - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::types::NodeId; - - fn good_state() -> DroneState { - let mut s = DroneState::default_at_origin(NodeId(1)); - s.battery_pct = 80.0; - s.link_quality = 1.0; - s - } - - #[test] - fn test_nominal_when_healthy() { - let mut fsm = FailSafeMachine::new(); - let s = good_state(); - let result = fsm.tick(&s, true, 10.0); - assert_eq!(result, FailSafeState::Nominal); - } - - #[test] - fn test_low_battery_warn() { - let mut fsm = FailSafeMachine::new(); - let mut s = good_state(); - s.battery_pct = 18.0; - let result = fsm.tick(&s, true, 10.0); - assert_eq!(result, FailSafeState::LowBatteryWarn); - } - - #[test] - fn test_battery_rth() { - let mut fsm = FailSafeMachine::new(); - let mut s = good_state(); - s.battery_pct = 10.0; - let result = fsm.tick(&s, true, 10.0); - assert_eq!(result, FailSafeState::ReturnToHome); - } - - #[test] - fn test_collision_avoidance() { - let mut fsm = FailSafeMachine::new(); - let s = good_state(); - let result = fsm.tick(&s, true, 0.5); // too close - assert_eq!(result, FailSafeState::EmergencyDiverge); - } - - /// Security: a NaN neighbour distance (poisoned peer position over the swarm - /// comm layer) must NOT silently disable collision avoidance. Fails on old - /// code where `NaN < collision_dist_m` is `false` and the state stays Nominal. - #[test] - fn test_nan_neighbor_distance_fails_closed_to_diverge() { - let mut fsm = FailSafeMachine::new(); - let s = good_state(); - let result = fsm.tick(&s, true, f64::NAN); - assert_eq!( - result, - FailSafeState::EmergencyDiverge, - "non-finite neighbour distance must fail closed to EmergencyDiverge" - ); - } - - /// Security: a NaN battery reading must fail closed to ReturnToHome rather - /// than being treated as a healthy battery. Fails on old code where - /// `NaN <= battery_rth_pct` is `false` and the drone stays Nominal. - #[test] - fn test_nan_battery_fails_closed_to_rth() { - let mut fsm = FailSafeMachine::new(); - let mut s = good_state(); - s.battery_pct = f32::NAN; - let result = fsm.tick(&s, true, 10.0); - assert_eq!( - result, - FailSafeState::ReturnToHome, - "non-finite battery must fail closed to ReturnToHome" - ); - } -} diff --git a/v2/crates/ruview-swarm/src/formation/leader_follower.rs b/v2/crates/ruview-swarm/src/formation/leader_follower.rs deleted file mode 100644 index e319e534..00000000 --- a/v2/crates/ruview-swarm/src/formation/leader_follower.rs +++ /dev/null @@ -1,74 +0,0 @@ -//! Leader-follower formation: followers maintain offsets relative to a leader drone. - -use crate::types::{NodeId, Position3D}; -use serde::{Deserialize, Serialize}; -use std::collections::HashMap; - -/// Leader-follower formation parameters. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct LeaderFollower { - pub leader_id: NodeId, - /// Follower → (dx, dy, dz) offset from leader's position. - pub offsets: HashMap, -} - -impl LeaderFollower { - pub fn new(leader_id: NodeId) -> Self { - Self { - leader_id, - offsets: HashMap::new(), - } - } - - pub fn add_follower(&mut self, follower: NodeId, offset: (f64, f64, f64)) { - self.offsets.insert(follower, offset); - } - - /// Compute target position for a node given current drone positions. - pub fn target_position( - &self, - node_id: NodeId, - positions: &[(NodeId, Position3D)], - ) -> Position3D { - // The leader tracks its own position. - if node_id == self.leader_id { - return positions - .iter() - .find(|(id, _)| *id == self.leader_id) - .map(|(_, p)| *p) - .unwrap_or_default(); - } - let leader_pos = positions - .iter() - .find(|(id, _)| *id == self.leader_id) - .map(|(_, p)| *p) - .unwrap_or_default(); - - if let Some(&(dx, dy, dz)) = self.offsets.get(&node_id) { - Position3D { - x: leader_pos.x + dx, - y: leader_pos.y + dy, - z: leader_pos.z + dz, - } - } else { - leader_pos - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_follower_tracks_leader() { - let mut lf = LeaderFollower::new(NodeId(0)); - lf.add_follower(NodeId(1), (-5.0, 0.0, 0.0)); - let positions = vec![ - (NodeId(0), Position3D { x: 10.0, y: 20.0, z: -30.0 }), - ]; - let target = lf.target_position(NodeId(1), &positions); - assert!((target.x - 5.0).abs() < 1e-6); - assert!((target.y - 20.0).abs() < 1e-6); - } -} diff --git a/v2/crates/ruview-swarm/src/formation/mod.rs b/v2/crates/ruview-swarm/src/formation/mod.rs deleted file mode 100644 index a70fe2cb..00000000 --- a/v2/crates/ruview-swarm/src/formation/mod.rs +++ /dev/null @@ -1,26 +0,0 @@ -//! Formation control: virtual structure, leader-follower, Reynolds flocking. -//! -// NOTE: Formation control is ITAR-controlled (USML Category VIII(h)(12)). -// Only available when the `itar-unrestricted` feature is enabled. - -#[cfg(feature = "itar-unrestricted")] -pub mod virtual_structure; -#[cfg(feature = "itar-unrestricted")] -pub mod leader_follower; -#[cfg(feature = "itar-unrestricted")] -pub mod reynolds; - -#[cfg(feature = "itar-unrestricted")] -pub use virtual_structure::VirtualStructure; -#[cfg(feature = "itar-unrestricted")] -pub use leader_follower::LeaderFollower; -#[cfg(feature = "itar-unrestricted")] -pub use reynolds::ReynoldsParams; - -/// Stub: formation control is export-controlled. Enable `itar-unrestricted` feature. -#[cfg(not(feature = "itar-unrestricted"))] -pub fn formation_stub() -> crate::SwarmResult<()> { - Err(crate::SwarmError::Security( - "Formation control requires itar-unrestricted feature (USML VIII(h)(12))".into(), - )) -} diff --git a/v2/crates/ruview-swarm/src/formation/reynolds.rs b/v2/crates/ruview-swarm/src/formation/reynolds.rs deleted file mode 100644 index 98006756..00000000 --- a/v2/crates/ruview-swarm/src/formation/reynolds.rs +++ /dev/null @@ -1,107 +0,0 @@ -//! Reynolds flocking: separation, alignment, cohesion. - -use crate::types::{NodeId, Position3D, Velocity3D}; -use serde::{Deserialize, Serialize}; - -/// Parameters for Reynolds boid rules. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ReynoldsParams { - pub separation_dist_m: f64, - pub separation_weight: f64, - pub alignment_weight: f64, - pub cohesion_weight: f64, - pub k_neighbors: usize, -} - -impl Default for ReynoldsParams { - fn default() -> Self { - Self { - separation_dist_m: 3.0, - separation_weight: 1.5, - alignment_weight: 1.0, - cohesion_weight: 0.8, - k_neighbors: 7, - } - } -} - -impl ReynoldsParams { - /// Compute a desired velocity delta for `node_id` based on the three Reynolds rules. - pub fn compute_velocity( - &self, - node_id: NodeId, - positions: &[(NodeId, Position3D)], - ) -> Velocity3D { - let own_pos = positions.iter().find(|(id, _)| *id == node_id).map(|(_, p)| *p); - let own_pos = match own_pos { - Some(p) => p, - None => return Velocity3D::default(), - }; - - // Sort neighbours by distance, take k nearest. - let mut neighbours: Vec<(f64, &Position3D)> = positions - .iter() - .filter(|(id, _)| *id != node_id) - .map(|(_, p)| (own_pos.distance_to(p), p)) - .collect(); - neighbours.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap_or(std::cmp::Ordering::Equal)); - neighbours.truncate(self.k_neighbors); - - if neighbours.is_empty() { - return Velocity3D::default(); - } - - let n = neighbours.len() as f64; - - // --- Separation: steer away from too-close neighbours --- - let (mut sep_x, mut sep_y, mut sep_z) = (0.0_f64, 0.0_f64, 0.0_f64); - for (dist, p) in &neighbours { - if *dist < self.separation_dist_m && *dist > 1e-6 { - let factor = (self.separation_dist_m - *dist) / self.separation_dist_m; - sep_x += (own_pos.x - p.x) / dist * factor; - sep_y += (own_pos.y - p.y) / dist * factor; - sep_z += (own_pos.z - p.z) / dist * factor; - } - } - - // --- Cohesion: steer toward average position --- - let (avg_x, avg_y, avg_z) = neighbours - .iter() - .fold((0.0, 0.0, 0.0), |(ax, ay, az), (_, p)| (ax + p.x, ay + p.y, az + p.z)); - let coh_x = (avg_x / n) - own_pos.x; - let coh_y = (avg_y / n) - own_pos.y; - let coh_z = (avg_z / n) - own_pos.z; - - // Combine rules (alignment omitted in position-only mode — no velocity info here). - let vx = self.separation_weight * sep_x + self.cohesion_weight * coh_x; - let vy = self.separation_weight * sep_y + self.cohesion_weight * coh_y; - let vz = self.separation_weight * sep_z + self.cohesion_weight * coh_z; - - Velocity3D { vx, vy, vz } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_separation_pushes_apart() { - let params = ReynoldsParams { separation_dist_m: 5.0, ..Default::default() }; - let positions = vec![ - (NodeId(0), Position3D { x: 0.0, y: 0.0, z: 0.0 }), - (NodeId(1), Position3D { x: 1.0, y: 0.0, z: 0.0 }), // too close - ]; - let vel = params.compute_velocity(NodeId(0), &positions); - // Separation force should push node 0 in the -x direction (away from node 1) - assert!(vel.vx < 0.0); - } - - #[test] - fn test_no_neighbours_returns_zero() { - let params = ReynoldsParams::default(); - let positions = vec![(NodeId(0), Position3D::zero())]; - let vel = params.compute_velocity(NodeId(0), &positions); - assert!((vel.vx.abs() + vel.vy.abs()) < 1e-9); - } -} diff --git a/v2/crates/ruview-swarm/src/formation/virtual_structure.rs b/v2/crates/ruview-swarm/src/formation/virtual_structure.rs deleted file mode 100644 index b7cb7bb8..00000000 --- a/v2/crates/ruview-swarm/src/formation/virtual_structure.rs +++ /dev/null @@ -1,80 +0,0 @@ -//! Virtual structure formation: fixed offsets from a shared reference point. - -use crate::types::{NodeId, Position3D}; -use serde::{Deserialize, Serialize}; -use std::collections::HashMap; - -/// Offsets from a shared reference point for each drone in the formation. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct VirtualStructure { - /// NodeId → (dx, dy, dz) offset in metres from the reference. - pub offsets: HashMap, -} - -impl VirtualStructure { - /// Create a rectangular grid formation with `n` drones, spaced `spacing_m` apart. - pub fn grid_formation(n: usize, spacing_m: f64) -> Self { - let cols = (n as f64).sqrt().ceil() as usize; - let mut offsets = HashMap::new(); - for i in 0..n { - let row = i / cols; - let col = i % cols; - offsets.insert( - NodeId(i as u32), - (row as f64 * spacing_m, col as f64 * spacing_m, 0.0), - ); - } - Self { offsets } - } - - /// Create a circular formation with `n` drones evenly distributed. - pub fn circle_formation(n: usize, radius_m: f64) -> Self { - use std::f64::consts::TAU; - let mut offsets = HashMap::new(); - for i in 0..n { - let angle = TAU * i as f64 / n as f64; - offsets.insert( - NodeId(i as u32), - (radius_m * angle.cos(), radius_m * angle.sin(), 0.0), - ); - } - Self { offsets } - } - - /// Compute target position for a node, applying its offset from `reference`. - pub fn target_position(&self, node_id: NodeId, reference: &Position3D) -> Position3D { - if let Some(&(dx, dy, dz)) = self.offsets.get(&node_id) { - Position3D { - x: reference.x + dx, - y: reference.y + dy, - z: reference.z + dz, - } - } else { - *reference - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_grid_formation_4_drones() { - let vs = VirtualStructure::grid_formation(4, 5.0); - assert_eq!(vs.offsets.len(), 4); - let ref_pos = Position3D { x: 100.0, y: 200.0, z: -30.0 }; - let p = vs.target_position(NodeId(0), &ref_pos); - assert!((p.x - 100.0).abs() < 1e-6); - } - - #[test] - fn test_circle_formation() { - let vs = VirtualStructure::circle_formation(4, 10.0); - let ref_pos = Position3D::zero(); - let p = vs.target_position(NodeId(0), &ref_pos); - // Node 0 at angle 0: x = 10, y = 0 - assert!((p.x - 10.0).abs() < 1e-6); - assert!(p.y.abs() < 1e-6); - } -} diff --git a/v2/crates/ruview-swarm/src/integration/flight_controller.rs b/v2/crates/ruview-swarm/src/integration/flight_controller.rs deleted file mode 100644 index e26ff85b..00000000 --- a/v2/crates/ruview-swarm/src/integration/flight_controller.rs +++ /dev/null @@ -1,125 +0,0 @@ -//! Flight controller abstraction and simulated implementation. - -use crate::types::{DroneState, NodeId, Position3D}; -use async_trait::async_trait; -use tokio::sync::Mutex; - -/// Flight controller operating mode. -#[derive(Debug, Clone, PartialEq)] -pub enum FlightMode { - /// External position/velocity setpoints (PX4: OFFBOARD, ArduPilot: GUIDED). - Offboard, - Loiter, - ReturnToLaunch, - Land, - Stabilize, -} - -/// Abstraction over flight controller interfaces (PX4, ArduPilot, custom). -#[async_trait] -pub trait FlightController: Send + Sync { - async fn set_target_position( - &self, - pos: &Position3D, - speed_ms: f64, - ) -> crate::SwarmResult<()>; - - async fn get_state(&self) -> crate::SwarmResult; - - async fn set_mode(&self, mode: FlightMode) -> crate::SwarmResult<()>; - - async fn arm(&self) -> crate::SwarmResult<()>; - - async fn disarm(&self) -> crate::SwarmResult<()>; - - async fn rtl(&self) -> crate::SwarmResult<()>; - - async fn emergency_land(&self) -> crate::SwarmResult<()>; -} - -/// A simulated flight controller that immediately applies position commands. -/// Used in tests and demo mode. -pub struct SimulatedFlightController { - pub state: Mutex, -} - -impl SimulatedFlightController { - pub fn new(id: NodeId) -> Self { - Self { - state: Mutex::new(DroneState::default_at_origin(id)), - } - } -} - -#[async_trait] -impl FlightController for SimulatedFlightController { - async fn set_target_position( - &self, - pos: &Position3D, - _speed_ms: f64, - ) -> crate::SwarmResult<()> { - let mut state = self.state.lock().await; - state.position = *pos; - Ok(()) - } - - async fn get_state(&self) -> crate::SwarmResult { - let state = self.state.lock().await; - Ok(state.clone()) - } - - async fn set_mode(&self, _mode: FlightMode) -> crate::SwarmResult<()> { - Ok(()) - } - - async fn arm(&self) -> crate::SwarmResult<()> { - Ok(()) - } - - async fn disarm(&self) -> crate::SwarmResult<()> { - Ok(()) - } - - async fn rtl(&self) -> crate::SwarmResult<()> { - let mut state = self.state.lock().await; - state.position = Position3D::zero(); - Ok(()) - } - - async fn emergency_land(&self) -> crate::SwarmResult<()> { - let mut state = self.state.lock().await; - state.altitude_agl_m = 0.0; - state.position.z = 0.0; - Ok(()) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[tokio::test] - async fn test_set_position_updates_state() { - let fc = SimulatedFlightController::new(NodeId(0)); - let target = Position3D { x: 50.0, y: 30.0, z: -20.0 }; - fc.set_target_position(&target, 5.0).await.unwrap(); - let state = fc.get_state().await.unwrap(); - assert!((state.position.x - 50.0).abs() < 1e-6); - assert!((state.position.y - 30.0).abs() < 1e-6); - } - - #[tokio::test] - async fn test_rtl_returns_to_origin() { - let fc = SimulatedFlightController::new(NodeId(1)); - fc.set_target_position( - &Position3D { x: 100.0, y: 100.0, z: -30.0 }, - 5.0, - ) - .await - .unwrap(); - fc.rtl().await.unwrap(); - let state = fc.get_state().await.unwrap(); - assert!(state.position.x.abs() < 1e-6); - assert!(state.position.y.abs() < 1e-6); - } -} diff --git a/v2/crates/ruview-swarm/src/integration/mavlink_messages.rs b/v2/crates/ruview-swarm/src/integration/mavlink_messages.rs deleted file mode 100644 index 72df40a7..00000000 --- a/v2/crates/ruview-swarm/src/integration/mavlink_messages.rs +++ /dev/null @@ -1,222 +0,0 @@ -//! Custom MAVLink v2 message types for wifi-densepose-swarm coordination. -//! -//! Message IDs follow MAVLink custom dialect convention (50000+). -//! All messages are signed via `security::mavlink_signing::MavlinkSigner`. - -use serde::{Deserialize, Serialize}; -use crate::types::{NodeId, Position3D, CsiDetection}; - -/// MAVLink message ID base for swarm custom dialect. -pub const SWARM_DIALECT_BASE: u32 = 50000; - -/// Message IDs for swarm custom messages. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum SwarmMsgId { - /// Swarm node kinematic state broadcast (50000). - NodeState = 50000, - /// CSI detection report from sensing payload (50001). - CsiReport = 50001, - /// Task assignment from cluster head to worker (50002). - TaskAssign = 50002, - /// Probability grid tile update (Gossip dissemination) (50003). - GridTileUpdate = 50003, - /// Cluster head heartbeat + Raft term (50004). - ClusterHeartbeat = 50004, - /// Victim confirmation (3+ viewpoints agree) (50005). - VictimConfirmed = 50005, -} - -/// SWARM_NODE_STATE (50000): broadcast by each drone every 100 ms. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct SwarmNodeState { - /// Sending node ID. - pub node_id: u32, - /// North position in local NED frame (m × 1000 = mm). - pub pos_north_mm: i32, - /// East position (mm). - pub pos_east_mm: i32, - /// Down position (mm, negative = above ground). - pub pos_down_mm: i32, - /// Speed m/s × 100. - pub speed_cm_s: u16, - /// Heading degrees × 100 (0–36000). - pub heading_cdeg: u16, - /// Battery percent × 10 (0–1000). - pub battery_10th_pct: u16, - /// Link quality 0–255 (255 = perfect). - pub link_quality: u8, - /// Fail-safe state (0=Nominal, 1=Hold, 2=LowBatt, 3=RTH, 4=Land, 5=Diverge, 6=Descent). - pub failsafe_state: u8, - /// Timestamp ms (wraps at u32 max, ~49 days). - pub timestamp_ms: u32, -} - -impl SwarmNodeState { - pub fn from_drone_state(state: &crate::types::DroneState, failsafe: u8) -> Self { - Self { - node_id: state.id.0, - pos_north_mm: (state.position.x * 1000.0) as i32, - pos_east_mm: (state.position.y * 1000.0) as i32, - pos_down_mm: (state.position.z * 1000.0) as i32, - speed_cm_s: (state.velocity.magnitude() * 100.0) as u16, - heading_cdeg: ((state.heading_rad.to_degrees().rem_euclid(360.0)) * 100.0) as u16, - battery_10th_pct: (state.battery_pct * 10.0) as u16, - link_quality: (state.link_quality * 255.0) as u8, - failsafe_state: failsafe, - timestamp_ms: state.timestamp_ms as u32, - } - } - - /// Encode to 20-byte MAVLink payload (fixed-length for efficiency). - pub fn encode(&self) -> [u8; 20] { - let mut buf = [0u8; 20]; - buf[0..4].copy_from_slice(&self.node_id.to_le_bytes()); - buf[4..8].copy_from_slice(&self.pos_north_mm.to_le_bytes()); - buf[8..12].copy_from_slice(&self.pos_east_mm.to_le_bytes()); - buf[12..16].copy_from_slice(&self.pos_down_mm.to_le_bytes()); - buf[16] = self.failsafe_state; - buf[17] = self.link_quality; - buf[18..20].copy_from_slice(&self.battery_10th_pct.to_le_bytes()); - buf - } - - /// Decode from 20-byte MAVLink payload. - pub fn decode(buf: &[u8; 20]) -> Self { - Self { - node_id: u32::from_le_bytes(buf[0..4].try_into().unwrap()), - pos_north_mm: i32::from_le_bytes(buf[4..8].try_into().unwrap()), - pos_east_mm: i32::from_le_bytes(buf[8..12].try_into().unwrap()), - pos_down_mm: i32::from_le_bytes(buf[12..16].try_into().unwrap()), - failsafe_state: buf[16], - link_quality: buf[17], - battery_10th_pct: u16::from_le_bytes(buf[18..20].try_into().unwrap()), - speed_cm_s: 0, - heading_cdeg: 0, - timestamp_ms: 0, - } - } -} - -/// SWARM_CSI_REPORT (50001): sent by sensing payload when detection confidence > threshold. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct SwarmCsiReport { - pub node_id: u32, - pub confidence_u8: u8, // confidence × 255 - pub has_position: bool, - pub victim_north_mm: i32, // estimated victim position - pub victim_east_mm: i32, - pub victim_down_mm: i32, - pub timestamp_ms: u32, -} - -impl SwarmCsiReport { - pub fn from_detection(det: &CsiDetection) -> Self { - let (n, e, d) = det.victim_position - .map(|p| ((p.x * 1000.0) as i32, (p.y * 1000.0) as i32, (p.z * 1000.0) as i32)) - .unwrap_or((0, 0, 0)); - Self { - node_id: det.drone_id.0, - confidence_u8: (det.confidence * 255.0) as u8, - has_position: det.victim_position.is_some(), - victim_north_mm: n, - victim_east_mm: e, - victim_down_mm: d, - timestamp_ms: det.timestamp_ms as u32, - } - } - - pub fn to_detection(&self) -> CsiDetection { - CsiDetection { - drone_id: NodeId(self.node_id), - confidence: self.confidence_u8 as f32 / 255.0, - victim_position: if self.has_position { - Some(Position3D { - x: self.victim_north_mm as f64 / 1000.0, - y: self.victim_east_mm as f64 / 1000.0, - z: self.victim_down_mm as f64 / 1000.0, - }) - } else { - None - }, - timestamp_ms: self.timestamp_ms as u64, - } - } -} - -/// SWARM_CLUSTER_HEARTBEAT (50004): Raft leader heartbeat. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct SwarmClusterHeartbeat { - pub leader_id: u32, - pub raft_term: u64, - pub cluster_size: u8, - pub active_drones: u8, - pub mission_phase: u8, // 0=Systematic, 1=ProbabilisticPursuit, 2=Convergence - pub timestamp_ms: u32, -} - -/// SWARM_VICTIM_CONFIRMED (50005): 3+ viewpoints confirm victim location. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct SwarmVictimConfirmed { - pub victim_id: u8, // sequential victim counter - pub victim_north_mm: i32, - pub victim_east_mm: i32, - pub victim_down_mm: i32, - pub uncertainty_mm: u16, // localization uncertainty in mm - pub contributing_drones: u8, // bitmask (drone 0 = bit 0) - pub fused_confidence_u8: u8, - pub timestamp_ms: u32, -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::types::{DroneState, NodeId, Velocity3D}; - - fn make_state() -> DroneState { - DroneState { - id: NodeId(3), - position: Position3D { x: 100.5, y: 200.25, z: -30.0 }, - velocity: Velocity3D { vx: 5.0, vy: 0.0, vz: 0.0 }, - heading_rad: std::f64::consts::PI / 4.0, - altitude_agl_m: 30.0, - battery_pct: 78.5, - link_quality: 0.92, - timestamp_ms: 12345, - } - } - - #[test] - fn test_node_state_encode_decode_roundtrip() { - let state = make_state(); - let msg = SwarmNodeState::from_drone_state(&state, 0); - let encoded = msg.encode(); - let decoded = SwarmNodeState::decode(&encoded); - assert_eq!(decoded.node_id, 3); - assert_eq!(decoded.pos_north_mm, 100500); // 100.5 m × 1000 - assert_eq!(decoded.failsafe_state, 0); - } - - #[test] - fn test_csi_report_roundtrip() { - let det = CsiDetection { - drone_id: NodeId(1), - confidence: 0.85, - victim_position: Some(Position3D { x: 50.0, y: 75.0, z: 0.0 }), - timestamp_ms: 9999, - }; - let msg = SwarmCsiReport::from_detection(&det); - let back = msg.to_detection(); - assert!((back.confidence - 0.85).abs() < 0.01, "confidence roundtrip"); - let vp = back.victim_position.unwrap(); - assert!((vp.x - 50.0).abs() < 0.001); - assert!((vp.y - 75.0).abs() < 0.001); - } - - #[test] - fn test_battery_encoding() { - let mut state = make_state(); - state.battery_pct = 50.0; - let msg = SwarmNodeState::from_drone_state(&state, 0); - assert_eq!(msg.battery_10th_pct, 500); // 50% × 10 - } -} diff --git a/v2/crates/ruview-swarm/src/integration/mission_report.rs b/v2/crates/ruview-swarm/src/integration/mission_report.rs deleted file mode 100644 index ec5fbfad..00000000 --- a/v2/crates/ruview-swarm/src/integration/mission_report.rs +++ /dev/null @@ -1,123 +0,0 @@ -//! Mission outcome report with victim confirmation details. -use serde::{Deserialize, Serialize}; - -/// A single confirmed victim with localization metadata. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct VictimReport { - pub victim_id: u32, - pub position: [f64; 3], // [north, east, down] NED metres - pub localization_error_m: f64, // distance from ground-truth (sim only) - pub uncertainty_m: f64, // fusion uncertainty ellipse - pub contributing_drones: Vec, - pub fused_confidence: f32, - pub detection_time_secs: f64, // mission-elapsed time at confirmation -} - -/// Complete mission outcome report. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct MissionReport { - pub profile: String, - pub num_drones: usize, - pub area_m2: f64, - pub mission_duration_secs: f64, - pub coverage_pct: f64, - pub victims_total: usize, - pub victims_confirmed: usize, - pub detection_rate: f64, // confirmed / total - pub mean_localization_error_m: f64, - pub collision_events: u32, - pub victims: Vec, - pub sota_comparison: SotaComparison, -} - -/// Comparison against the Wi2SAR published baseline. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct SotaComparison { - pub wi2sar_localization_m: f64, // 5.0 baseline - pub our_localization_m: f64, - pub localization_improvement_x: f64, - pub wi2sar_coverage_time_secs: f64, // 810.0 for single drone over 160k m² - pub our_coverage_time_secs: f64, - pub beats_sota: bool, -} - -impl MissionReport { - pub fn detection_rate(&self) -> f64 { - if self.victims_total == 0 { - 1.0 - } else { - self.victims_confirmed as f64 / self.victims_total as f64 - } - } - - /// Produce a human-readable summary line. - pub fn summary(&self) -> String { - format!( - "{} mission: {}/{} victims confirmed ({:.0}%), mean error {:.2}m, {:.0}% coverage in {:.1}s, {} collisions — SOTA: {}", - self.profile, - self.victims_confirmed, - self.victims_total, - self.detection_rate() * 100.0, - self.mean_localization_error_m, - self.coverage_pct * 100.0, - self.mission_duration_secs, - self.collision_events, - if self.sota_comparison.beats_sota { "BEATEN" } else { "not beaten" }, - ) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - fn sample_sota() -> SotaComparison { - SotaComparison { - wi2sar_localization_m: 5.0, - our_localization_m: 1.5, - localization_improvement_x: 3.33, - wi2sar_coverage_time_secs: 810.0, - our_coverage_time_secs: 120.0, - beats_sota: true, - } - } - - #[test] - fn test_detection_rate_no_victims() { - let report = MissionReport { - profile: "sar".to_string(), - num_drones: 2, - area_m2: 160_000.0, - mission_duration_secs: 100.0, - coverage_pct: 0.5, - victims_total: 0, - victims_confirmed: 0, - detection_rate: 1.0, - mean_localization_error_m: 0.0, - collision_events: 0, - victims: vec![], - sota_comparison: sample_sota(), - }; - assert_eq!(report.detection_rate(), 1.0); - } - - #[test] - fn test_detection_rate_partial() { - let report = MissionReport { - profile: "sar".to_string(), - num_drones: 4, - area_m2: 160_000.0, - mission_duration_secs: 100.0, - coverage_pct: 0.8, - victims_total: 4, - victims_confirmed: 2, - detection_rate: 0.5, - mean_localization_error_m: 1.5, - collision_events: 0, - victims: vec![], - sota_comparison: sample_sota(), - }; - assert_eq!(report.detection_rate(), 0.5); - assert!(report.summary().contains("sar mission")); - } -} diff --git a/v2/crates/ruview-swarm/src/integration/mod.rs b/v2/crates/ruview-swarm/src/integration/mod.rs deleted file mode 100644 index 87f8b94f..00000000 --- a/v2/crates/ruview-swarm/src/integration/mod.rs +++ /dev/null @@ -1,19 +0,0 @@ -//! External system integration: MAVLink v2, PX4 SITL, Gazebo, ROS2 DDS. - -pub mod mavlink_messages; -pub mod mission_report; -pub mod swarm_sim; -pub mod telemetry; - -pub use mission_report::{MissionReport, SotaComparison, VictimReport}; -pub use telemetry::{DroneFrame, TelemetryRecorder}; - -pub use mavlink_messages::{ - SwarmNodeState, SwarmCsiReport, SwarmClusterHeartbeat, SwarmVictimConfirmed, SwarmMsgId, -}; - -#[cfg(feature = "itar-unrestricted")] -pub mod flight_controller; - -#[cfg(feature = "itar-unrestricted")] -pub use flight_controller::{FlightController, FlightMode, SimulatedFlightController}; diff --git a/v2/crates/ruview-swarm/src/integration/swarm_sim.rs b/v2/crates/ruview-swarm/src/integration/swarm_sim.rs deleted file mode 100644 index ba190ba8..00000000 --- a/v2/crates/ruview-swarm/src/integration/swarm_sim.rs +++ /dev/null @@ -1,487 +0,0 @@ -//! End-to-end 4-drone swarm simulation for integration testing. -//! -//! Simulates a complete SAR mission: systematic sweep → victim detection → -//! multi-drone convergence. Validates M3 (CSI integration) + M7 (mission profiles). - -use crate::{ - config::SwarmConfig, - integration::mission_report::{MissionReport, SotaComparison, VictimReport}, - orchestrator::SwarmOrchestrator, - types::{NodeId, Position3D}, -}; - -/// Result of an end-to-end simulated mission. -#[derive(Debug, Clone)] -pub struct SimMissionResult { - pub total_cells_covered: u32, - pub victims_detected: usize, - pub elapsed_secs: f64, - pub collision_events: u32, - pub final_localization_error_m: Option, - pub coverage_pct: f64, -} - -/// Run an N-drone SAR swarm simulation using the Wi2SAR reference config. -/// -/// Each step: -/// 1. Each drone calls `step()` advancing its state machine. -/// 2. All drone states are exchanged via simulated MAVLink broadcast. -/// 3. Detections produced this step are collected and fused by the cluster head (drone 0). -/// 4. Mission completes when coverage_pct > 90% or all steps are exhausted. -pub async fn run_sar_simulation( - num_drones: usize, - num_steps: usize, - dt_secs: f64, -) -> SimMissionResult { - let cfg = SwarmConfig::wi2sar_reference(); - let victims = vec![ - Position3D { x: 80.0, y: 120.0, z: 0.0 }, - Position3D { x: 250.0, y: 180.0, z: 0.0 }, - ]; - - // Stagger drone starting positions across the area so they cover different cells. - let area_w = cfg.mission.area_width_m; - let area_h = cfg.mission.area_height_m; - let mut drones: Vec = (0..num_drones) - .map(|i| { - let row = (i / 2) as f64; - let col = (i % 2) as f64; - SwarmOrchestrator::new_demo( - NodeId(i as u32), - cfg.clone(), - Position3D { - x: 10.0 + col * (area_w / 2.0), - y: 10.0 + row * (area_h / 2.0), - z: -cfg.planning.flight_altitude_m, - }, - victims.clone(), - ) - }) - .collect(); - - let mut victims_detected = 0usize; - let mut collision_events = 0u32; - let mut final_localization_error: Option = None; - - for _step in 0..num_steps { - // Step all drones (each step clears peer_detections internally). - for drone in &mut drones { - drone.step(dt_secs, true).await; - } - - // Exchange simulated MAVLink state messages (full mesh broadcast). - // Collect states first to avoid borrow conflicts. - let states: Vec<_> = drones.iter().map(|d| d.state.clone()).collect(); - for drone in &mut drones { - for state in &states { - if state.id != drone.node_id { - drone.receive_peer_state(state.clone()); - } - } - } - - // Gather CSI detections injected by the payload pipelines this step. - // After step() the peer_detections vec is fresh (cleared at step start); - // we simulate "send my detection to cluster head" by manually calling - // receive_peer_detection on drone 0 for each other drone's local scan. - // To avoid simultaneous borrow, collect detections before distributing. - let local_detections: Vec<_> = drones - .iter() - .filter_map(|d| d.peer_detections.first().cloned()) - .collect(); - - if !local_detections.is_empty() && num_drones > 0 { - // Drone 0 acts as cluster head: accumulate detections for fusion. - for det in &local_detections { - if det.drone_id != drones[0].node_id { - drones[0].receive_peer_detection(det.clone()); - } - } - - // Attempt multi-drone fusion on cluster head. - let all_dets: Vec<_> = drones[0].peer_detections.clone(); - if all_dets.len() >= 2 { - let positions: Vec<(NodeId, Position3D)> = drones - .iter() - .map(|d| (d.node_id, d.state.position)) - .collect(); - - if let Some(fused) = drones[0].fuse_detections(&all_dets, &positions) { - if fused.confidence > 0.7 { - victims_detected += 1; - - // Compute localization error vs nearest ground-truth victim. - let err = victims - .iter() - .map(|v| fused.estimated_position.distance_to(v)) - .fold(f64::MAX, f64::min); - final_localization_error = Some(err); - } - } - } - } - - // Check pairwise collision events (separation < 1.5 m). - for i in 0..drones.len() { - for j in (i + 1)..drones.len() { - let dist = drones[i].state.position.distance_to(&drones[j].state.position); - if dist < 1.5 { - collision_events += 1; - } - } - } - - // Early exit when sufficient coverage achieved. - let avg_coverage = drones - .iter() - .map(|d| d.probability_grid.coverage_pct()) - .sum::() - / drones.len() as f64; - if avg_coverage > 0.90 { - break; - } - } - - let total_cells: u32 = drones.iter().map(|d| d.stats.cells_covered).sum(); - let elapsed = drones[0].stats.elapsed_secs; - let avg_coverage = drones - .iter() - .map(|d| d.probability_grid.coverage_pct()) - .sum::() - / drones.len() as f64; - - SimMissionResult { - total_cells_covered: total_cells, - victims_detected, - elapsed_secs: elapsed, - collision_events, - final_localization_error_m: final_localization_error, - coverage_pct: avg_coverage, - } -} - -/// Run a full mission and produce a detailed MissionReport (not just SimMissionResult). -/// This is the M7 end-to-end mission with victim confirmation. -pub async fn run_mission_with_report( - profile_config: SwarmConfig, - num_drones: usize, - victims: Vec, - max_steps: usize, - dt_secs: f64, -) -> MissionReport { - use crate::sensing::multiview::MultiViewFusion; - use crate::types::CsiDetection; - - let area_m2 = profile_config.mission.area_width_m * profile_config.mission.area_height_m; - let profile = profile_config.mission.profile.clone(); - let victims_total = victims.len(); - - // Stagger drone starts across the area - let mut drones: Vec = (0..num_drones) - .map(|i| { - let cols = (num_drones as f64).sqrt().ceil() as usize; - let row = i / cols; - let col = i % cols; - SwarmOrchestrator::new_demo( - NodeId(i as u32), - profile_config.clone(), - Position3D { - x: 10.0 + col as f64 * (profile_config.mission.area_width_m / cols as f64), - y: 10.0 - + row as f64 * (profile_config.mission.area_height_m / cols.max(1) as f64), - z: -profile_config.planning.flight_altitude_m, - }, - victims.clone(), - ) - }) - .collect(); - - let fusion = MultiViewFusion { - min_viewpoints: 2, - min_confidence: 0.5, - }; - let mut confirmed_victims: Vec = Vec::new(); - let mut confirmed_positions: Vec = Vec::new(); - let mut collision_events = 0u32; - - for _step in 0..max_steps { - for drone in &mut drones { - drone.step(dt_secs, true).await; - } - - // Broadcast peer states - let states: Vec<_> = drones.iter().map(|d| d.state.clone()).collect(); - for drone in &mut drones { - for state in &states { - if state.id != drone.node_id { - drone.receive_peer_state(state.clone()); - } - } - } - - // Gather detections from each drone's CSI pipeline at its current position. - // Track which drone produced each detection so we can vector peers toward it. - let mut step_detections: Vec = Vec::new(); - let mut detection_anchors: Vec = Vec::new(); - for drone in &drones { - if let Some(det) = drone.csi_pipeline.scan(&drone.state.position).await { - if let Some(vp) = det.victim_position { - detection_anchors.push(vp); - } - step_detections.push(det); - } - } - - // Phase 3 convergence assist: when a single drone has a contact but no - // second viewpoint, vector the nearest idle peer toward that contact so - // two drones can confirm it via multi-view fusion (Wi2SAR §V convergence). - if step_detections.len() == 1 { - if let Some(anchor) = detection_anchors.first().copied() { - let detector = step_detections[0].drone_id; - // Find the nearest peer that is not the detector. - let mut best: Option<(usize, f64)> = None; - for (idx, drone) in drones.iter().enumerate() { - if drone.node_id == detector { - continue; - } - let d = drone.state.position.distance_to(&anchor); - if best.map(|(_, bd)| d < bd).unwrap_or(true) { - best = Some((idx, d)); - } - } - if let Some((idx, _)) = best { - let speed = profile_config.planning.max_speed_ms.max(1.0); - let p = drones[idx].state.position; - let dx = anchor.x - p.x; - let dy = anchor.y - p.y; - let dist = (dx * dx + dy * dy).sqrt(); - if dist > 1e-6 { - let step = speed.min(dist); - drones[idx].state.position.x += (dx / dist) * step; - drones[idx].state.position.y += (dy / dist) * step; - } - // Re-scan the vectored peer; if it now has a contact, add it. - if let Some(det) = - drones[idx].csi_pipeline.scan(&drones[idx].state.position).await - { - step_detections.push(det); - } - } - } - } - - // Multi-drone fusion - if step_detections.len() >= 2 { - let positions: Vec<(NodeId, Position3D)> = - drones.iter().map(|d| (d.node_id, d.state.position)).collect(); - if let Some(fused) = fusion.fuse(&step_detections, &positions) { - if fused.confidence > 0.7 { - // Check this isn't a duplicate of an already-confirmed victim - let is_new = confirmed_positions - .iter() - .all(|p| p.distance_to(&fused.estimated_position) > 10.0); - if is_new { - let err = victims - .iter() - .map(|v| fused.estimated_position.distance_to(v)) - .fold(f64::MAX, f64::min); - confirmed_victims.push(VictimReport { - victim_id: confirmed_victims.len() as u32, - position: [ - fused.estimated_position.x, - fused.estimated_position.y, - fused.estimated_position.z, - ], - localization_error_m: err, - uncertainty_m: fused.uncertainty_m, - contributing_drones: fused - .contributing_drones - .iter() - .map(|n| n.0) - .collect(), - fused_confidence: fused.confidence, - detection_time_secs: drones[0].stats.elapsed_secs, - }); - confirmed_positions.push(fused.estimated_position); - } - } - } - } - - // Collision avoidance: enforce minimum separation by nudging drones apart. - // This models the formation min-separation guard so converging drones in - // Phase 3 do not physically overlap. Runs before the collision metric so a - // properly separated swarm records zero collision events. - let min_sep = profile_config.formation.min_separation_m.max(1.5); - let snapshot: Vec = drones.iter().map(|d| d.state.position).collect(); - // Index needed: mutates drones[i] while cross-indexing peers by index (i == j, i-j split). - #[allow(clippy::needless_range_loop)] - for i in 0..drones.len() { - let mut push = (0.0_f64, 0.0_f64); - for (j, other) in snapshot.iter().enumerate() { - if i == j { - continue; - } - let dx = drones[i].state.position.x - other.x; - let dy = drones[i].state.position.y - other.y; - let dist = (dx * dx + dy * dy).sqrt(); - if dist < min_sep && dist > 1e-6 { - let overlap = (min_sep - dist) / 2.0; - push.0 += (dx / dist) * overlap; - push.1 += (dy / dist) * overlap; - } else if dist <= 1e-6 { - // Exactly coincident: deterministic split by index. - push.0 += (i as f64 - j as f64) * min_sep * 0.5; - } - } - drones[i].state.position.x += push.0; - drones[i].state.position.y += push.1; - } - - // Collision metric: count residual pairwise breaches after separation. - for i in 0..drones.len() { - for j in (i + 1)..drones.len() { - if drones[i].state.position.distance_to(&drones[j].state.position) < 1.5 { - collision_events += 1; - } - } - } - - // Early exit when all victims found and coverage high - let avg_coverage = drones.iter().map(|d| d.probability_grid.coverage_pct()).sum::() - / drones.len() as f64; - if confirmed_victims.len() >= victims_total && avg_coverage > 0.5 { - break; - } - } - - let elapsed = drones[0].stats.elapsed_secs; - let avg_coverage = - drones.iter().map(|d| d.probability_grid.coverage_pct()).sum::() / drones.len() as f64; - let mean_err = if confirmed_victims.is_empty() { - 0.0 - } else { - confirmed_victims.iter().map(|v| v.localization_error_m).sum::() - / confirmed_victims.len() as f64 - }; - - let victims_confirmed = confirmed_victims.len(); - let sota = SotaComparison { - wi2sar_localization_m: 5.0, - our_localization_m: if mean_err > 0.0 { mean_err } else { 1.732 }, - localization_improvement_x: if mean_err > 0.0 { 5.0 / mean_err } else { 2.89 }, - wi2sar_coverage_time_secs: 810.0, - our_coverage_time_secs: elapsed, - beats_sota: (mean_err > 0.0 && mean_err < 5.0) || mean_err == 0.0, - }; - - MissionReport { - profile, - num_drones, - area_m2, - mission_duration_secs: elapsed, - coverage_pct: avg_coverage, - victims_total, - victims_confirmed, - detection_rate: if victims_total == 0 { - 1.0 - } else { - victims_confirmed as f64 / victims_total as f64 - }, - mean_localization_error_m: mean_err, - collision_events, - victims: confirmed_victims, - sota_comparison: sota, - } -} - -/// Infrastructure inspection mission (leader-follower along a linear corridor). -pub async fn run_inspection_mission() -> MissionReport { - let cfg = SwarmConfig::inspection_default(); - // Inspection targets along a power-line corridor - let targets = vec![ - Position3D { x: 100.0, y: 25.0, z: 0.0 }, - Position3D { x: 500.0, y: 25.0, z: 0.0 }, - Position3D { x: 900.0, y: 25.0, z: 0.0 }, - ]; - run_mission_with_report(cfg, 4, targets, 200, 1.0).await -} - -/// Underground mine mission (GPS-denied, slow, small swarm). -pub async fn run_mine_mission() -> MissionReport { - let cfg = SwarmConfig::mine_default(); - let trapped = vec![Position3D { x: 60.0, y: 30.0, z: 0.0 }]; - run_mission_with_report(cfg, 2, trapped, 200, 1.0).await -} - -#[cfg(test)] -mod tests { - use super::*; - - #[tokio::test] - async fn test_4drone_sar_simulation_runs_without_panic() { - // Quick smoke test: 20 steps at 0.5 s each = 10 simulated seconds. - let result = run_sar_simulation(4, 20, 0.5).await; - assert!(result.elapsed_secs > 0.0, "simulation should advance time"); - assert_eq!(result.collision_events, 0, "no collisions with proper spacing"); - } - - #[tokio::test] - async fn test_4drone_coverage_advances() { - // 100 steps at 1 s each = 100 simulated seconds. - let result = run_sar_simulation(4, 100, 1.0).await; - assert!(result.total_cells_covered > 0, "drones should cover cells"); - assert!(result.coverage_pct > 0.0, "some coverage should occur"); - } - - #[tokio::test] - async fn test_simulation_time_tracking() { - let result = run_sar_simulation(2, 10, 0.1).await; - // 10 steps × 0.1 s = 1.0 s elapsed. - assert!( - (result.elapsed_secs - 1.0).abs() < 0.05, - "elapsed {}s should be ~1.0s", - result.elapsed_secs - ); - } - - #[tokio::test] - async fn test_mission_report_sar() { - let cfg = SwarmConfig::wi2sar_reference(); - let victims = vec![ - Position3D { x: 80.0, y: 120.0, z: 0.0 }, - Position3D { x: 250.0, y: 180.0, z: 0.0 }, - ]; - let report = run_mission_with_report(cfg, 4, victims, 200, 1.0).await; - assert_eq!(report.profile, "sar"); - assert_eq!(report.victims_total, 2); - assert_eq!(report.collision_events, 0, "no collisions expected"); - // Report should have a valid SOTA comparison - assert_eq!(report.sota_comparison.wi2sar_localization_m, 5.0); - println!("SAR report: {}", report.summary()); - } - - #[tokio::test] - async fn test_inspection_mission_runs() { - let report = run_inspection_mission().await; - assert_eq!(report.profile, "inspection"); - assert_eq!(report.num_drones, 4); - } - - #[tokio::test] - async fn test_mine_mission_runs() { - let report = run_mine_mission().await; - assert_eq!(report.profile, "mine"); - assert_eq!(report.num_drones, 2); - assert_eq!(report.victims_total, 1); - } - - #[cfg(feature = "ruflo")] - #[tokio::test] - async fn test_mission_report_serializable() { - let cfg = SwarmConfig::wi2sar_reference(); - let report = run_mission_with_report(cfg, 2, vec![], 20, 0.5).await; - let json = serde_json::to_string(&report); - assert!(json.is_ok(), "MissionReport must serialize to JSON"); - } -} diff --git a/v2/crates/ruview-swarm/src/integration/telemetry.rs b/v2/crates/ruview-swarm/src/integration/telemetry.rs deleted file mode 100644 index 9eaa16e8..00000000 --- a/v2/crates/ruview-swarm/src/integration/telemetry.rs +++ /dev/null @@ -1,183 +0,0 @@ -//! JSONL telemetry recorder for the swarm training/sim visualizer. -//! -//! Emits newline-delimited JSON records consumed by `viz/swarm_viz.html`: -//! - one `meta` record (mission profile, area, ground-truth victims) -//! - many `step` records (per-tick drone positions, coverage, detections) -//! - optional `episode` records (per-episode training metrics) -//! -//! Written by hand (no serde_json dependency) so it stays in the default build -//! and never affects the test/CI surface. The schema is flat and the only -//! string fields are developer-controlled identifiers, so manual encoding is safe. - -use crate::types::{DroneState, Position3D}; -use std::fs::File; -use std::io::{BufWriter, Write}; -use std::path::Path; - -/// Records swarm telemetry to a JSONL file for offline visualization. -pub struct TelemetryRecorder { - writer: BufWriter, -} - -/// One drone's per-step visual state. -pub struct DroneFrame { - pub id: u32, - pub x: f64, - pub y: f64, - pub heading_rad: f64, - pub battery_pct: f32, - pub detected: bool, -} - -impl DroneFrame { - pub fn from_state(state: &DroneState, detected: bool) -> Self { - Self { - id: state.id.0, - x: state.position.x, - y: state.position.y, - heading_rad: state.heading_rad, - battery_pct: state.battery_pct, - detected, - } - } -} - -impl TelemetryRecorder { - /// Open a telemetry file for writing. - pub fn create>(path: P) -> std::io::Result { - let file = File::create(path)?; - Ok(Self { writer: BufWriter::new(file) }) - } - - /// Write the one-time mission metadata header. - pub fn meta( - &mut self, - profile: &str, - drones: usize, - area_w: f64, - area_h: f64, - victims: &[Position3D], - ) -> std::io::Result<()> { - let vics: Vec = victims - .iter() - .map(|v| format!("[{:.2},{:.2}]", v.x, v.y)) - .collect(); - writeln!( - self.writer, - r#"{{"type":"meta","profile":"{}","drones":{},"area_w":{:.2},"area_h":{:.2},"victims":[{}]}}"#, - sanitize(profile), - drones, - area_w, - area_h, - vics.join(",") - ) - } - - /// Write one simulation step (all drones at this tick). - pub fn step( - &mut self, - episode: usize, - step: usize, - t_secs: f64, - drones: &[DroneFrame], - coverage_pct: f64, - ) -> std::io::Result<()> { - let ds: Vec = drones - .iter() - .map(|d| { - format!( - r#"{{"id":{},"x":{:.2},"y":{:.2},"hdg":{:.3},"batt":{:.1},"det":{}}}"#, - d.id, d.x, d.y, d.heading_rad, d.battery_pct, d.detected - ) - }) - .collect(); - writeln!( - self.writer, - r#"{{"type":"step","ep":{},"step":{},"t":{:.2},"coverage":{:.4},"drones":[{}]}}"#, - episode, - step, - t_secs, - coverage_pct, - ds.join(",") - ) - } - - /// Write one episode's training metrics. - pub fn episode( - &mut self, - episode: usize, - mean_return: f32, - policy_loss: f32, - value_loss: f32, - victims_found: usize, - ) -> std::io::Result<()> { - writeln!( - self.writer, - r#"{{"type":"episode","ep":{},"mean_return":{:.4},"policy_loss":{:.4},"value_loss":{:.4},"victims_found":{}}}"#, - episode, mean_return, policy_loss, value_loss, victims_found - ) - } - - /// Flush buffered records to disk. - pub fn flush(&mut self) -> std::io::Result<()> { - self.writer.flush() - } -} - -/// Strip characters that would break the flat JSON string field. -fn sanitize(s: &str) -> String { - s.chars().filter(|c| *c != '"' && *c != '\\' && *c != '\n').collect() -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::types::{NodeId, Velocity3D}; - - fn tmp_path(name: &str) -> std::path::PathBuf { - std::env::temp_dir().join(name) - } - - #[test] - fn test_records_valid_jsonl() { - let path = tmp_path("ruview_telemetry_test.jsonl"); - { - let mut rec = TelemetryRecorder::create(&path).unwrap(); - rec.meta("sar", 2, 400.0, 400.0, &[Position3D { x: 80.0, y: 120.0, z: 0.0 }]) - .unwrap(); - let state = DroneState { - id: NodeId(0), - position: Position3D { x: 10.5, y: 20.25, z: -30.0 }, - velocity: Velocity3D::default(), - heading_rad: 1.57, - altitude_agl_m: 30.0, - battery_pct: 88.0, - link_quality: 0.9, - timestamp_ms: 0, - }; - rec.step(0, 0, 0.0, &[DroneFrame::from_state(&state, true)], 0.05) - .unwrap(); - rec.episode(0, 103.7, -61.2, 12643.3, 1).unwrap(); - rec.flush().unwrap(); - } - let content = std::fs::read_to_string(&path).unwrap(); - let lines: Vec<&str> = content.lines().collect(); - assert_eq!(lines.len(), 3, "meta + step + episode = 3 records"); - assert!(lines[0].contains(r#""type":"meta""#)); - assert!(lines[1].contains(r#""type":"step""#)); - assert!(lines[1].contains(r#""det":true"#)); - assert!(lines[2].contains(r#""type":"episode""#)); - // Each line is balanced JSON (braces match) - for line in &lines { - let opens = line.matches('{').count(); - let closes = line.matches('}').count(); - assert_eq!(opens, closes, "balanced braces in: {line}"); - } - std::fs::remove_file(&path).ok(); - } - - #[test] - fn test_sanitize_strips_quotes() { - assert_eq!(sanitize("sa\"r\n"), "sar"); - } -} diff --git a/v2/crates/ruview-swarm/src/lib.rs b/v2/crates/ruview-swarm/src/lib.rs deleted file mode 100644 index cd9b8ae4..00000000 --- a/v2/crates/ruview-swarm/src/lib.rs +++ /dev/null @@ -1,26 +0,0 @@ -//! Drone swarm control system — ADR-148. -//! -//! Hierarchical-mesh topology · Raft consensus · MAPPO MARL · CSI sensing integration - -pub mod types; -pub mod topology; -pub mod formation; -pub mod planning; -pub mod allocation; -pub mod sensing; -pub mod marl; -pub mod security; -pub mod failsafe; -pub mod config; -pub mod demo; -pub mod evals; -pub mod integration; -pub mod bench_support; -pub mod orchestrator; -pub mod ruflo; - -pub use types::{ - ClusterId, CsiDetection, DroneState, FailSafeState, GridCell, NodeId, - Position3D, SwarmError, SwarmResult, SwarmRole, SwarmTask, TaskId, TaskKind, Velocity3D, -}; -pub use config::SwarmConfig; diff --git a/v2/crates/ruview-swarm/src/marl/actor.rs b/v2/crates/ruview-swarm/src/marl/actor.rs deleted file mode 100644 index 21fa3e8c..00000000 --- a/v2/crates/ruview-swarm/src/marl/actor.rs +++ /dev/null @@ -1,196 +0,0 @@ -use super::observation::LocalObservation; - -/// Action output from the MAPPO actor. -#[derive(Debug, Clone)] -pub struct ActorAction { - pub delta_heading_rad: f32, // [-pi/6, +pi/6] per second - pub delta_altitude_m: f32, // [-1.0, +1.0] m per second - pub speed_ms: f32, // [0.0, 8.0] m/s - pub trigger_csi_scan: bool, -} - -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] -pub struct ActorConfig { - /// Hidden layer dimensions; default [128, 64]. - pub hidden_dims: Vec, - pub max_speed_ms: f32, - pub max_heading_delta_rad: f32, - pub max_altitude_delta_m: f32, -} - -impl Default for ActorConfig { - fn default() -> Self { - Self { - hidden_dims: vec![128, 64], - max_speed_ms: 8.0, - max_heading_delta_rad: std::f32::consts::PI / 6.0, - max_altitude_delta_m: 1.0, - } - } -} - -// --------------------------------------------------------------------------- -// MLP helper functions -// --------------------------------------------------------------------------- - -#[inline] -fn relu(x: f32) -> f32 { x.max(0.0) } - -#[inline] -fn tanh_f32(x: f32) -> f32 { x.tanh() } - -#[inline] -fn sigmoid(x: f32) -> f32 { 1.0 / (1.0 + (-x).exp()) } - -fn matmul_vec(weights: &[Vec], input: &[f32], bias: &[f32]) -> Vec { - weights - .iter() - .zip(bias.iter()) - .map(|(row, b)| row.iter().zip(input.iter()).map(|(w, x)| w * x).sum::() + b) - .collect() -} - -// --------------------------------------------------------------------------- -// MAPPO actor -// --------------------------------------------------------------------------- - -/// Simple 3-layer MLP actor (pure Rust, no ONNX). -/// -/// For production deployment, replace with an ONNX INT8 model loaded via the -/// `ort` crate (enable feature `onnx`). The interface — `forward(&obs) -> ActorAction` -/// — remains identical. -pub struct MappoActor { - pub config: ActorConfig, - /// Layer 1: obs_dim × hidden1 - w1: Vec>, - b1: Vec, - /// Layer 2: hidden1 × hidden2 - w2: Vec>, - b2: Vec, - /// Output layer: hidden2 × 4 - w_out: Vec>, - b_out: Vec, -} - -impl MappoActor { - /// Create an actor with random weights using the standard observation dimension. - /// - /// Convenience constructor — uses `LocalObservation::DIM` as the input dimension. - pub fn random_init(config: ActorConfig) -> Self { - Self::random_init_with_dim(LocalObservation::DIM, config) - } - - /// Create an actor with random (untrained) weights — for testing only. - pub fn random_init_with_dim(obs_dim: usize, config: ActorConfig) -> Self { - use rand::Rng; - let mut rng = rand::thread_rng(); - let h1 = config.hidden_dims[0]; - let h2 = config.hidden_dims.get(1).copied().unwrap_or(64); - - let w1 = (0..h1) - .map(|_| (0..obs_dim).map(|_| rng.gen_range(-0.1..0.1)).collect()) - .collect(); - let b1 = vec![0.0f32; h1]; - let w2 = (0..h2) - .map(|_| (0..h1).map(|_| rng.gen_range(-0.1..0.1)).collect()) - .collect(); - let b2 = vec![0.0f32; h2]; - let w_out = (0..4) - .map(|_| (0..h2).map(|_| rng.gen_range(-0.1..0.1)).collect()) - .collect(); - let b_out = vec![0.0f32; 4]; - - Self { config, w1, b1, w2, b2, w_out, b_out } - } - - /// Forward pass: observation -> action. - pub fn forward(&self, obs: &LocalObservation) -> ActorAction { - let input = obs.to_vec(); - let h1: Vec = matmul_vec(&self.w1, &input, &self.b1) - .into_iter().map(relu).collect(); - let h2: Vec = matmul_vec(&self.w2, &h1, &self.b2) - .into_iter().map(relu).collect(); - let out = matmul_vec(&self.w_out, &h2, &self.b_out); - - ActorAction { - delta_heading_rad: tanh_f32(out[0]) * self.config.max_heading_delta_rad, - delta_altitude_m: tanh_f32(out[1]) * self.config.max_altitude_delta_m, - speed_ms: sigmoid(out[2]) * self.config.max_speed_ms, - trigger_csi_scan: sigmoid(out[3]) > 0.5, - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - fn dummy_obs() -> LocalObservation { - LocalObservation { - own_state: [0.5; 9], - neighbor_relative_pos: [0.0; 18], - grid_tile: [0.1; 25], - csi_reading: [0.0; 5], - task_encoding: [0.0; 7], - } - } - - #[test] - fn forward_action_bounds() { - let config = ActorConfig::default(); - let actor = MappoActor::random_init_with_dim(LocalObservation::DIM, config.clone()); - let action = actor.forward(&dummy_obs()); - - assert!(action.delta_heading_rad.abs() <= config.max_heading_delta_rad + 1e-5); - assert!(action.delta_altitude_m.abs() <= config.max_altitude_delta_m + 1e-5); - assert!(action.speed_ms >= 0.0 && action.speed_ms <= config.max_speed_ms + 1e-5); - } - - #[test] - fn forward_deterministic_with_zero_weights() { - // Manually craft an actor with zero weights so output is deterministic. - let config = ActorConfig::default(); - let h1 = config.hidden_dims[0]; - let h2 = config.hidden_dims[1]; - - let actor = MappoActor { - w1: vec![vec![0.0; LocalObservation::DIM]; h1], - b1: vec![0.0; h1], - w2: vec![vec![0.0; h1]; h2], - b2: vec![0.0; h2], - w_out: vec![vec![0.0; h2]; 4], - b_out: vec![0.0; 4], - config, - }; - let action = actor.forward(&dummy_obs()); - // tanh(0) = 0, sigmoid(0) = 0.5 - assert!((action.delta_heading_rad).abs() < 1e-6); - assert!((action.delta_altitude_m).abs() < 1e-6); - assert!((action.speed_ms - 4.0).abs() < 1e-4); // sigmoid(0) * 8 = 4 - } - - #[test] - fn test_actor_action_bounds() { - let cfg = ActorConfig::default(); - let actor = MappoActor::random_init(cfg.clone()); - let obs = LocalObservation::zeros(); - let action = actor.forward(&obs); - assert!(action.delta_heading_rad.abs() <= cfg.max_heading_delta_rad * 1.001); - assert!(action.delta_altitude_m.abs() <= cfg.max_altitude_delta_m * 1.001); - assert!(action.speed_ms >= 0.0 && action.speed_ms <= cfg.max_speed_ms * 1.001); - } - - #[test] - fn test_actor_inference_speed() { - let actor = MappoActor::random_init(ActorConfig::default()); - let obs = LocalObservation::zeros(); - let start = std::time::Instant::now(); - for _ in 0..1000 { - let _ = actor.forward(&obs); - } - let elapsed = start.elapsed(); - // 100ms threshold in release builds; debug builds allow 10× slack - let limit_ms = if cfg!(debug_assertions) { 1000 } else { 100 }; - assert!(elapsed.as_millis() < limit_ms, "1000 inferences took {}ms, limit {}ms", elapsed.as_millis(), limit_ms); - } -} diff --git a/v2/crates/ruview-swarm/src/marl/candle_ppo.rs b/v2/crates/ruview-swarm/src/marl/candle_ppo.rs deleted file mode 100644 index a757ef2a..00000000 --- a/v2/crates/ruview-swarm/src/marl/candle_ppo.rs +++ /dev/null @@ -1,268 +0,0 @@ -//! Real PPO trainer using Candle autodiff (CPU or CUDA). -//! -//! Replaces the finite-difference placeholder in `training_loop.rs` for actual -//! training. The update step runs a genuine backward pass via -//! [`candle_nn::Optimizer::backward_step`] — not a finite-difference nudge. -//! -//! Compiled only under the `train` feature. - -use candle_core::{DType, Device, Module, Result as CandleResult, Tensor}; -use candle_nn::{linear, AdamW, Linear, Optimizer, ParamsAdamW, VarBuilder, VarMap}; - -use crate::marl::observation::LocalObservation; - -/// Device selection — CUDA if `cuda` feature + GPU present, else CPU. -pub fn select_device() -> Device { - #[cfg(feature = "cuda")] - { - if let Ok(d) = Device::cuda_if_available(0) { - return d; - } - } - Device::Cpu -} - -/// Candle-backed actor-critic network for PPO. -/// Input: 64-dim `LocalObservation`. Outputs: 4-dim action mean + state value. -pub struct CandleActorCritic { - l1: Linear, - l2: Linear, - action_head: Linear, // 4 outputs (heading, altitude, speed, scan-logit) - value_head: Linear, // 1 output (state value) - #[allow(dead_code)] - log_std: Tensor, // learnable log-std for the 3 continuous actions - device: Device, - varmap: VarMap, -} - -impl CandleActorCritic { - pub fn new(device: Device) -> CandleResult { - let varmap = VarMap::new(); - let vb = VarBuilder::from_varmap(&varmap, DType::F32, &device); - let obs_dim = LocalObservation::DIM; // 64 - let l1 = linear(obs_dim, 128, vb.pp("l1"))?; - let l2 = linear(128, 64, vb.pp("l2"))?; - let action_head = linear(64, 4, vb.pp("action"))?; - let value_head = linear(64, 1, vb.pp("value"))?; - // `get` on a varmap-backed builder registers a trainable variable. - let log_std = vb.get(3, "log_std")?; - Ok(Self { - l1, - l2, - action_head, - value_head, - log_std, - device, - varmap, - }) - } - - /// Forward: obs batch `[B, 64]` → (action_mean `[B,4]`, value `[B,1]`). - pub fn forward(&self, obs: &Tensor) -> CandleResult<(Tensor, Tensor)> { - let h = self.l1.forward(obs)?.relu()?; - let h = self.l2.forward(&h)?.relu()?; - let action_mean = self.action_head.forward(&h)?; - let value = self.value_head.forward(&h)?; - Ok((action_mean, value)) - } - - pub fn varmap(&self) -> &VarMap { - &self.varmap - } - pub fn device(&self) -> &Device { - &self.device - } -} - -/// PPO training config (real version). -#[derive(Debug, Clone)] -pub struct CandlePpoConfig { - pub lr: f64, - pub clip_epsilon: f32, - pub gamma: f32, - pub gae_lambda: f32, - pub entropy_coeff: f32, - pub value_coeff: f32, - pub epochs: usize, - pub minibatch: usize, -} - -impl Default for CandlePpoConfig { - fn default() -> Self { - Self { - lr: 3e-4, - clip_epsilon: 0.2, - gamma: 0.99, - gae_lambda: 0.95, - entropy_coeff: 0.01, - value_coeff: 0.5, - epochs: 10, - minibatch: 64, - } - } -} - -/// PPO trainer with real Candle autodiff. -/// -/// One PPO training step runs over a batch of -/// `(obs, action, advantage, return, old_log_prob)` and returns -/// `(policy_loss, value_loss, entropy)`. Uses the clipped surrogate objective -/// with GAE advantages. -pub struct CandleTrainer { - pub net: CandleActorCritic, - optimizer: AdamW, - config: CandlePpoConfig, -} - -impl CandleTrainer { - pub fn new(config: CandlePpoConfig) -> CandleResult { - let device = select_device(); - let net = CandleActorCritic::new(device)?; - let params = ParamsAdamW { - lr: config.lr, - ..Default::default() - }; - let optimizer = AdamW::new(net.varmap().all_vars(), params)?; - Ok(Self { - net, - optimizer, - config, - }) - } - - /// Compute GAE advantages and returns from rewards + values + dones. - pub fn compute_gae( - &self, - rewards: &[f32], - values: &[f32], - dones: &[bool], - ) -> (Vec, Vec) { - let n = rewards.len(); - let mut advantages = vec![0.0f32; n]; - let mut returns = vec![0.0f32; n]; - let mut gae = 0.0f32; - for t in (0..n).rev() { - let next_value = if t + 1 < n { values[t + 1] } else { 0.0 }; - let next_nonterminal = if dones[t] { 0.0 } else { 1.0 }; - let delta = - rewards[t] + self.config.gamma * next_value * next_nonterminal - values[t]; - gae = delta + self.config.gamma * self.config.gae_lambda * next_nonterminal * gae; - advantages[t] = gae; - returns[t] = gae + values[t]; - } - (advantages, returns) - } - - /// Run a PPO update on a batch. `obs_batch` aligned with - /// `actions`/`advantages`/`returns`/`old_log_probs`. - /// Returns `(mean_policy_loss, mean_value_loss, mean_entropy)`. - pub fn update( - &mut self, - obs_batch: &[LocalObservation], - _actions: &[[f32; 4]], - advantages: &[f32], - returns: &[f32], - _old_log_probs: &[f32], - ) -> CandleResult<(f32, f32, f32)> { - let device = self.net.device().clone(); - let b = obs_batch.len(); - if b == 0 { - return Ok((0.0, 0.0, 0.0)); - } - - // Build obs tensor [B, 64] - let obs_flat: Vec = obs_batch.iter().flat_map(|o| o.to_vec()).collect(); - let obs_t = Tensor::from_vec(obs_flat, (b, LocalObservation::DIM), &device)?; - let adv_t = Tensor::from_vec(advantages.to_vec(), b, &device)?; - let ret_t = Tensor::from_vec(returns.to_vec(), b, &device)?; - - let mut last = (0.0f32, 0.0f32, 0.0f32); - for _epoch in 0..self.config.epochs { - let (action_mean, value) = self.net.forward(&obs_t)?; - // Value loss: MSE(value, returns) - let value = value.squeeze(1)?; - let value_loss = value.sub(&ret_t)?.sqr()?.mean_all()?; - // Policy: use action_mean[:,0] (heading) as a tractable Gaussian - // log-prob proxy (full multivariate is possible; keep it stable for - // the first real version). - let pred_action = action_mean.narrow(1, 0, 1)?.squeeze(1)?; - // Surrogate: -(advantage * pred_action) as a differentiable policy - // signal. This is a simplified-but-REAL gradient (not finite-diff): - // the optimizer runs an actual backward pass over the network. - let surrogate = adv_t.mul(&pred_action)?.mean_all()?; - let policy_loss = surrogate.neg()?; - let total = (policy_loss.clone() - + value_loss.affine(self.config.value_coeff as f64, 0.0)?)?; - self.optimizer.backward_step(&total)?; - last = ( - policy_loss.to_scalar::().unwrap_or(0.0), - value_loss.to_scalar::().unwrap_or(0.0), - 0.0, - ); - } - Ok(last) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_device_selects_cpu_by_default() { - let d = select_device(); - // Without the `cuda` feature this must be CPU. - assert!(matches!(d, Device::Cpu)); - } - - #[test] - fn test_actor_critic_forward_shapes() { - let net = CandleActorCritic::new(Device::Cpu).unwrap(); - let obs = Tensor::zeros((4, LocalObservation::DIM), DType::F32, &Device::Cpu).unwrap(); - let (action_mean, value) = net.forward(&obs).unwrap(); - assert_eq!(action_mean.dims(), &[4, 4]); - assert_eq!(value.dims(), &[4, 1]); - } - - #[test] - fn test_compute_gae_terminal() { - let trainer = CandleTrainer::new(CandlePpoConfig::default()).unwrap(); - let rewards = vec![1.0, 1.0, 1.0]; - let values = vec![0.0, 0.0, 0.0]; - let dones = vec![false, false, true]; - let (adv, ret) = trainer.compute_gae(&rewards, &values, &dones); - assert_eq!(adv.len(), 3); - assert_eq!(ret.len(), 3); - // Last step terminal → advantage == reward (no bootstrap). - assert!((adv[2] - 1.0).abs() < 1e-5, "terminal advantage = reward, got {}", adv[2]); - } - - #[test] - fn test_real_autodiff_update_runs() { - let mut trainer = CandleTrainer::new(CandlePpoConfig { - epochs: 3, - ..Default::default() - }) - .unwrap(); - let obs = vec![LocalObservation::zeros(); 8]; - let actions = vec![[0.0f32; 4]; 8]; - let advantages = vec![1.0f32; 8]; - let returns = vec![2.0f32; 8]; - let old_log_probs = vec![0.0f32; 8]; - let (pl, vl, ent) = trainer - .update(&obs, &actions, &advantages, &returns, &old_log_probs) - .unwrap(); - assert!(pl.is_finite(), "policy loss finite"); - assert!(vl.is_finite(), "value loss finite"); - assert_eq!(ent, 0.0); - // Value loss must be positive (predicted value starts ~0, target = 2.0). - assert!(vl > 0.0, "value loss should be > 0, got {}", vl); - } - - #[test] - fn test_update_empty_batch() { - let mut trainer = CandleTrainer::new(CandlePpoConfig::default()).unwrap(); - let r = trainer.update(&[], &[], &[], &[], &[]).unwrap(); - assert_eq!(r, (0.0, 0.0, 0.0)); - } -} diff --git a/v2/crates/ruview-swarm/src/marl/learning.rs b/v2/crates/ruview-swarm/src/marl/learning.rs deleted file mode 100644 index f8cdd6bd..00000000 --- a/v2/crates/ruview-swarm/src/marl/learning.rs +++ /dev/null @@ -1,301 +0,0 @@ -//! Selectable self-learning strategies for swarm MARL. -//! -//! - Mappo: centralized-critic, decentralized-execution (CTDE). Best cooperative -//! performance; the centralized critic sees global state during training. -//! - Ippo: independent PPO — each agent learns alone, no shared critic. Robust to -//! adversarial/jamming conditions and partial observability; weaker coordination. -//! - MappoCuriosity: MAPPO + intrinsic-curiosity reward bonus for exploration in -//! sparse-reward regimes (count-based novelty over visited regions). -//! - MetaRl: MAML-style fast adaptation — a base policy + per-deployment fast-weights -//! that adapt in a few in-flight steps to wind/sensor drift. -//! -//! Pure Rust — always compiled (no Candle needed). This is the *strategy* layer; -//! the gradient backend lives in `candle_ppo.rs` behind the `train` feature. - -/// Which self-learning strategy the swarm trains under. Selectable at runtime. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] -pub enum LearningPattern { - /// Centralized critic, decentralized execution (CTDE). - #[default] - Mappo, - /// Independent PPO — each agent learns alone, no shared critic. - Ippo, - /// MAPPO plus count-based intrinsic-curiosity reward bonus. - MappoCuriosity, - /// MAML-style fast adaptation with per-deployment fast-weights. - MetaRl, -} - -impl LearningPattern { - /// Parse from a short identifier. Unknown strings fall back to the default - /// (Mappo). Accepts both canonical names and friendly aliases. - // Intentional inherent infallible parser (returns Self, not Result); shipped API. - #[allow(clippy::should_implement_trait)] - pub fn from_str(s: &str) -> Self { - match s.trim().to_ascii_lowercase().as_str() { - "mappo" => LearningPattern::Mappo, - "ippo" => LearningPattern::Ippo, - "curiosity" | "mappocuriosity" | "mappo_curiosity" => { - LearningPattern::MappoCuriosity - } - "meta" | "metarl" | "meta_rl" => LearningPattern::MetaRl, - _ => LearningPattern::default(), - } - } - - /// Canonical short name. `from_str(p.name()) == p` for every variant. - pub fn name(&self) -> &'static str { - match self { - LearningPattern::Mappo => "mappo", - LearningPattern::Ippo => "ippo", - LearningPattern::MappoCuriosity => "curiosity", - LearningPattern::MetaRl => "meta", - } - } - - /// Whether this strategy uses a centralized critic (CTDE) vs independent. - pub fn centralized_critic(&self) -> bool { - matches!( - self, - LearningPattern::Mappo - | LearningPattern::MappoCuriosity - | LearningPattern::MetaRl - ) - } - - /// Whether an intrinsic-curiosity bonus is added to the reward. - pub fn uses_curiosity(&self) -> bool { - matches!(self, LearningPattern::MappoCuriosity) - } -} - -// --------------------------------------------------------------------------- -// Curiosity: count-based intrinsic motivation -// --------------------------------------------------------------------------- - -/// Count-based intrinsic-motivation module. -/// -/// Maintains a visitation count over a coarse `grid × grid` spatial map of the -/// mission area. The intrinsic bonus for visiting a cell is `beta / sqrt(count)`, -/// computed *before* the visit is recorded — so novelty decays as a region is -/// re-visited. This rewards exploration in sparse-reward regimes. -pub struct CuriosityModule { - counts: Vec, - grid: u32, - cell_w: f64, - cell_h: f64, - beta: f32, -} - -impl CuriosityModule { - /// Build a curiosity grid covering an `area_w × area_h` metre region split - /// into `grid × grid` cells. `beta` scales the intrinsic bonus magnitude. - pub fn new(area_w: f64, area_h: f64, grid: u32, beta: f32) -> Self { - let g = grid.max(1); - let cells = (g as usize) * (g as usize); - let cell_w = if area_w > 0.0 { area_w / g as f64 } else { 1.0 }; - let cell_h = if area_h > 0.0 { area_h / g as f64 } else { 1.0 }; - Self { - counts: vec![0; cells], - grid: g, - cell_w, - cell_h, - beta, - } - } - - /// Map a world-coordinate to a flat cell index, clamped to the grid. - fn cell_index(&self, x: f64, y: f64) -> usize { - let gx = ((x / self.cell_w).floor() as i64).clamp(0, self.grid as i64 - 1) as usize; - let gy = ((y / self.cell_h).floor() as i64).clamp(0, self.grid as i64 - 1) as usize; - gy * self.grid as usize + gx - } - - /// Record a visit and return the intrinsic reward bonus for novelty. - /// - /// The bonus is `beta / sqrt(count)` using the count *before* this visit is - /// counted (a never-before-seen cell starts at count 1, giving the full - /// `beta` bonus; the cell's count is then incremented). - pub fn visit_bonus(&mut self, x: f64, y: f64) -> f32 { - let idx = self.cell_index(x, y); - // count BEFORE increment, treated as at least 1 for the first visit. - let prior = self.counts[idx] + 1; - let bonus = self.beta / (prior as f32).sqrt(); - self.counts[idx] = self.counts[idx].saturating_add(1); - bonus - } - - /// Total recorded visits across the whole grid. - pub fn total_visits(&self) -> u64 { - self.counts.iter().map(|&c| c as u64).sum() - } -} - -// --------------------------------------------------------------------------- -// Meta-RL: MAML-style fast-weight adapter -// --------------------------------------------------------------------------- - -/// MAML-style fast-weight adapter for few-shot in-flight adaptation. -/// -/// Holds a meta-learned `base` vector of policy adjustments plus a `fast` vector -/// of per-deployment deltas. The fast-weights adapt with a gradient-free inner -/// step driven by the advantage signal, letting a freshly deployed swarm tune to -/// local wind / sensor drift within a handful of steps. `reset_fast` clears the -/// deployment-specific deltas while keeping the meta-learned base. -pub struct MetaAdapter { - base: Vec, - fast: Vec, - inner_lr: f32, -} - -impl MetaAdapter { - /// New adapter with a zeroed `dim`-length base and fast-weight vector. - pub fn new(dim: usize, inner_lr: f32) -> Self { - Self { - base: vec![0.0; dim], - fast: vec![0.0; dim], - inner_lr, - } - } - - /// One inner-loop adaptation step from an advantage signal (few-shot). - /// - /// Moves the fast-weights along `advantage * feature_grad`, scaled by the - /// inner learning rate — the gradient-free MAML inner update used while in - /// flight. `feature_grad` shorter than the weight vector adapts only its - /// leading dimensions; extra entries are ignored. - pub fn adapt(&mut self, advantage: f32, feature_grad: &[f32]) { - let n = self.fast.len().min(feature_grad.len()); - for (f, &g) in self.fast.iter_mut().zip(feature_grad.iter()).take(n) { - *f += self.inner_lr * advantage * g; - } - } - - /// Current effective weights (base + fast). - pub fn effective(&self) -> Vec { - self.base - .iter() - .zip(self.fast.iter()) - .map(|(b, f)| b + f) - .collect() - } - - /// Reset fast-weights for a new deployment (keeps the meta-learned base). - pub fn reset_fast(&mut self) { - for f in self.fast.iter_mut() { - *f = 0.0; - } - } - - /// Fold the current fast-weights into the meta-learned base (outer-loop - /// consolidation) and clear the fast deltas. - pub fn consolidate(&mut self) { - for (b, f) in self.base.iter_mut().zip(self.fast.iter()) { - *b += *f; - } - self.reset_fast(); - } -} - -// --------------------------------------------------------------------------- -// Reward shaping helper -// --------------------------------------------------------------------------- - -/// Shape a base reward according to the selected learning pattern. -/// -/// For curiosity-based patterns the intrinsic `curiosity_bonus` is added to the -/// extrinsic `base`; for all other patterns the base reward passes through. -pub fn shaped_reward(pattern: LearningPattern, base: f32, curiosity_bonus: f32) -> f32 { - if pattern.uses_curiosity() { - base + curiosity_bonus - } else { - base - } -} - -#[cfg(test)] -mod tests { - use super::*; - - const ALL: [LearningPattern; 4] = [ - LearningPattern::Mappo, - LearningPattern::Ippo, - LearningPattern::MappoCuriosity, - LearningPattern::MetaRl, - ]; - - #[test] - fn test_pattern_from_str_roundtrip() { - for p in ALL { - assert_eq!( - LearningPattern::from_str(p.name()), - p, - "round-trip failed for {}", - p.name() - ); - } - } - - #[test] - fn test_centralized_vs_independent() { - // Mappo IS centralized (CTDE); Ippo is NOT (independent learners). - assert!(LearningPattern::Mappo.centralized_critic()); - assert!(!LearningPattern::Ippo.centralized_critic()); - // Curiosity and MetaRl are MAPPO-family → centralized. - assert!(LearningPattern::MappoCuriosity.centralized_critic()); - assert!(LearningPattern::MetaRl.centralized_critic()); - } - - #[test] - fn test_curiosity_bonus_decreases() { - let mut cm = CuriosityModule::new(100.0, 100.0, 10, 1.0); - let first = cm.visit_bonus(50.0, 50.0); - let second = cm.visit_bonus(50.0, 50.0); // same cell again - assert!( - second < first, - "novelty should decay: first={first}, second={second}" - ); - } - - #[test] - fn test_curiosity_bonus_in_bounds() { - let mut cm = CuriosityModule::new(100.0, 100.0, 8, 0.5); - // In-bounds, out-of-bounds, and negative coords all clamp safely. - for &(x, y) in &[(0.0, 0.0), (50.0, 50.0), (999.0, -999.0), (-5.0, 1000.0)] { - let b = cm.visit_bonus(x, y); - assert!(b.is_finite(), "bonus must be finite, got {b}"); - assert!(b >= 0.0, "bonus must be >= 0, got {b}"); - } - } - - #[test] - fn test_meta_adapter_changes_weights() { - let mut ma = MetaAdapter::new(4, 0.1); - let base = ma.effective(); - ma.adapt(2.0, &[1.0, -1.0, 0.5, 0.0]); - let adapted = ma.effective(); - assert_ne!(base, adapted, "adapt() must change effective weights"); - ma.reset_fast(); - assert_eq!( - base, - ma.effective(), - "reset_fast() must restore the meta-learned base" - ); - } - - #[test] - fn test_shaped_reward_curiosity_only() { - let base = 10.0; - let bonus = 3.0; - // MappoCuriosity adds the bonus. - assert_eq!( - shaped_reward(LearningPattern::MappoCuriosity, base, bonus), - base + bonus - ); - // Mappo does not. - assert_eq!(shaped_reward(LearningPattern::Mappo, base, bonus), base); - // Ippo and MetaRl also ignore the bonus. - assert_eq!(shaped_reward(LearningPattern::Ippo, base, bonus), base); - assert_eq!(shaped_reward(LearningPattern::MetaRl, base, bonus), base); - } -} diff --git a/v2/crates/ruview-swarm/src/marl/mod.rs b/v2/crates/ruview-swarm/src/marl/mod.rs deleted file mode 100644 index 42df6cb5..00000000 --- a/v2/crates/ruview-swarm/src/marl/mod.rs +++ /dev/null @@ -1,20 +0,0 @@ -pub mod actor; -pub mod learning; -pub mod observation; -pub mod reward; -pub mod role_attention; -pub mod trainer; -pub mod training_loop; - -pub use actor::{MappoActor, ActorConfig, ActorAction}; -pub use learning::{LearningPattern, CuriosityModule, MetaAdapter, shaped_reward}; -pub use observation::LocalObservation; -pub use reward::{RewardCalculator, RewardContext}; -pub use role_attention::{NodeRole, RoleAttention, triangulation_geometry_penalty}; -pub use trainer::{TrainingConfig, TrainingMode, DomainRandomizationConfig}; -pub use training_loop::{ReplayBuffer, Transition, PpoConfig, UpdateStats, ppo_update}; - -#[cfg(feature = "train")] -pub mod candle_ppo; -#[cfg(feature = "train")] -pub use candle_ppo::{CandleActorCritic, CandlePpoConfig, CandleTrainer, select_device}; diff --git a/v2/crates/ruview-swarm/src/marl/observation.rs b/v2/crates/ruview-swarm/src/marl/observation.rs deleted file mode 100644 index c90fe5e8..00000000 --- a/v2/crates/ruview-swarm/src/marl/observation.rs +++ /dev/null @@ -1,218 +0,0 @@ -use crate::types::{DroneState, NodeId, Position3D, GridCell, CsiDetection}; - -/// Local observation vector for a single drone agent. -/// Feeds into the MAPPO actor network. -/// -/// Dimension breakdown: -/// - own_state: 9 (pos xyz, vel xyz, heading, battery, link_quality) -/// - neighbor_relative_pos: 18 (K=6 neighbours × 3 floats each) -/// - grid_tile: 25 (5×5 cell victim probabilities) -/// - csi_reading: 5 (confidence, est pos xyz, has_detection flag) -/// - task_encoding: 7 (target xyz, deadline_norm, task_type one-hot × 3) -/// -/// TOTAL: 64 -#[derive(Debug, Clone)] -pub struct LocalObservation { - /// Own state: [pos_x, pos_y, pos_z, vel_x, vel_y, vel_z, heading, battery, link_quality] - pub own_state: [f32; 9], - /// K=6 nearest-neighbour relative positions: [dx, dy, dz] × 6 = 18 floats - pub neighbor_relative_pos: [f32; 18], - /// 5×5 grid tile centred on drone position: victim_probability × 25 - pub grid_tile: [f32; 25], - /// CSI reading: [confidence, est_x, est_y, est_z, has_detection] - pub csi_reading: [f32; 5], - /// Current task: [target_x, target_y, target_z, deadline_norm, task_type_one_hot × 3] - pub task_encoding: [f32; 7], -} - -impl LocalObservation { - pub const DIM: usize = 9 + 18 + 25 + 5 + 7; // = 64 - - /// Return an observation with all fields zeroed. - pub fn zeros() -> Self { - Self { - own_state: [0.0; 9], - neighbor_relative_pos: [0.0; 18], - grid_tile: [0.0; 25], - csi_reading: [0.0; 5], - task_encoding: [0.0; 7], - } - } - - pub fn to_vec(&self) -> Vec { - let mut v = Vec::with_capacity(Self::DIM); - v.extend_from_slice(&self.own_state); - v.extend_from_slice(&self.neighbor_relative_pos); - v.extend_from_slice(&self.grid_tile); - v.extend_from_slice(&self.csi_reading); - v.extend_from_slice(&self.task_encoding); - v - } - - pub fn from_state( - state: &DroneState, - neighbors: &[(NodeId, Position3D)], - grid_tile: [[GridCell; 5]; 5], - csi_detection: Option<&crate::types::CsiDetection>, - task_target: Option<&Position3D>, - ) -> Self { - let own_state = [ - state.position.x as f32 / 1000.0, // normalised to km - state.position.y as f32 / 1000.0, - state.position.z as f32 / 100.0, - state.velocity.vx as f32 / 20.0, // normalised to max speed - state.velocity.vy as f32 / 20.0, - state.velocity.vz as f32 / 5.0, - state.heading_rad as f32 / std::f32::consts::PI, - state.battery_pct / 100.0, - state.link_quality, - ]; - - let mut neighbor_relative_pos = [0.0f32; 18]; - for (i, (_, pos)) in neighbors.iter().take(6).enumerate() { - let base = i * 3; - neighbor_relative_pos[base] = (pos.x - state.position.x) as f32 / 100.0; - neighbor_relative_pos[base + 1] = (pos.y - state.position.y) as f32 / 100.0; - neighbor_relative_pos[base + 2] = (pos.z - state.position.z) as f32 / 10.0; - } - - let mut grid_flat = [0.0f32; 25]; - for (r, row) in grid_tile.iter().enumerate() { - for (c, cell) in row.iter().enumerate() { - grid_flat[r * 5 + c] = cell.victim_probability; - } - } - - let csi_reading = if let Some(det) = csi_detection { - let vp = det.victim_position.unwrap_or(state.position); - [det.confidence, (vp.x / 100.0) as f32, (vp.y / 100.0) as f32, (vp.z / 10.0) as f32, 1.0] - } else { - [0.0, 0.0, 0.0, 0.0, 0.0] - }; - - let task_encoding: [f32; 7] = if let Some(target) = task_target { - [ - (target.x / 100.0) as f32, - (target.y / 100.0) as f32, - (target.z / 10.0) as f32, - 1.0, // deadline_norm: placeholder - 1.0, 0.0, 0.0, // task_type one-hot: CoverCell - ] - } else { - [0.0f32; 7] - }; - - Self { - own_state, - neighbor_relative_pos, - grid_tile: grid_flat, - csi_reading, - task_encoding, - } - } - - /// Build an observation from a drone state without a pre-computed grid tile. - /// The grid_tile component is left as zeros; use `from_state` when you have - /// a populated grid available. - pub fn from_state_no_grid( - state: &DroneState, - neighbors: &[(NodeId, Position3D)], - csi_detection: Option<&CsiDetection>, - task_target: Option<&Position3D>, - ) -> Self { - let own_state = [ - (state.position.x / 1000.0) as f32, - (state.position.y / 1000.0) as f32, - (state.position.z / 100.0) as f32, - (state.velocity.vx / 20.0) as f32, - (state.velocity.vy / 20.0) as f32, - (state.velocity.vz / 5.0) as f32, - (state.heading_rad / std::f64::consts::PI) as f32, - state.battery_pct / 100.0, - state.link_quality, - ]; - - let mut neighbor_relative_pos = [0.0f32; 18]; - for (i, (_, pos)) in neighbors.iter().take(6).enumerate() { - let base = i * 3; - neighbor_relative_pos[base] = ((pos.x - state.position.x) / 100.0) as f32; - neighbor_relative_pos[base+1] = ((pos.y - state.position.y) / 100.0) as f32; - neighbor_relative_pos[base+2] = ((pos.z - state.position.z) / 10.0) as f32; - } - - let csi_reading = match csi_detection { - Some(det) => { - let vp = det.victim_position.unwrap_or(state.position); - [det.confidence, (vp.x / 100.0) as f32, (vp.y / 100.0) as f32, (vp.z / 10.0) as f32, 1.0] - } - None => [0.0; 5], - }; - - let task_encoding: [f32; 7] = match task_target { - Some(t) => [(t.x / 100.0) as f32, (t.y / 100.0) as f32, (t.z / 10.0) as f32, 1.0, 1.0, 0.0, 0.0], - None => [0.0; 7], - }; - - Self { - own_state, - neighbor_relative_pos, - grid_tile: [0.0; 25], - csi_reading, - task_encoding, - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::types::{DroneState, NodeId}; - - #[test] - fn observation_dimension() { - assert_eq!(LocalObservation::DIM, 64); - } - - #[test] - fn to_vec_length() { - let obs = LocalObservation { - own_state: [0.0; 9], - neighbor_relative_pos: [0.0; 18], - grid_tile: [0.0; 25], - csi_reading: [0.0; 5], - task_encoding: [0.0; 7], - }; - assert_eq!(obs.to_vec().len(), LocalObservation::DIM); - } - - #[test] - fn from_state_produces_correct_dim() { - let state = DroneState::default_at_origin(NodeId(0)); - let grid = [[GridCell::default(); 5]; 5]; - let obs = LocalObservation::from_state(&state, &[], grid, None, None); - assert_eq!(obs.to_vec().len(), LocalObservation::DIM); - } - - #[test] - fn test_observation_dim() { - let obs = LocalObservation::zeros(); - assert_eq!(obs.to_vec().len(), LocalObservation::DIM); - } - - #[test] - fn test_from_state_battery_normalised() { - use crate::types::Velocity3D; - let state = DroneState { - id: NodeId(0), - position: Default::default(), - velocity: Velocity3D::default(), - heading_rad: 0.0, - altitude_agl_m: 30.0, - battery_pct: 75.0, - link_quality: 0.9, - timestamp_ms: 0, - }; - let obs = LocalObservation::from_state_no_grid(&state, &[], None, None); - assert!((obs.own_state[7] - 0.75).abs() < 1e-4, "battery should be normalised to 0.75"); - } -} diff --git a/v2/crates/ruview-swarm/src/marl/reward.rs b/v2/crates/ruview-swarm/src/marl/reward.rs deleted file mode 100644 index 462e3fbb..00000000 --- a/v2/crates/ruview-swarm/src/marl/reward.rs +++ /dev/null @@ -1,144 +0,0 @@ -use crate::types::DroneState; - -/// Reward function for the MAPPO training loop. -/// -/// Shaped reward components: -/// +coverage_reward per new grid cell visited -/// +detection_reward per confirmed victim detection -/// +triangulation_reward per contribution to a triangulation event -/// idle_penalty when no useful work done this step -/// collision_penalty when nearest neighbour < min_separation_m -/// geofence_penalty when drone breaches the mission boundary -/// battery_depletion_penalty when battery runs out outside RTH range -pub struct RewardCalculator { - pub coverage_reward: f32, - pub detection_reward: f32, - pub triangulation_reward: f32, - pub idle_penalty: f32, - pub collision_penalty: f32, - pub geofence_penalty: f32, - pub battery_depletion_penalty: f32, - pub min_separation_m: f64, -} - -impl Default for RewardCalculator { - fn default() -> Self { - Self { - coverage_reward: 10.0, - detection_reward: 50.0, - triangulation_reward: 5.0, - idle_penalty: -2.0, - collision_penalty: -100.0, - geofence_penalty: -50.0, - battery_depletion_penalty: -30.0, - min_separation_m: 1.5, - } - } -} - -/// Context needed to compute the reward for a single agent step. -pub struct RewardContext<'a> { - pub state: &'a DroneState, - pub new_cells_covered: u32, - pub victim_confirmed: bool, - pub contributed_to_triangulation: bool, - /// Distance to nearest neighbour, in metres. - pub nearest_neighbor_dist: f64, - pub geofence_breached: bool, - pub battery_depleted_without_rth: bool, -} - -impl RewardCalculator { - /// Compute the scalar reward for one agent at one timestep. - pub fn compute(&self, ctx: &RewardContext) -> f32 { - let mut reward = 0.0f32; - - reward += ctx.new_cells_covered as f32 * self.coverage_reward; - - if ctx.victim_confirmed { - reward += self.detection_reward; - } - if ctx.contributed_to_triangulation { - reward += self.triangulation_reward; - } - // Idle penalty only when no positive work was done. - if ctx.new_cells_covered == 0 && !ctx.victim_confirmed { - reward += self.idle_penalty; - } - if ctx.nearest_neighbor_dist < self.min_separation_m { - reward += self.collision_penalty; - } - if ctx.geofence_breached { - reward += self.geofence_penalty; - } - if ctx.battery_depleted_without_rth { - reward += self.battery_depletion_penalty; - } - - reward - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::types::{DroneState, NodeId}; - - fn mk_state() -> DroneState { - DroneState::default_at_origin(NodeId(0)) - } - - #[test] - fn detection_reward_dominates() { - let calc = RewardCalculator::default(); - let state = mk_state(); - let ctx = RewardContext { - state: &state, - new_cells_covered: 1, - victim_confirmed: true, - contributed_to_triangulation: false, - nearest_neighbor_dist: 10.0, - geofence_breached: false, - battery_depleted_without_rth: false, - }; - let r = calc.compute(&ctx); - // 10 (coverage) + 50 (detection) = 60 - assert!((r - 60.0).abs() < 1e-4, "reward={}", r); - } - - #[test] - fn collision_dominates_idle() { - let calc = RewardCalculator::default(); - let state = mk_state(); - let ctx = RewardContext { - state: &state, - new_cells_covered: 0, - victim_confirmed: false, - contributed_to_triangulation: false, - nearest_neighbor_dist: 0.5, // < 1.5 m threshold - geofence_breached: false, - battery_depleted_without_rth: false, - }; - let r = calc.compute(&ctx); - // -2 (idle) + -100 (collision) = -102 - assert!((r - (-102.0)).abs() < 1e-4, "reward={}", r); - } - - #[test] - fn test_collision_dominates() { - let calc = RewardCalculator::default(); - let state = mk_state(); - // 3 covered cells = +30, victim = false, collision = -100 → net -70 - let ctx = RewardContext { - state: &state, - new_cells_covered: 3, - victim_confirmed: false, - contributed_to_triangulation: false, - nearest_neighbor_dist: 1.0, // collision (< 1.5 m threshold) - geofence_breached: false, - battery_depleted_without_rth: false, - }; - let r = calc.compute(&ctx); - assert!(r < 0.0, "collision (-100) should dominate coverage (+30), reward={}", r); - } -} diff --git a/v2/crates/ruview-swarm/src/marl/role_attention.rs b/v2/crates/ruview-swarm/src/marl/role_attention.rs deleted file mode 100644 index cd65a8ea..00000000 --- a/v2/crates/ruview-swarm/src/marl/role_attention.rs +++ /dev/null @@ -1,169 +0,0 @@ -//! A-MAPPO heterogeneous-role attention for sensor vs relay swarm nodes. -//! -//! Addresses four edge cases in heterogeneous swarms: -//! 1. Attention collapse onto sensor nodes (relays produce no CSI → get zeroed out) -//! 2. Variable neighbor cardinality (sensor clusters bunch, relays spread) -//! 3. Flocking↔triangulation geometry tension (gated by role) -//! 4. Relay→cluster-head handoff non-stationarity (role-dropout) -//! -//! Pure Rust — compiled in every build (no `train`/candle dependency). - -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum NodeRole { - Sensor, - Relay, - ClusterHead, -} - -impl NodeRole { - /// One-hot role embedding appended to attention keys. - pub fn embedding(&self) -> [f32; 3] { - match self { - NodeRole::Sensor => [1.0, 0.0, 0.0], - NodeRole::Relay => [0.0, 1.0, 0.0], - NodeRole::ClusterHead => [0.0, 0.0, 1.0], - } - } -} - -pub struct RoleAttention { - /// Minimum attention weight floor for relay nodes (prevents collapse). - pub relay_floor: f32, - /// Temperature for softmax. - pub temperature: f32, -} - -impl Default for RoleAttention { - fn default() -> Self { - Self { relay_floor: 0.05, temperature: 1.0 } - } -} - -impl RoleAttention { - /// Compute role-aware attention weights over neighbors. - /// `scores`: raw attention logits per neighbor. `roles`: each neighbor's role. - /// Returns normalized weights with a floor applied to relay nodes so the - /// comms backbone is never fully attention-starved. - pub fn weights(&self, scores: &[f32], roles: &[NodeRole]) -> Vec { - if scores.is_empty() { - return vec![]; - } - // Softmax with temperature - let max = scores.iter().cloned().fold(f32::MIN, f32::max); - let exps: Vec = scores - .iter() - .map(|s| ((s - max) / self.temperature).exp()) - .collect(); - let sum: f32 = exps.iter().sum(); - let mut w: Vec = exps.iter().map(|e| e / sum).collect(); - // Apply relay floor - for (wi, role) in w.iter_mut().zip(roles.iter()) { - if *role == NodeRole::Relay && *wi < self.relay_floor { - *wi = self.relay_floor; - } - } - // Renormalize - let s: f32 = w.iter().sum(); - if s > 0.0 { - for wi in w.iter_mut() { - *wi /= s; - } - } - w - } - - /// Role-segmented attention: separate sensor-pool and relay-pool so a flat - /// softmax over k-nearest (mostly same-role) doesn't break. - pub fn segmented_weights(&self, scores: &[f32], roles: &[NodeRole]) -> Vec { - let sensor_idx: Vec = - (0..roles.len()).filter(|&i| roles[i] != NodeRole::Relay).collect(); - let relay_idx: Vec = - (0..roles.len()).filter(|&i| roles[i] == NodeRole::Relay).collect(); - let mut out = vec![0.0f32; scores.len()]; - // Each pool gets a fixed share of the attention mass (if both populated). - let pools = [(&sensor_idx, 0.6f32), (&relay_idx, 0.4f32)]; - let active_pools = pools.iter().filter(|(idx, _)| !idx.is_empty()).count(); - for (idx, mass) in pools.iter() { - if idx.is_empty() { - continue; - } - let pool_mass = if active_pools == 1 { 1.0 } else { *mass }; - let pool_scores: Vec = idx.iter().map(|&i| scores[i]).collect(); - let max = pool_scores.iter().cloned().fold(f32::MIN, f32::max); - let exps: Vec = pool_scores - .iter() - .map(|s| ((s - max) / self.temperature).exp()) - .collect(); - let sum: f32 = exps.iter().sum(); - for (k, &i) in idx.iter().enumerate() { - out[i] = pool_mass * exps[k] / sum; - } - } - out - } -} - -/// Reward modifier protecting triangulation baseline geometry (ADR-148 §4.2). -/// Penalizes sensor triads whose 3-nearest intersection angle drops below the -/// minimum that keeps multi-view CSI fusion viable. Gated to SENSOR role only — -/// relays are not dragged into triangulation geometry. -pub fn triangulation_geometry_penalty( - self_role: NodeRole, - nearest_angles_deg: &[f32], // intersection angles to the 3 nearest sensors - min_angle_deg: f32, // default 30.0 - penalty: f32, // e.g. -5.0 -) -> f32 { - if self_role != NodeRole::Sensor { - return 0.0; - } - let below = nearest_angles_deg - .iter() - .filter(|&&a| a < min_angle_deg) - .count(); - below as f32 * penalty -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_relay_floor_prevents_collapse() { - let attn = RoleAttention { relay_floor: 0.1, temperature: 1.0 }; - // Sensor scores high, relay scores near zero → relay would collapse - let scores = vec![5.0, 5.0, -10.0]; - let roles = vec![NodeRole::Sensor, NodeRole::Sensor, NodeRole::Relay]; - let w = attn.weights(&scores, &roles); - assert!(w[2] >= 0.09, "relay weight {} should respect floor", w[2]); - let sum: f32 = w.iter().sum(); - assert!((sum - 1.0).abs() < 1e-4, "weights must sum to 1, got {}", sum); - } - - #[test] - fn test_segmented_splits_pools() { - let attn = RoleAttention::default(); - let scores = vec![1.0, 1.0, 1.0]; - let roles = vec![NodeRole::Sensor, NodeRole::Sensor, NodeRole::Relay]; - let w = attn.segmented_weights(&scores, &roles); - let relay_mass = w[2]; - assert!(relay_mass > 0.3 && relay_mass < 0.5, "relay pool ~0.4 mass, got {}", relay_mass); - } - - #[test] - fn test_triangulation_penalty_sensor_only() { - // Relay: no penalty even with bad geometry - assert_eq!( - triangulation_geometry_penalty(NodeRole::Relay, &[10.0, 15.0, 20.0], 30.0, -5.0), - 0.0 - ); - // Sensor: penalized per angle below 30° - let p = triangulation_geometry_penalty(NodeRole::Sensor, &[10.0, 15.0, 40.0], 30.0, -5.0); - assert_eq!(p, -10.0, "two angles below 30° → 2 × -5.0"); - } - - #[test] - fn test_role_embedding_onehot() { - assert_eq!(NodeRole::Sensor.embedding(), [1.0, 0.0, 0.0]); - assert_eq!(NodeRole::Relay.embedding(), [0.0, 1.0, 0.0]); - } -} diff --git a/v2/crates/ruview-swarm/src/marl/trainer.rs b/v2/crates/ruview-swarm/src/marl/trainer.rs deleted file mode 100644 index 4860b632..00000000 --- a/v2/crates/ruview-swarm/src/marl/trainer.rs +++ /dev/null @@ -1,133 +0,0 @@ -use serde::{Deserialize, Serialize}; - -/// Which environment the MARL training loop runs against. -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] -pub enum TrainingMode { - /// Pure Rust simulation — no real hardware or external simulator. - Simulation, - /// Gazebo + PX4 SITL (requires Gazebo running on localhost). - GazeboPx4Sitl { host: String, port: u16 }, - /// Hardware-in-the-loop: real drones, simulated mission world. - HardwareInTheLoop, - /// Demo mode: synthetic CSI with configurable victim positions. - #[default] - Demo, -} - -/// Full MAPPO training configuration. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct TrainingConfig { - pub mode: TrainingMode, - pub num_drones: usize, - pub num_episodes: usize, - pub max_steps_per_episode: usize, - /// PPO clip epsilon. - pub clip_epsilon: f32, - /// Generalised Advantage Estimation lambda. - pub gae_lambda: f32, - /// Adam learning rate. - pub lr: f32, - /// Entropy coefficient (encourages exploration). - pub entropy_coeff: f32, - /// Number of transitions per PPO update batch. - pub batch_size: usize, - /// PPO epochs per update step. - pub ppo_epochs: usize, - /// Domain randomisation settings applied per episode. - pub domain_rand: DomainRandomizationConfig, -} - -impl Default for TrainingConfig { - fn default() -> Self { - Self { - mode: TrainingMode::Demo, - num_drones: 4, - num_episodes: 1000, - max_steps_per_episode: 2000, - clip_epsilon: 0.2, - gae_lambda: 0.95, - lr: 3e-4, - entropy_coeff: 0.01, - batch_size: 2048, - ppo_epochs: 10, - domain_rand: DomainRandomizationConfig::default(), - } - } -} - -/// Per-episode domain randomisation parameters. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct DomainRandomizationConfig { - /// Maximum wind speed (Dryden turbulence model), m/s. - pub wind_max_ms: f64, - /// Gaussian noise standard deviation added to CSI amplitude. - pub csi_noise_std: f64, - /// Fractional thrust coefficient variation: ±motor_thrust_variation. - pub motor_thrust_variation: f64, - /// Mean packet loss percentage [0–100]. - pub packet_loss_pct: f64, - /// Maximum additional MAVLink latency injected, ms. - pub extra_latency_max_ms: u64, -} - -impl Default for DomainRandomizationConfig { - fn default() -> Self { - Self { - wind_max_ms: 6.0, - csi_noise_std: 0.05, - motor_thrust_variation: 0.10, - packet_loss_pct: 15.0, - extra_latency_max_ms: 100, - } - } -} - -impl TrainingConfig { - /// Quick 10-episode demo run — suitable for CI smoke tests. - pub fn quick_demo() -> Self { - Self { - mode: TrainingMode::Demo, - num_drones: 4, - num_episodes: 10, - max_steps_per_episode: 200, - ..Default::default() - } - } - - /// Full training preset with aggressive domain randomisation. - pub fn full_training() -> Self { - Self { - num_episodes: 5000, - max_steps_per_episode: 5000, - domain_rand: DomainRandomizationConfig { - wind_max_ms: 12.0, - csi_noise_std: 0.1, - motor_thrust_variation: 0.15, - packet_loss_pct: 30.0, - extra_latency_max_ms: 200, - }, - ..Default::default() - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn quick_demo_has_fewer_episodes() { - let quick = TrainingConfig::quick_demo(); - let full = TrainingConfig::full_training(); - assert!(quick.num_episodes < full.num_episodes); - assert_eq!(quick.mode, TrainingMode::Demo); - } - - #[test] - fn full_training_has_larger_domain_rand() { - let full = TrainingConfig::full_training(); - let def = DomainRandomizationConfig::default(); - assert!(full.domain_rand.wind_max_ms > def.wind_max_ms); - assert!(full.domain_rand.packet_loss_pct > def.packet_loss_pct); - } -} diff --git a/v2/crates/ruview-swarm/src/marl/training_loop.rs b/v2/crates/ruview-swarm/src/marl/training_loop.rs deleted file mode 100644 index 98692275..00000000 --- a/v2/crates/ruview-swarm/src/marl/training_loop.rs +++ /dev/null @@ -1,277 +0,0 @@ -//! Minimal MAPPO training loop — PPO policy gradient update on CPU. -//! -//! Production training uses Gazebo/PX4 SITL or the Demo environment. -//! This module provides the update step itself, independent of the environment. - -use super::{ - actor::{ActorAction, MappoActor}, - observation::LocalObservation, -}; - -/// A single (observation, action, reward, next_observation, done) transition. -#[derive(Debug, Clone)] -pub struct Transition { - pub obs: LocalObservation, - pub action: ActorAction, - pub reward: f32, - pub next_obs: LocalObservation, - pub done: bool, -} - -/// Replay buffer for PPO — stores a fixed number of transitions per update. -pub struct ReplayBuffer { - pub transitions: Vec, - pub capacity: usize, -} - -impl ReplayBuffer { - pub fn new(capacity: usize) -> Self { - Self { transitions: Vec::with_capacity(capacity), capacity } - } - - pub fn push(&mut self, t: Transition) { - if self.transitions.len() >= self.capacity { - self.transitions.remove(0); - } - self.transitions.push(t); - } - - pub fn is_full(&self) -> bool { - self.transitions.len() >= self.capacity - } - - pub fn len(&self) -> usize { self.transitions.len() } - pub fn is_empty(&self) -> bool { self.transitions.is_empty() } - - /// Compute discounted returns for all transitions (GAE-λ simplified to MC return). - pub fn compute_returns(&self, gamma: f32) -> Vec { - let n = self.transitions.len(); - let mut returns = vec![0.0f32; n]; - let mut running = 0.0f32; - for i in (0..n).rev() { - running = self.transitions[i].reward - + gamma * running * (!self.transitions[i].done as i32 as f32); - returns[i] = running; - } - returns - } -} - -/// PPO hyperparameters. -#[derive(Debug, Clone)] -pub struct PpoConfig { - pub lr: f32, - pub clip_epsilon: f32, - pub gamma: f32, - pub gae_lambda: f32, - pub entropy_coeff: f32, - pub epochs: usize, -} - -impl Default for PpoConfig { - fn default() -> Self { - Self { - lr: 3e-4, - clip_epsilon: 0.2, - gamma: 0.99, - gae_lambda: 0.95, - entropy_coeff: 0.01, - epochs: 10, - } - } -} - -/// Statistics from one PPO update step. -#[derive(Debug, Clone, Default)] -pub struct UpdateStats { - pub mean_return: f32, - pub policy_loss: f32, - pub entropy: f32, - pub updates: usize, -} - -/// Compute mean return from a buffer. -pub fn compute_mean_return(buffer: &ReplayBuffer, gamma: f32) -> f32 { - let returns = buffer.compute_returns(gamma); - if returns.is_empty() { return 0.0; } - returns.iter().sum::() / returns.len() as f32 -} - -/// Simplified PPO policy gradient update. -/// -/// In production this would use autodiff; here we use a finite-difference -/// approximation for the pure-Rust MLP actor (no autograd required for demo). -/// The production path should use Candle or burn for full gradient computation. -/// -/// Returns update statistics. -pub fn ppo_update( - actor: &mut MappoActor, - buffer: &ReplayBuffer, - config: &PpoConfig, -) -> UpdateStats { - if buffer.is_empty() { - return UpdateStats::default(); - } - - let returns = buffer.compute_returns(config.gamma); - let mean_return = returns.iter().sum::() / returns.len() as f32; - - // Normalise returns - let std_return = { - let var = returns.iter() - .map(|r| (r - mean_return).powi(2)) - .sum::() / returns.len() as f32; - var.sqrt().max(1e-8) - }; - let advantages: Vec = returns.iter() - .map(|r| (r - mean_return) / std_return) - .collect(); - - // Finite-difference pseudo-gradient update on output layer bias - // (production code would use autograd; this is a demo approximation) - let fd_eps = config.lr * 0.01; - let mut total_loss = 0.0f32; - - for (transition, advantage) in buffer.transitions.iter().zip(advantages.iter()) { - let predicted = actor.forward(&transition.obs); - - // Log-prob proxy: use tanh(delta_heading) as action probability proxy - let log_prob = (predicted.delta_heading_rad + 1e-8).abs().ln(); - let loss = -log_prob * advantage; - total_loss += loss; - - // Nudge: update a single scalar in the direction of advantage - // (This is a placeholder — real PPO needs full backprop) - let _ = fd_eps * advantage; // consume value; real update would modify weights - } - - let policy_loss = total_loss / buffer.len() as f32; - // Entropy: uniform action distribution maximises entropy; proxy here - let entropy = config.entropy_coeff * 0.5; - - UpdateStats { - mean_return, - policy_loss, - entropy, - updates: config.epochs, - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::marl::{actor::ActorConfig, observation::LocalObservation}; - - fn make_transition(reward: f32) -> Transition { - Transition { - obs: LocalObservation::zeros(), - action: ActorAction { - delta_heading_rad: 0.1, - delta_altitude_m: 0.0, - speed_ms: 4.0, - trigger_csi_scan: false, - }, - reward, - next_obs: LocalObservation::zeros(), - done: false, - } - } - - #[test] - fn test_buffer_capacity() { - let mut buf = ReplayBuffer::new(5); - for i in 0..8 { - buf.push(make_transition(i as f32)); - } - assert_eq!(buf.len(), 5, "buffer should cap at capacity"); - } - - #[test] - fn test_returns_monotone_positive() { - let mut buf = ReplayBuffer::new(4); - for _ in 0..4 { buf.push(make_transition(1.0)); } - let returns = buf.compute_returns(0.99); - // Each return should be >= 1.0 (positive reward accumulates) - for r in &returns { - assert!(*r >= 1.0, "all returns should be >= 1.0 with positive rewards"); - } - // Returns should be non-decreasing from right to left - for i in 0..returns.len() - 1 { - assert!(returns[i] >= returns[i + 1], - "earlier returns should be higher (more future reward)"); - } - } - - #[test] - fn test_ppo_update_produces_stats() { - let mut actor = MappoActor::random_init(ActorConfig::default()); - let mut buf = ReplayBuffer::new(20); - for i in 0..20 { - buf.push(make_transition(if i % 2 == 0 { 10.0 } else { -2.0 })); - } - let stats = ppo_update(&mut actor, &buf, &PpoConfig::default()); - assert_ne!(stats.mean_return, 0.0, "mean return should be computed"); - assert_eq!(stats.updates, PpoConfig::default().epochs); - } - - #[test] - fn test_empty_buffer_no_crash() { - let mut actor = MappoActor::random_init(ActorConfig::default()); - let buf = ReplayBuffer::new(20); - let stats = ppo_update(&mut actor, &buf, &PpoConfig::default()); - assert_eq!(stats.mean_return, 0.0); - assert_eq!(stats.updates, 0); - } - - #[test] - fn test_marl_convergence_improves_mean_return() { - use rand::Rng; - - let mut actor = MappoActor::random_init(ActorConfig::default()); - let ppo_cfg = PpoConfig { lr: 1e-3, ..PpoConfig::default() }; - let mut rng = rand::thread_rng(); - - // Collect transitions with varying rewards (simulate improvement trajectory) - let mut buf = ReplayBuffer::new(64); - for step in 0..64 { - // Simulate improving rewards: early steps low reward, later steps higher - let reward = if step < 32 { - rng.gen_range(-5.0f32..-1.0) - } else { - rng.gen_range(1.0..15.0) - }; - buf.push(Transition { - obs: LocalObservation::zeros(), - action: ActorAction { - delta_heading_rad: 0.1, - delta_altitude_m: 0.0, - speed_ms: 5.0, - trigger_csi_scan: true, - }, - reward, - next_obs: LocalObservation::zeros(), - done: step == 63, - }); - } - - // Run PPO update - let stats = ppo_update(&mut actor, &buf, &ppo_cfg); - - // The mean return should reflect the mixed-reward trajectory - assert!(stats.updates > 0, "PPO should have run updates"); - assert!( - stats.mean_return.is_finite(), - "mean return should be finite: {}", - stats.mean_return - ); - // With 32 negative + 32 positive rewards, mean should be non-zero - assert!( - stats.mean_return != 0.0, - "mean return should be non-zero with varied rewards" - ); - - // Run multiple update cycles and verify stats are stable - let stats2 = ppo_update(&mut actor, &buf, &ppo_cfg); - assert!(stats2.mean_return.is_finite()); - } -} diff --git a/v2/crates/ruview-swarm/src/orchestrator/mod.rs b/v2/crates/ruview-swarm/src/orchestrator/mod.rs deleted file mode 100644 index c06d3332..00000000 --- a/v2/crates/ruview-swarm/src/orchestrator/mod.rs +++ /dev/null @@ -1,415 +0,0 @@ -//! SwarmOrchestrator — wires together all swarm subsystems for a complete swarm node. -//! -//! Each physical drone runs one SwarmOrchestrator instance. In demo/sim mode it -//! runs N orchestrators in one process to simulate a full swarm. - -use crate::{ - config::SwarmConfig, - failsafe::{FailSafeMachine, FailSafeState}, - sensing::{ - multiview::MultiViewFusion, - payload::{CsiPayloadPipeline, PayloadConfig}, - }, - planning::{ - coverage::CoverageStrategy, - probability_grid::ProbabilityGrid, - }, - types::{CsiDetection, DroneState, NodeId, Position3D, Velocity3D}, -}; -use std::collections::HashMap; - -/// The complete per-drone swarm coordinator. -/// -/// In production: backed by live CSI payload and PX4 flight controller. -/// In demo/sim: backed by synthetic CSI and simulated state. -pub struct SwarmOrchestrator { - pub node_id: NodeId, - pub config: SwarmConfig, - pub state: DroneState, - pub failsafe: FailSafeMachine, - pub coverage: CoverageStrategy, - pub probability_grid: ProbabilityGrid, - pub csi_pipeline: CsiPayloadPipeline, - pub fusion: MultiViewFusion, - /// Latest known positions of swarm peers. - pub peer_states: HashMap, - /// Detections received from peers (last cycle). - pub peer_detections: Vec, - /// Accumulated mission statistics. - pub stats: MissionStats, - /// Optional Ruflo backend for AgentDB, AIDefence, and SONA intelligence. - /// When None (default), all Ruflo calls are no-ops — existing behaviour preserved. - #[cfg(feature = "ruflo")] - pub ruflo: Option>, - /// Active trajectory ID issued by the Ruflo intelligence hooks. - #[cfg(feature = "ruflo")] - pub trajectory_id: Option, -} - -/// Accumulated metrics for one mission run. -#[derive(Debug, Clone, Default)] -pub struct MissionStats { - pub cells_covered: u32, - pub victims_confirmed: u32, - pub collision_events: u32, - pub steps: u64, - pub elapsed_secs: f64, -} - -impl SwarmOrchestrator { - /// Create a new orchestrator in demo mode (synthetic CSI). - pub fn new_demo( - node_id: NodeId, - config: SwarmConfig, - start_position: Position3D, - victims: Vec, - ) -> Self { - let grid_w = (config.mission.area_width_m / config.mission.grid_resolution_m).ceil() as u32; - let grid_h = (config.mission.area_height_m / config.mission.grid_resolution_m).ceil() as u32; - let probability_grid = - ProbabilityGrid::new(grid_w, grid_h, config.mission.grid_resolution_m); - - let noise_std = config.demo.as_ref().map(|d| d.csi_noise_std).unwrap_or(0.05); - let detection_range = config.planning.csi_scan_width_m; - let convergence_threshold = config.planning.convergence_threshold; - - let csi_pipeline = CsiPayloadPipeline::new_synthetic( - node_id, - PayloadConfig { - scan_freq_hz: 10.0, - detection_range_m: detection_range, - confidence_threshold: 0.5, - esp32_baud_rate: 921_600, - }, - victims, - noise_std, - node_id.0 as u64, - ); - - let state = DroneState { - id: node_id, - position: start_position, - velocity: Velocity3D::default(), - heading_rad: 0.0, - altitude_agl_m: config.planning.flight_altitude_m, - battery_pct: 100.0, - link_quality: 1.0, - timestamp_ms: 0, - }; - - Self { - node_id, - config: config.clone(), - state, - failsafe: FailSafeMachine::new(), - coverage: CoverageStrategy::new(convergence_threshold), - probability_grid, - csi_pipeline, - fusion: MultiViewFusion::default(), - peer_states: HashMap::new(), - peer_detections: Vec::new(), - stats: MissionStats::default(), - #[cfg(feature = "ruflo")] - ruflo: None, - #[cfg(feature = "ruflo")] - trajectory_id: None, - } - } - - /// Process one simulation step (dt_secs: time elapsed since last step). - /// Returns the current fail-safe state after evaluation. - pub async fn step(&mut self, dt_secs: f64, link_alive: bool) -> FailSafeState { - self.stats.steps += 1; - self.stats.elapsed_secs += dt_secs; - - // 1. Drain stale peer detections from previous cycle. - self.peer_detections.clear(); - - // 2. Evaluate fail-safe state machine. - let nearest_dist = self.nearest_peer_distance(); - let fs_state = self.failsafe.tick(&self.state, link_alive, nearest_dist); - - if fs_state != FailSafeState::Nominal && fs_state != FailSafeState::LowBatteryWarn { - return fs_state; // safety takes over; skip mission logic - } - - // 3. CSI scan at current position. - let current_pos = self.state.position; - if let Some(detection) = self.csi_pipeline.scan(¤t_pos).await { - if detection.confidence >= self.csi_pipeline.config.confidence_threshold { - if let Some(victim_pos) = detection.victim_position { - let cell = self.pos_to_cell(&victim_pos); - self.probability_grid.update_bayesian(cell, detection.confidence, true); - } - } - } - - // 4. Mark current cell as scanned. - let cur_cell = self.pos_to_cell(¤t_pos); - let was_new = self.probability_grid.mark_scanned(cur_cell); - if was_new { - self.stats.cells_covered += 1; - } - - // 5. Update coverage phase based on grid state. - self.coverage.phase_transition(&self.probability_grid); - - // 6. Move toward next waypoint (proportional navigation for simulation). - if let Some(target) = self.coverage.next_target(&self.state, &self.probability_grid) { - self.move_toward(target, dt_secs); - } - - // 7. Simple battery drain: 1% per 30 s at full speed. - self.state.battery_pct -= (dt_secs / 30.0) as f32; - self.state.battery_pct = self.state.battery_pct.max(0.0); - self.state.timestamp_ms += (dt_secs * 1_000.0) as u64; - - fs_state - } - - /// Multi-drone CSI fusion at the cluster-head level. - /// Returns a fused detection if enough viewpoints agree. - pub fn fuse_detections( - &self, - all_detections: &[CsiDetection], - all_positions: &[(NodeId, Position3D)], - ) -> Option { - self.fusion.fuse(all_detections, all_positions) - } - - /// Accept an incoming peer state update (called by the swarm comm layer). - pub fn receive_peer_state(&mut self, peer: DroneState) { - self.peer_states.insert(peer.id, peer); - } - - /// Accept an incoming CSI detection from a peer. - pub fn receive_peer_detection(&mut self, det: CsiDetection) { - self.peer_detections.push(det); - } - - /// Attach a Ruflo backend for AgentDB pattern learning, AIDefence, and SONA. - /// - /// Call after `new_demo()`: - /// ```ignore - /// let orch = SwarmOrchestrator::new_demo(...) - /// .with_ruflo(Box::new(MockRufloBackend::new())); - /// ``` - #[cfg(feature = "ruflo")] - pub fn with_ruflo(mut self, backend: Box) -> Self { - self.ruflo = Some(backend); - self - } - - /// Start a Ruflo intelligence trajectory for this mission node. - /// - /// Call before the mission loop begins. If no backend is attached this is a no-op. - #[cfg(feature = "ruflo")] - pub async fn start_trajectory(&mut self, mission_desc: &str) { - if let Some(ruflo) = &self.ruflo { - match ruflo.trajectory_start(mission_desc, "swarm-specialist").await { - Ok(tid) => self.trajectory_id = Some(tid), - Err(e) => tracing::warn!("trajectory_start failed: {}", e), - } - } - } - - /// End the Ruflo trajectory and persist the mission summary in AgentDB. - /// - /// Stores both a searchable memory entry and a pattern-learned description. - /// If no backend is attached this is a no-op. - #[cfg(feature = "ruflo")] - pub async fn finish_trajectory(&mut self, success: bool, mission_key: &str) { - if let Some(ruflo) = &self.ruflo { - let tid = self.trajectory_id.take(); - if let Some(tid) = &tid { - let _ = ruflo.trajectory_end(tid, success, None).await; - } - // Build and serialise mission summary. - let summary = crate::ruflo::MissionSummary::from_stats( - &self.stats, - &self.config.mission.profile, - 1, // single drone; caller sets correct count via separate API if needed - self.config.mission.area_width_m, - self.config.mission.area_height_m, - 0, // caller sets victims_total; 0 = unknown - self.probability_grid.coverage_pct(), - ); - if let Ok(json) = serde_json::to_string(&summary) { - let _ = ruflo.store_mission(mission_key, &json, "swarm-missions").await; - } - let _ = ruflo.store_pattern( - &summary.to_pattern_description(), - summary.pattern_type(), - summary.pattern_confidence(), - ).await; - } - } - - /// AIDefence-checked variant of `receive_peer_detection`. - /// - /// Returns `true` and enqueues the detection if it passes the safety check. - /// Returns `false` (and drops the detection) if AIDefence flags it as unsafe. - /// Falls back to `true` (accept) if the Ruflo backend is not attached or the - /// check itself errors (fail-open to avoid blocking legitimate traffic). - #[cfg(feature = "ruflo")] - pub async fn receive_peer_detection_checked(&mut self, det: CsiDetection) -> bool { - if let Some(ruflo) = &self.ruflo { - // Serialise the detection to a string for AIDefence inspection. - let repr = format!( - "drone_id={:?} confidence={:.3} victim={:?}", - det.drone_id, det.confidence, det.victim_position - ); - match ruflo.mavlink_is_safe(&repr).await { - Ok(false) => { - tracing::warn!( - "aidefence rejected peer detection from {:?}", - det.drone_id - ); - return false; - } - Err(e) => tracing::debug!("aidefence check failed (proceeding): {}", e), - _ => {} - } - } - self.receive_peer_detection(det); - true - } - - /// Returns true when the mission is considered complete. - pub fn is_mission_complete(&self) -> bool { - self.probability_grid.coverage_pct() > 0.95 - } - - // ──────────────────────── private helpers ──────────────────────── - - /// Distance to the nearest peer drone (f64::MAX if no peers). - fn nearest_peer_distance(&self) -> f64 { - self.peer_states - .values() - .map(|p| self.state.position.distance_to(&p.position)) - .fold(f64::MAX, f64::min) - } - - /// Convert a world position to grid cell indices, clamped to grid bounds. - fn pos_to_cell(&self, pos: &Position3D) -> (u32, u32) { - let r = self.config.mission.grid_resolution_m; - let w = (self.config.mission.area_width_m / r) as u32; - let h = (self.config.mission.area_height_m / r) as u32; - let xi = (pos.x / r).max(0.0) as u32; - let yi = (pos.y / r).max(0.0) as u32; - (xi.min(w.saturating_sub(1)), yi.min(h.saturating_sub(1))) - } - - /// Simple proportional navigation: steer toward target at max planning speed. - fn move_toward(&mut self, target: Position3D, dt_secs: f64) { - let dx = target.x - self.state.position.x; - let dy = target.y - self.state.position.y; - let dist = (dx * dx + dy * dy).sqrt(); - - if dist < 0.5 { - self.state.velocity = Velocity3D::default(); - return; - } - - let speed = self.config.planning.max_speed_ms.min(dist / dt_secs); - let vx = (dx / dist) * speed; - let vy = (dy / dist) * speed; - - self.state.position.x += vx * dt_secs; - self.state.position.y += vy * dt_secs; - self.state.velocity = Velocity3D { vx, vy, vz: 0.0 }; - self.state.heading_rad = vy.atan2(vx); - } -} - -#[cfg(test)] -mod tests { - use super::*; - - fn demo_orchestrator(node_id: u32, victims: Vec) -> SwarmOrchestrator { - let cfg = SwarmConfig::demo_default(); - SwarmOrchestrator::new_demo( - NodeId(node_id), - cfg, - Position3D { x: 10.0 * node_id as f64, y: 0.0, z: -30.0 }, - victims, - ) - } - - #[tokio::test] - async fn test_single_orchestrator_step() { - let mut orch = - demo_orchestrator(0, vec![Position3D { x: 50.0, y: 50.0, z: 0.0 }]); - let state = orch.step(0.1, true).await; - assert_eq!(state, FailSafeState::Nominal); - assert_eq!(orch.stats.steps, 1); - } - - #[tokio::test] - async fn test_failsafe_triggers_on_link_loss() { - let mut orch = demo_orchestrator(0, vec![]); - // Lower the hold threshold so it trips well within a sub-second test run. - orch.failsafe.link_loss_hold_secs = 0.001; - orch.failsafe.link_loss_rth_secs = 0.1; - - // One tick to start the link-loss timer, then sleep briefly so the - // real-time elapsed exceeds the tiny hold threshold. - orch.step(0.1, false).await; - std::thread::sleep(std::time::Duration::from_millis(5)); - - let state = orch.step(0.1, false).await; - assert_ne!(state, FailSafeState::Nominal, "link loss should trigger failsafe"); - } - - #[tokio::test] - async fn test_multi_drone_coverage() { - let victims = vec![Position3D { x: 50.0, y: 50.0, z: 0.0 }]; - let mut drones: Vec = - (0..4).map(|i| demo_orchestrator(i, victims.clone())).collect(); - - // 50 steps × 0.1 s dt = 5 simulated seconds - for _ in 0..50 { - for drone in &mut drones { - drone.step(0.1, true).await; - } - } - - let total_cells: u32 = drones.iter().map(|d| d.stats.cells_covered).sum(); - assert!(total_cells > 0, "drones should have covered some cells"); - - let elapsed = drones[0].stats.elapsed_secs; - assert!((elapsed - 5.0).abs() < 0.01, "elapsed should be ~5 s, got {elapsed}"); - } - - #[tokio::test] - async fn test_peer_state_exchange() { - let mut orch0 = demo_orchestrator(0, vec![]); - let mut orch1 = demo_orchestrator(1, vec![]); - - orch0.step(0.1, true).await; - orch1.step(0.1, true).await; - - // Exchange states - orch0.receive_peer_state(orch1.state.clone()); - orch1.receive_peer_state(orch0.state.clone()); - - assert!( - orch0.peer_states.contains_key(&NodeId(1)), - "orch0 should know about orch1" - ); - } - - #[tokio::test] - async fn test_mission_complete_after_full_coverage() { - let mut orch = demo_orchestrator(0, vec![]); - // Manually mark every cell scanned. - let w = orch.probability_grid.width; - let h = orch.probability_grid.height; - for y in 0..h { - for x in 0..w { - orch.probability_grid.mark_scanned((x, y)); - } - } - assert!(orch.is_mission_complete(), "should be complete at 100% coverage"); - } -} diff --git a/v2/crates/ruview-swarm/src/planning/coverage.rs b/v2/crates/ruview-swarm/src/planning/coverage.rs deleted file mode 100644 index f068ef14..00000000 --- a/v2/crates/ruview-swarm/src/planning/coverage.rs +++ /dev/null @@ -1,119 +0,0 @@ -//! Coverage strategy: systematic sweep → probabilistic pursuit → convergence. - -use crate::types::{DroneState, NodeId, Position3D}; -use super::probability_grid::ProbabilityGrid; -use std::collections::HashMap; - -/// Phase of the coverage mission. -#[derive(Debug, Clone)] -pub enum Phase { - /// Systematic boustrophedon sweep of the mission area. - Systematic, - /// Probabilistic pursuit: drones head toward high-P cells. - ProbabilisticPursuit, - /// Convergence on confirmed detections by the listed drones. - Convergence(Vec), -} - -/// Coverage strategy tracking phase and cell assignments. -pub struct CoverageStrategy { - pub phase: Phase, - /// Assigned cell per drone. - pub assignments: HashMap, - pub convergence_threshold: f32, -} - -impl CoverageStrategy { - pub fn new(convergence_threshold: f32) -> Self { - Self { - phase: Phase::Systematic, - assignments: HashMap::new(), - convergence_threshold, - } - } - - /// Compute the next waypoint for a drone given the current grid. - pub fn next_waypoint( - &self, - node_id: NodeId, - state: &DroneState, - grid: &ProbabilityGrid, - flight_altitude_m: f64, - ) -> Position3D { - if let Phase::Convergence(_) = &self.phase { - if let Some(&(cx, cy)) = self.assignments.get(&node_id) { - return Position3D { - x: cx as f64 * grid.cell_size_m, - y: cy as f64 * grid.cell_size_m, - z: -flight_altitude_m, - }; - } - } - - // Default: head toward the highest-priority unscanned cell. - if let Some((cx, cy)) = grid.highest_priority_unscanned() { - Position3D { - x: cx as f64 * grid.cell_size_m, - y: cy as f64 * grid.cell_size_m, - z: -flight_altitude_m, - } - } else { - state.position - } - } - - /// Return the next navigation target position for an orchestrator step. - /// - /// - Systematic phase: next unscanned boustrophedon cell. - /// - ProbabilisticPursuit: highest-priority unscanned cell. - /// - Convergence: highest-priority unscanned cell (refine around detections). - pub fn next_target(&self, state: &DroneState, grid: &ProbabilityGrid) -> Option { - let r = grid.cell_size_m; - match &self.phase { - Phase::Systematic => { - grid.next_systematic_cell(state).map(|(cx, cy)| Position3D { - x: cx as f64 * r + r / 2.0, - y: cy as f64 * r + r / 2.0, - z: state.position.z, - }) - } - Phase::ProbabilisticPursuit | Phase::Convergence(_) => { - grid.highest_priority_unscanned().map(|(cx, cy)| Position3D { - x: cx as f64 * r + r / 2.0, - y: cy as f64 * r + r / 2.0, - z: state.position.z, - }) - } - } - } - - /// Transition to next phase based on grid state, guarded by a threshold. - pub fn phase_transition_with_threshold( - &mut self, - grid: &ProbabilityGrid, - _threshold: f32, - ) { - self.phase_transition(grid); - } - - /// Transition to next phase based on grid state. - pub fn phase_transition(&mut self, grid: &ProbabilityGrid) { - let max_p = grid - .cells - .iter() - .flat_map(|row| row.iter()) - .map(|c| c.victim_probability) - .fold(0.0_f32, f32::max); - - self.phase = match &self.phase { - Phase::Systematic if max_p >= self.convergence_threshold => { - Phase::ProbabilisticPursuit - } - Phase::ProbabilisticPursuit if max_p >= 0.9 => { - Phase::Convergence(vec![]) - } - other => other.clone(), - }; - } -} - diff --git a/v2/crates/ruview-swarm/src/planning/mod.rs b/v2/crates/ruview-swarm/src/planning/mod.rs deleted file mode 100644 index 5ff2a322..00000000 --- a/v2/crates/ruview-swarm/src/planning/mod.rs +++ /dev/null @@ -1,12 +0,0 @@ -//! Mission planning: coverage, probability grid, RRT-APF path planning. - -pub mod rrt_apf; -pub mod coverage; -pub mod probability_grid; -pub mod pheromone; -pub mod patterns; - -pub use rrt_apf::{RrtApfPlanner, Waypoint}; -pub use coverage::{CoverageStrategy, Phase}; -pub use probability_grid::ProbabilityGrid; -pub use patterns::{FlightPattern, PatternContext}; diff --git a/v2/crates/ruview-swarm/src/planning/patterns.rs b/v2/crates/ruview-swarm/src/planning/patterns.rs deleted file mode 100644 index 26e774e6..00000000 --- a/v2/crates/ruview-swarm/src/planning/patterns.rs +++ /dev/null @@ -1,428 +0,0 @@ -//! Flight / coverage-optimization patterns for swarm area search. -//! -//! Different strategies trade off coverage completeness, time, and robustness: -//! - Boustrophedon: systematic lawnmower; complete but drones overlap if unpartitioned -//! - PartitionedLawnmower: area split into per-drone strips → no overlap, ~Nx faster coverage -//! - Spiral: outward spiral from a seed; good for centred search (last-known-position SAR) -//! - Pheromone: stigmergic — steer away from recently-visited cells; robust to dropout -//! - PotentialField: repelled by visited cells + peers, attracted to unscanned frontier -//! - LevyFlight: heavy-tailed random walk; good exploration when target location unknown - -use crate::types::{NodeId, Position3D}; - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] -pub enum FlightPattern { - Boustrophedon, - #[default] - PartitionedLawnmower, - Spiral, - Pheromone, - PotentialField, - LevyFlight, -} - -impl FlightPattern { - // Intentional inherent infallible parser (returns Self, not Result); shipped API. - #[allow(clippy::should_implement_trait)] - pub fn from_str(s: &str) -> Self { - match s.to_lowercase().as_str() { - "boustrophedon" | "lawnmower" => FlightPattern::Boustrophedon, - "partitioned" | "partitioned_lawnmower" => FlightPattern::PartitionedLawnmower, - "spiral" => FlightPattern::Spiral, - "pheromone" | "stigmergic" => FlightPattern::Pheromone, - "potential" | "potential_field" => FlightPattern::PotentialField, - "levy" | "levyflight" | "levy_flight" => FlightPattern::LevyFlight, - _ => FlightPattern::default(), - } - } - - pub fn name(&self) -> &'static str { - match self { - FlightPattern::Boustrophedon => "boustrophedon", - FlightPattern::PartitionedLawnmower => "partitioned_lawnmower", - FlightPattern::Spiral => "spiral", - FlightPattern::Pheromone => "pheromone", - FlightPattern::PotentialField => "potential_field", - FlightPattern::LevyFlight => "levy_flight", - } - } - - /// All pattern variants, for enumeration / UI selection. - pub fn all() -> [FlightPattern; 6] { - [ - FlightPattern::Boustrophedon, - FlightPattern::PartitionedLawnmower, - FlightPattern::Spiral, - FlightPattern::Pheromone, - FlightPattern::PotentialField, - FlightPattern::LevyFlight, - ] - } -} - -/// Inputs for computing the next waypoint under a pattern. -pub struct PatternContext<'a> { - pub drone_id: NodeId, - pub swarm_size: usize, - pub current: Position3D, - pub area_w: f64, - pub area_h: f64, - pub altitude_z: f64, // flight z (negative NED) - pub scan_width_m: f64, // strip spacing - pub step: u64, // tick counter (for deterministic pseudo-random patterns) - pub visited: &'a [Position3D], // recently visited cell centres (for pheromone/potential) - pub peers: &'a [Position3D], // peer positions (for potential-field repulsion) -} - -impl FlightPattern { - /// Compute the next target position for a drone under this pattern. - pub fn next_target(&self, ctx: &PatternContext) -> Position3D { - match self { - FlightPattern::Boustrophedon => boustrophedon(ctx), - FlightPattern::PartitionedLawnmower => partitioned_lawnmower(ctx), - FlightPattern::Spiral => spiral(ctx), - FlightPattern::Pheromone => pheromone(ctx), - FlightPattern::PotentialField => potential_field(ctx), - FlightPattern::LevyFlight => levy_flight(ctx), - } - } -} - -/// Clamp a candidate (x, y) to the area bounds and lift it to the flight altitude. -fn clamp_to_area(x: f64, y: f64, ctx: &PatternContext) -> Position3D { - Position3D { - x: x.clamp(0.0, ctx.area_w), - y: y.clamp(0.0, ctx.area_h), - z: ctx.altitude_z, - } -} - -/// Serpentine waypoint within a rectangular sub-region. -/// -/// Walks rows of height `scan_width_m`; on each row sweeps left→right or -/// right→left depending on the row parity, advancing one `scan_width_m` -/// segment per `step`. -fn serpentine_in_region( - x0: f64, - x1: f64, - y0: f64, - y1: f64, - scan_width_m: f64, - step: u64, -) -> (f64, f64) { - let strip_w = (x1 - x0).max(scan_width_m); - let height = (y1 - y0).max(scan_width_m); - - // Number of horizontal segments per row before stepping to the next row. - let cols = ((strip_w / scan_width_m).ceil() as u64).max(1); - // Number of rows in this region. - let rows = ((height / scan_width_m).ceil() as u64).max(1); - let total = cols * rows; - let s = step % total; - - let row = s / cols; - let col = s % cols; - - // Centre of the current row band. - let y = y0 + (row as f64 + 0.5) * scan_width_m; - let y = y.min(y1); - - // Serpentine: even rows L→R, odd rows R→L. - let along = if row.is_multiple_of(2) { col } else { cols - 1 - col }; - let x = x0 + (along as f64 + 0.5) * scan_width_m; - let x = x.min(x1); - - (x, y) -} - -/// Classic full-area serpentine lawnmower (drones may overlap — baseline). -fn boustrophedon(ctx: &PatternContext) -> Position3D { - let (x, y) = serpentine_in_region( - 0.0, - ctx.area_w, - 0.0, - ctx.area_h, - ctx.scan_width_m, - ctx.step, - ); - clamp_to_area(x, y, ctx) -} - -/// Partitioned lawnmower: split `area_w` into `swarm_size` vertical strips; -/// drone `i` lawnmowers ONLY within strip `[i*w/n, (i+1)*w/n]`. -/// -/// This is the clustering fix: each drone covers a disjoint band, so total -/// coverage scales ~linearly with swarm size instead of all drones tracing -/// the same path. -fn partitioned_lawnmower(ctx: &PatternContext) -> Position3D { - let n = ctx.swarm_size.max(1); - let i = (ctx.drone_id.0 as usize) % n; - let strip_w = ctx.area_w / n as f64; - let x0 = i as f64 * strip_w; - let x1 = x0 + strip_w; - - let (x, y) = - serpentine_in_region(x0, x1, 0.0, ctx.area_h, ctx.scan_width_m, ctx.step); - clamp_to_area(x, y, ctx) -} - -/// Outward Archimedean spiral from the area centre; radius grows with step. -fn spiral(ctx: &PatternContext) -> Position3D { - let cx = ctx.area_w / 2.0; - let cy = ctx.area_h / 2.0; - - // Angular step keeps successive waypoints roughly `scan_width_m` apart. - let theta = ctx.step as f64 * 0.6; - // Archimedean spiral r = b * theta; b chosen so each turn adds scan_width_m. - let b = ctx.scan_width_m / (2.0 * std::f64::consts::PI); - let r = b * theta; - - let x = cx + r * theta.cos(); - let y = cy + r * theta.sin(); - clamp_to_area(x, y, ctx) -} - -/// Stigmergic: sample candidate headings, step toward the least-visited one. -fn pheromone(ctx: &PatternContext) -> Position3D { - let step_len = ctx.scan_width_m.max(1.0); - // Deterministic base heading offset per drone so they diverge. - let base = ctx.drone_id.0 as f64 * (std::f64::consts::PI / 3.0); - - let n_candidates = 8; - let mut best: Option<(f64, f64, f64)> = None; // (score, x, y); lower score = less visited - for k in 0..n_candidates { - let theta = base + (k as f64) * (2.0 * std::f64::consts::PI / n_candidates as f64); - let cx = ctx.current.x + step_len * theta.cos(); - let cy = ctx.current.y + step_len * theta.sin(); - let cx = cx.clamp(0.0, ctx.area_w); - let cy = cy.clamp(0.0, ctx.area_h); - - // Penalty = sum of inverse-distance to recently-visited cell centres. - let mut visit_pressure = 0.0; - for v in ctx.visited { - let d = (cx - v.x).hypot(cy - v.y); - visit_pressure += 1.0 / (1.0 + d); - } - if best.as_ref().is_none_or(|(bs, _, _)| visit_pressure < *bs) { - best = Some((visit_pressure, cx, cy)); - } - } - - let (_, x, y) = best.unwrap_or((0.0, ctx.current.x, ctx.current.y)); - clamp_to_area(x, y, ctx) -} - -/// Potential field: repelled by visited cells + peers, attracted to the -/// nearest unscanned frontier; step in the resultant direction. -fn potential_field(ctx: &PatternContext) -> Position3D { - let mut fx = 0.0; - let mut fy = 0.0; - - // Repulsion from recently-visited cells. - for v in ctx.visited { - let dx = ctx.current.x - v.x; - let dy = ctx.current.y - v.y; - let d2 = dx * dx + dy * dy + 1.0; - let mag = 1.0 / d2; - fx += dx / d2.sqrt() * mag; - fy += dy / d2.sqrt() * mag; - } - - // Repulsion from peers (collision / overlap avoidance). - for p in ctx.peers { - let dx = ctx.current.x - p.x; - let dy = ctx.current.y - p.y; - let d2 = dx * dx + dy * dy + 1.0; - let mag = 2.0 / d2; // peers repel more strongly than stale trail - fx += dx / d2.sqrt() * mag; - fy += dy / d2.sqrt() * mag; - } - - // Attraction toward the nearest unscanned frontier point. Sample a grid of - // candidate area points; pick the one with greatest distance to any visited - // cell (i.e. the least-explored region) and pull toward it. - let mut frontier: Option<(f64, f64, f64)> = None; // (openness, x, y) - let samples = 5; - for ix in 0..=samples { - for iy in 0..=samples { - let px = ctx.area_w * ix as f64 / samples as f64; - let py = ctx.area_h * iy as f64 / samples as f64; - let mut nearest = f64::INFINITY; - for v in ctx.visited { - let d = (px - v.x).hypot(py - v.y); - if d < nearest { - nearest = d; - } - } - if !nearest.is_finite() { - nearest = (px - ctx.current.x).hypot(py - ctx.current.y); - } - if frontier.as_ref().is_none_or(|(o, _, _)| nearest > *o) { - frontier = Some((nearest, px, py)); - } - } - } - if let Some((_, gx, gy)) = frontier { - let dx = gx - ctx.current.x; - let dy = gy - ctx.current.y; - let d = (dx * dx + dy * dy).sqrt().max(1e-6); - fx += dx / d * 1.5; // attraction gain - fy += dy / d * 1.5; - } - - let fmag = (fx * fx + fy * fy).sqrt(); - let step_len = ctx.scan_width_m.max(1.0); - let (x, y) = if fmag > 1e-9 { - ( - ctx.current.x + fx / fmag * step_len, - ctx.current.y + fy / fmag * step_len, - ) - } else { - (ctx.current.x, ctx.current.y) - }; - clamp_to_area(x, y, ctx) -} - -/// Deterministic pseudo-random heavy-tailed step (Lévy flight). Most steps are -/// short; occasional long jumps. Seeded from drone_id + step via an LCG so the -/// trajectory is reproducible. -fn levy_flight(ctx: &PatternContext) -> Position3D { - // Linear congruential generator (Numerical Recipes constants). - let seed = (ctx.drone_id.0 as u64) - .wrapping_mul(0x9E37_79B9_7F4A_7C15) - .wrapping_add(ctx.step.wrapping_mul(0x2545_F491_4F6C_DD1D)); - let r1 = lcg(seed); - let r2 = lcg(r1); - - let u_angle = (r1 >> 11) as f64 / (1u64 << 53) as f64; // [0,1) - let u_len = ((r2 >> 11) as f64 / (1u64 << 53) as f64).max(1e-6); // (0,1] - - let theta = u_angle * 2.0 * std::f64::consts::PI; - // Heavy-tailed step length: inverse power-law (Pareto-like), exponent ~1.5. - let step_len = ctx.scan_width_m.max(1.0) * u_len.powf(-1.0 / 1.5); - // Cap to the area diagonal so a single jump can't shoot arbitrarily far. - let max_jump = (ctx.area_w * ctx.area_w + ctx.area_h * ctx.area_h).sqrt(); - let step_len = step_len.min(max_jump); - - let x = ctx.current.x + step_len * theta.cos(); - let y = ctx.current.y + step_len * theta.sin(); - clamp_to_area(x, y, ctx) -} - -#[inline] -fn lcg(state: u64) -> u64 { - state - .wrapping_mul(6364136223846793005) - .wrapping_add(1442695040888963407) -} - -#[cfg(test)] -mod tests { - use super::*; - - fn ctx<'a>( - drone_id: u32, - swarm_size: usize, - step: u64, - current: Position3D, - visited: &'a [Position3D], - peers: &'a [Position3D], - ) -> PatternContext<'a> { - PatternContext { - drone_id: NodeId(drone_id), - swarm_size, - current, - area_w: 100.0, - area_h: 80.0, - altitude_z: -20.0, - scan_width_m: 5.0, - step, - visited, - peers, - } - } - - #[test] - fn test_partitioned_strips_disjoint() { - let empty: [Position3D; 0] = []; - // Two drones, swarm of 2: drone 0 owns left half, drone 1 the right half. - let mut d0_xs = Vec::new(); - let mut d1_xs = Vec::new(); - for s in 0..40u64 { - let c0 = ctx(0, 2, s, Position3D::zero(), &empty, &empty); - let c1 = ctx(1, 2, s, Position3D::zero(), &empty, &empty); - d0_xs.push(FlightPattern::PartitionedLawnmower.next_target(&c0).x); - d1_xs.push(FlightPattern::PartitionedLawnmower.next_target(&c1).x); - } - let mid = 100.0 / 2.0; - // Drone 0 stays strictly in the left half, drone 1 strictly in the right. - assert!(d0_xs.iter().all(|&x| x <= mid), "drone 0 left of midline"); - assert!(d1_xs.iter().all(|&x| x >= mid), "drone 1 right of midline"); - // And they never share an x position (disjoint strips → no overlap). - for &a in &d0_xs { - for &b in &d1_xs { - assert!(a < b || (a <= mid && b >= mid), "strips overlap: {a} vs {b}"); - } - } - } - - #[test] - fn test_all_patterns_in_bounds() { - let visited = [ - Position3D { x: 10.0, y: 10.0, z: -20.0 }, - Position3D { x: 50.0, y: 40.0, z: -20.0 }, - ]; - let peers = [Position3D { x: 30.0, y: 20.0, z: -20.0 }]; - for pat in FlightPattern::all() { - let mut current = Position3D { x: 25.0, y: 25.0, z: -20.0 }; - for s in 0..20u64 { - let c = ctx(1, 4, s, current, &visited, &peers); - let t = pat.next_target(&c); - assert!( - t.x >= 0.0 && t.x <= 100.0, - "{} x out of bounds at step {s}: {}", - pat.name(), - t.x - ); - assert!( - t.y >= 0.0 && t.y <= 80.0, - "{} y out of bounds at step {s}: {}", - pat.name(), - t.y - ); - assert_eq!(t.z, -20.0, "{} altitude wrong", pat.name()); - current = t; - } - } - } - - #[test] - fn test_pattern_from_str_roundtrip() { - for pat in FlightPattern::all() { - assert_eq!( - FlightPattern::from_str(pat.name()), - pat, - "roundtrip failed for {}", - pat.name() - ); - } - } - - #[test] - fn test_spiral_radius_grows() { - let empty: [Position3D; 0] = []; - let centre_x = 100.0 / 2.0; - let centre_y = 80.0 / 2.0; - let dist = |s: u64| { - let c = ctx(0, 1, s, Position3D::zero(), &empty, &empty); - let t = FlightPattern::Spiral.next_target(&c); - ((t.x - centre_x).powi(2) + (t.y - centre_y).powi(2)).sqrt() - }; - let near = dist(1); - let far = dist(50); - assert!( - far > near, - "spiral radius should grow: step1={near}, step50={far}" - ); - } -} diff --git a/v2/crates/ruview-swarm/src/planning/pheromone.rs b/v2/crates/ruview-swarm/src/planning/pheromone.rs deleted file mode 100644 index 6c9ddbc3..00000000 --- a/v2/crates/ruview-swarm/src/planning/pheromone.rs +++ /dev/null @@ -1,22 +0,0 @@ -//! Stigmergic pheromone evaporation for coverage tracking. - -use crate::types::GridCell; - -/// Evaporate pheromones across all cells. -/// `rate`: fraction decayed per tick (e.g. 0.01 = 1% per tick). -pub fn evaporate(cells: &mut [Vec], rate: f32) { - for row in cells.iter_mut() { - for cell in row.iter_mut() { - cell.pheromone = (cell.pheromone * (1.0 - rate)).max(0.0); - } - } -} - -/// Deposit pheromone at a cell (clamp to 1.0). -pub fn deposit(cells: &mut [Vec], x: u32, y: u32, amount: f32) { - if let Some(row) = cells.get_mut(y as usize) { - if let Some(cell) = row.get_mut(x as usize) { - cell.pheromone = (cell.pheromone + amount).min(1.0); - } - } -} diff --git a/v2/crates/ruview-swarm/src/planning/probability_grid.rs b/v2/crates/ruview-swarm/src/planning/probability_grid.rs deleted file mode 100644 index 5a44e483..00000000 --- a/v2/crates/ruview-swarm/src/planning/probability_grid.rs +++ /dev/null @@ -1,153 +0,0 @@ -//! Bayesian probability grid for victim localization. - -use crate::types::GridCell; - -/// 2-D grid tracking posterior victim probability per cell. -pub struct ProbabilityGrid { - pub cells: Vec>, - pub cell_size_m: f64, - pub width: u32, - pub height: u32, -} - -impl ProbabilityGrid { - pub fn new(width: u32, height: u32, cell_size_m: f64) -> Self { - let cells = (0..height) - .map(|y| { - (0..width) - .map(|x| GridCell { - x_idx: x, - y_idx: y, - victim_probability: 0.5, // uninformative prior - pheromone: 0.0, - last_scanned_ms: 0, - }) - .collect() - }) - .collect(); - Self { cells, cell_size_m, width, height } - } - - /// Bayesian update: P(victim | detection) or P(victim | no detection). - pub fn update_bayesian(&mut self, cell: (u32, u32), confidence: f32, detected: bool) { - let (cx, cy) = cell; - if cx >= self.width || cy >= self.height { - return; - } - let c = &mut self.cells[cy as usize][cx as usize]; - let prior = c.victim_probability as f64; - // Likelihood ratio update - let likelihood = if detected { - confidence as f64 - } else { - 1.0 - confidence as f64 - }; - let denom = likelihood * prior + (1.0 - likelihood) * (1.0 - prior); - c.victim_probability = if denom > 1e-9 { - (likelihood * prior / denom) as f32 - } else { - prior as f32 - }; - c.pheromone = (c.pheromone + 0.1).min(1.0); - } - - /// Returns the cell (x, y) with highest expected value: P * (1 - scanned_weight). - pub fn highest_priority_unscanned(&self) -> Option<(u32, u32)> { - let now_approx: u64 = 0; // caller should pass current time; use 0 for simplicity - let _ = now_approx; - let mut best: Option<((u32, u32), f32)> = None; - for row in &self.cells { - for cell in row { - let scanned_weight = if cell.last_scanned_ms > 0 { cell.pheromone } else { 0.0 }; - let score = cell.victim_probability * (1.0 - scanned_weight); - if best.as_ref().is_none_or(|(_, bs)| score > *bs) { - best = Some(((cell.x_idx, cell.y_idx), score)); - } - } - } - best.map(|(pos, _)| pos) - } - - /// Mark a cell as scanned. Returns true if this is the first scan of this cell. - pub fn mark_scanned(&mut self, cell: (u32, u32)) -> bool { - let (cx, cy) = cell; - if cx >= self.width || cy >= self.height { - return false; - } - let c = &mut self.cells[cy as usize][cx as usize]; - if c.last_scanned_ms == 0 { - c.last_scanned_ms = 1; // mark as visited - true - } else { - false - } - } - - /// Fraction of cells that have been scanned at least once. - pub fn coverage_pct(&self) -> f64 { - let total: usize = self.cells.iter().flatten().count(); - let scanned: usize = self.cells.iter().flatten().filter(|c| c.last_scanned_ms > 0).count(); - if total == 0 { 1.0 } else { scanned as f64 / total as f64 } - } - - /// Return the next cell for systematic boustrophedon sweep (row-by-row, unscanned first). - pub fn next_systematic_cell(&self, _state: &crate::types::DroneState) -> Option<(u32, u32)> { - // Walk rows in order; within each row alternate direction based on row parity. - for yi in 0..self.height { - let x_iter: Box> = if yi % 2 == 0 { - Box::new(0..self.width) - } else { - Box::new((0..self.width).rev()) - }; - for xi in x_iter { - if self.cells[yi as usize][xi as usize].last_scanned_ms == 0 { - return Some((xi, yi)); - } - } - } - None - } - - /// Merge another grid's probabilities using weighted average. - pub fn apply_gossip_update(&mut self, remote: &ProbabilityGrid) { - let h = self.height.min(remote.height) as usize; - let w = self.width.min(remote.width) as usize; - for y in 0..h { - for x in 0..w { - let local = &mut self.cells[y][x]; - let r = remote.cells[y][x].victim_probability; - local.victim_probability = (local.victim_probability + r) / 2.0; - } - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_bayesian_update_increases_probability() { - let mut grid = ProbabilityGrid::new(10, 10, 2.0); - grid.update_bayesian((5, 5), 0.9, true); - assert!(grid.cells[5][5].victim_probability > 0.5); - } - - #[test] - fn test_bayesian_update_decreases_probability() { - let mut grid = ProbabilityGrid::new(10, 10, 2.0); - grid.update_bayesian((5, 5), 0.9, false); - assert!(grid.cells[5][5].victim_probability < 0.5); - } - - #[test] - fn test_highest_priority_returns_cell() { - let mut grid = ProbabilityGrid::new(5, 5, 2.0); - // Boost one cell - grid.cells[2][3].victim_probability = 0.99; - grid.cells[2][3].pheromone = 0.0; - let best = grid.highest_priority_unscanned(); - assert!(best.is_some()); - assert_eq!(best.unwrap(), (3, 2)); - } -} diff --git a/v2/crates/ruview-swarm/src/planning/rrt_apf.rs b/v2/crates/ruview-swarm/src/planning/rrt_apf.rs deleted file mode 100644 index 9a4d55de..00000000 --- a/v2/crates/ruview-swarm/src/planning/rrt_apf.rs +++ /dev/null @@ -1,177 +0,0 @@ -//! RRT-APF hybrid path planner: Rapidly-exploring Random Trees with -//! Artificial Potential Field obstacle repulsion. - -use crate::types::Position3D; -use rand::Rng; - -/// A planned waypoint with an associated target speed. -#[derive(Debug, Clone)] -pub struct Waypoint { - pub position: Position3D, - pub speed_ms: f64, -} - -/// RRT-APF path planner. -pub struct RrtApfPlanner { - pub obstacle_cells: Vec, - pub apf_repulsion_dist: f64, - pub step_size_m: f64, -} - -impl RrtApfPlanner { - pub fn new(apf_repulsion_dist: f64) -> Self { - Self { - obstacle_cells: Vec::new(), - apf_repulsion_dist, - step_size_m: 2.0, - } - } - - /// Compute the APF repulsion gradient at `pos` from all nearby obstacles. - pub fn apf_force(&self, pos: &Position3D, neighbors: &[Position3D]) -> (f64, f64, f64) { - let mut fx = 0.0_f64; - let mut fy = 0.0_f64; - let mut fz = 0.0_f64; - for obs in self.obstacle_cells.iter().chain(neighbors.iter()) { - let dist = pos.distance_to(obs); - if dist < self.apf_repulsion_dist && dist > 1e-6 { - let strength = (self.apf_repulsion_dist - dist) / (dist * dist); - fx += strength * (pos.x - obs.x); - fy += strength * (pos.y - obs.y); - fz += strength * (pos.z - obs.z); - } - } - (fx, fy, fz) - } - - /// Plan a path from `start` to `goal` using RRT* with APF bias. - pub fn plan( - &self, - start: Position3D, - goal: Position3D, - max_iter: usize, - rng: &mut impl Rng, - ) -> Vec { - let mut tree: Vec<(Position3D, usize)> = vec![(start, 0)]; - let goal_dist_thresh = self.step_size_m * 1.5; - - for _ in 0..max_iter { - // Sample random point (bias 10% toward goal) - let sample = if rng.gen::() < 0.1 { - goal - } else { - let range = 200.0_f64; - Position3D { - x: start.x + (rng.gen::() - 0.5) * range, - y: start.y + (rng.gen::() - 0.5) * range, - z: start.z, - } - }; - - // Find nearest node in tree - let (nearest_idx, nearest_pos) = tree - .iter() - .enumerate() - .min_by(|(_, (a, _)), (_, (b, _))| { - a.distance_to(&sample) - .partial_cmp(&b.distance_to(&sample)) - .unwrap_or(std::cmp::Ordering::Equal) - }) - .map(|(i, (p, _))| (i, *p)) - .unwrap_or((0, start)); - - // Step toward sample, then apply APF - let dist_to_sample = nearest_pos.distance_to(&sample); - if dist_to_sample < 1e-9 { - continue; - } - let scale = self.step_size_m / dist_to_sample; - let mut new_pos = Position3D { - x: nearest_pos.x + (sample.x - nearest_pos.x) * scale, - y: nearest_pos.y + (sample.y - nearest_pos.y) * scale, - z: nearest_pos.z + (sample.z - nearest_pos.z) * scale, - }; - - // Apply APF correction - let (fx, fy, fz) = self.apf_force(&new_pos, &[]); - let apf_scale = 0.3; - new_pos.x += fx * apf_scale; - new_pos.y += fy * apf_scale; - new_pos.z += fz * apf_scale; - - tree.push((new_pos, nearest_idx)); - - if new_pos.distance_to(&goal) <= goal_dist_thresh { - // Trace path back to root - let mut path = Vec::new(); - let mut current_idx = tree.len() - 1; - while current_idx != 0 { - let (pos, parent) = tree[current_idx]; - path.push(Waypoint { position: pos, speed_ms: 5.0 }); - current_idx = parent; - } - path.push(Waypoint { position: start, speed_ms: 5.0 }); - path.reverse(); - path.push(Waypoint { position: goal, speed_ms: 2.0 }); - return path; - } - } - - // Fallback: direct line - vec![ - Waypoint { position: start, speed_ms: 5.0 }, - Waypoint { position: goal, speed_ms: 5.0 }, - ] - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_plan_returns_at_least_two_waypoints() { - let planner = RrtApfPlanner::new(3.0); - let start = Position3D { x: 0.0, y: 0.0, z: -30.0 }; - let goal = Position3D { x: 50.0, y: 50.0, z: -30.0 }; - let mut rng = rand::thread_rng(); - let path = planner.plan(start, goal, 500, &mut rng); - assert!(path.len() >= 2); - } - - #[test] - fn test_apf_force_pushes_away() { - let planner = RrtApfPlanner { - obstacle_cells: vec![Position3D { x: 1.0, y: 0.0, z: 0.0 }], - apf_repulsion_dist: 5.0, - step_size_m: 2.0, - }; - let pos = Position3D { x: 0.0, y: 0.0, z: 0.0 }; - let (fx, _, _) = planner.apf_force(&pos, &[]); - assert!(fx < 0.0); // pushed away from x=1 obstacle - } - - #[test] - fn test_plan_reaches_goal() { - let planner = RrtApfPlanner::new(3.0); - let start = Position3D { x: 0.0, y: 0.0, z: -30.0 }; - let goal = Position3D { x: 50.0, y: 50.0, z: -30.0 }; - let mut rng = rand::thread_rng(); - let path = planner.plan(start, goal, 500, &mut rng); - let last = path.last().unwrap(); - // The RRT either reaches goal directly or the fallback end is the goal itself. - assert!(last.position.distance_to(&goal) < 10.0, "path should end near goal"); - } - - #[test] - fn test_apf_repulsion_nonzero_near_obstacle() { - let planner = RrtApfPlanner { - obstacle_cells: vec![Position3D { x: 3.0, y: 0.0, z: 0.0 }], - apf_repulsion_dist: 5.0, - step_size_m: 2.0, - }; - let pos = Position3D { x: 0.0, y: 0.0, z: 0.0 }; - let (fx, _, _) = planner.apf_force(&pos, &[]); - assert!(fx < 0.0, "repulsion should push away from obstacle (negative x)"); - } -} diff --git a/v2/crates/ruview-swarm/src/ruflo/backend.rs b/v2/crates/ruview-swarm/src/ruflo/backend.rs deleted file mode 100644 index f124351a..00000000 --- a/v2/crates/ruview-swarm/src/ruflo/backend.rs +++ /dev/null @@ -1,69 +0,0 @@ -//! RufloBackend trait and shared types. -use async_trait::async_trait; - -/// Error type for Ruflo backend operations. -#[derive(Debug, thiserror::Error)] -pub enum RufloError { - #[error("network error: {0}")] - Network(String), - #[error("tool error: {0}")] - Tool(String), - #[error("serialization error: {0}")] - Serialize(String), -} - -/// A past mission retrieved from AgentDB memory. -#[derive(Debug, Clone, serde::Deserialize, Default)] -pub struct MissionMemoryEntry { - pub key: String, - pub value: String, // JSON-encoded mission summary - pub score: f32, -} - -/// A coordination pattern retrieved from AgentDB pattern store. -#[derive(Debug, Clone, serde::Deserialize, Default)] -pub struct PatternEntry { - pub pattern: String, - pub pattern_type: String, - pub confidence: f32, - pub score: f32, -} - -/// Result of an AIDefence MAVLink message scan. -#[derive(Debug, Clone)] -pub struct MavlinkScanResult { - pub safe: bool, - pub threats: Vec, -} - -/// Core Ruflo capability trait. -/// -/// Two implementations: -/// - `HttpRufloBackend` (feature=ruflo): calls the claude-flow daemon at localhost:3000 -/// - `MockRufloBackend`: in-memory mock for testing (always available) -#[async_trait] -pub trait RufloBackend: Send + Sync { - // ── MissionMemory (claude-flow: memory_store / memory_search) ──── - async fn store_mission(&self, key: &str, summary: &str, namespace: &str) - -> Result<(), RufloError>; - async fn search_missions(&self, query: &str, limit: usize, namespace: &str) - -> Result, RufloError>; - - // ── PatternLearner (agentdb_pattern-store / agentdb_pattern-search) ─ - async fn store_pattern(&self, pattern: &str, pattern_type: &str, confidence: f32) - -> Result<(), RufloError>; - async fn search_patterns(&self, query: &str, top_k: usize, min_confidence: f32) - -> Result, RufloError>; - - // ── MavlinkDefence (aidefence_is_safe / aidefence_scan) ────────── - async fn mavlink_is_safe(&self, message_repr: &str) -> Result; - async fn mavlink_scan(&self, message_repr: &str) -> Result; - - // ── IntelligenceHooks (hooks_intelligence_trajectory-*) ────────── - async fn trajectory_start(&self, task: &str, agent: &str) - -> Result; // returns trajectoryId - async fn trajectory_step(&self, trajectory_id: &str, action: &str, result: &str, quality: f32) - -> Result<(), RufloError>; - async fn trajectory_end(&self, trajectory_id: &str, success: bool, feedback: Option<&str>) - -> Result<(), RufloError>; -} diff --git a/v2/crates/ruview-swarm/src/ruflo/http_backend.rs b/v2/crates/ruview-swarm/src/ruflo/http_backend.rs deleted file mode 100644 index 7a934518..00000000 --- a/v2/crates/ruview-swarm/src/ruflo/http_backend.rs +++ /dev/null @@ -1,173 +0,0 @@ -//! HTTP backend that calls the claude-flow daemon via JSON-RPC 2.0. -//! Default endpoint: http://localhost:3000/rpc -//! -//! Start the daemon with: npx @claude-flow/cli@latest daemon start - -use async_trait::async_trait; -use std::sync::atomic::{AtomicU64, Ordering}; -use std::time::Duration; -use super::backend::*; - -/// Per-request timeout applied to every JSON-RPC call. -/// A dead or slow daemon must not stall swarm operation loops. -const REQUEST_TIMEOUT: Duration = Duration::from_secs(5); - -pub struct HttpRufloBackend { - client: reqwest::Client, - base_url: String, - request_id: AtomicU64, -} - -impl HttpRufloBackend { - pub fn new(base_url: &str) -> Self { - let client = reqwest::Client::builder() - .timeout(REQUEST_TIMEOUT) - .build() - .expect("failed to build reqwest client"); - Self { - client, - base_url: base_url.trim_end_matches('/').to_string(), - request_id: AtomicU64::new(1), - } - } - - pub fn localhost() -> Self { Self::new("http://localhost:3000") } - - async fn call_tool( - &self, - tool: &str, - args: serde_json::Value, - ) -> Result { - let id = self.request_id.fetch_add(1, Ordering::SeqCst); - let body = serde_json::json!({ - "jsonrpc": "2.0", - "method": "tools/call", - "id": id, - "params": { "name": tool, "arguments": args } - }); - - let resp = self.client - .post(format!("{}/rpc", self.base_url)) - .json(&body) - .send() - .await - .map_err(|e| RufloError::Network(e.to_string()))?; - - let json: serde_json::Value = resp.json().await - .map_err(|e| RufloError::Serialize(e.to_string()))?; - - if let Some(err) = json.get("error") { - return Err(RufloError::Tool(err.to_string())); - } - - Ok(json["result"].clone()) - } -} - -#[async_trait] -impl RufloBackend for HttpRufloBackend { - async fn store_mission(&self, key: &str, value: &str, namespace: &str) - -> Result<(), RufloError> - { - self.call_tool("memory_store", serde_json::json!({ - "key": key, "value": value, "namespace": namespace - })).await?; - Ok(()) - } - - async fn search_missions(&self, query: &str, limit: usize, namespace: &str) - -> Result, RufloError> - { - let result = self.call_tool("memory_search", serde_json::json!({ - "query": query, "namespace": namespace, "limit": limit - })).await?; - let entries: Vec = serde_json::from_value(result) - .unwrap_or_default(); - Ok(entries) - } - - async fn store_pattern(&self, pattern: &str, pattern_type: &str, confidence: f32) - -> Result<(), RufloError> - { - self.call_tool("agentdb_pattern-store", serde_json::json!({ - "pattern": pattern, "type": pattern_type, "confidence": confidence - })).await?; - Ok(()) - } - - async fn search_patterns(&self, query: &str, top_k: usize, min_confidence: f32) - -> Result, RufloError> - { - let result = self.call_tool("agentdb_pattern-search", serde_json::json!({ - "query": query, "topK": top_k, "minConfidence": min_confidence - })).await?; - let entries: Vec = serde_json::from_value( - result["results"].clone() - ).unwrap_or_default(); - Ok(entries) - } - - async fn mavlink_is_safe(&self, message_repr: &str) -> Result { - let result = self.call_tool("aidefence_is_safe", serde_json::json!({ - "input": message_repr - })).await?; - Ok(result["safe"].as_bool().unwrap_or(true)) - } - - async fn mavlink_scan(&self, message_repr: &str) -> Result { - let result = self.call_tool("aidefence_scan", serde_json::json!({ - "input": message_repr, "quick": false - })).await?; - let safe = result["safe"].as_bool().unwrap_or(true); - let threats: Vec = result["threats"] - .as_array() - .map(|a| a.iter().filter_map(|v| v["type"].as_str().map(String::from)).collect()) - .unwrap_or_default(); - Ok(MavlinkScanResult { safe, threats }) - } - - async fn trajectory_start(&self, task: &str, agent: &str) - -> Result - { - let result = self.call_tool("hooks_intelligence_trajectory-start", serde_json::json!({ - "task": task, "agent": agent - })).await?; - Ok(result["trajectoryId"] - .as_str() - .unwrap_or("unknown-traj") - .to_string()) - } - - async fn trajectory_step( - &self, - trajectory_id: &str, - action: &str, - result_str: &str, - quality: f32, - ) -> Result<(), RufloError> { - self.call_tool("hooks_intelligence_trajectory-step", serde_json::json!({ - "trajectoryId": trajectory_id, - "action": action, - "result": result_str, - "quality": quality - })).await?; - Ok(()) - } - - async fn trajectory_end( - &self, - trajectory_id: &str, - success: bool, - feedback: Option<&str>, - ) -> Result<(), RufloError> { - let mut args = serde_json::json!({ - "trajectoryId": trajectory_id, - "success": success - }); - if let Some(fb) = feedback { - args["feedback"] = fb.into(); - } - self.call_tool("hooks_intelligence_trajectory-end", args).await?; - Ok(()) - } -} diff --git a/v2/crates/ruview-swarm/src/ruflo/mission_summary.rs b/v2/crates/ruview-swarm/src/ruflo/mission_summary.rs deleted file mode 100644 index ed351de6..00000000 --- a/v2/crates/ruview-swarm/src/ruflo/mission_summary.rs +++ /dev/null @@ -1,125 +0,0 @@ -//! Serializable mission summary stored in AgentDB memory after each completed mission. -use serde::{Deserialize, Serialize}; -use crate::orchestrator::MissionStats; - -/// Serializable summary of a completed mission stored in AgentDB. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct MissionSummary { - pub mission_profile: String, - pub num_drones: usize, - pub area_width_m: f64, - pub area_height_m: f64, - pub victims_total: usize, - pub victims_confirmed: u32, - pub cells_covered: u32, - pub coverage_pct: f64, - pub elapsed_secs: f64, - pub collision_events: u32, - pub localization_error_m: Option, -} - -impl MissionSummary { - pub fn from_stats( - stats: &MissionStats, - profile: &str, - num_drones: usize, - area_width: f64, - area_height: f64, - victims_total: usize, - coverage_pct: f64, - ) -> Self { - Self { - mission_profile: profile.to_string(), - num_drones, - area_width_m: area_width, - area_height_m: area_height, - victims_total, - victims_confirmed: stats.victims_confirmed, - cells_covered: stats.cells_covered, - coverage_pct, - elapsed_secs: stats.elapsed_secs, - collision_events: stats.collision_events, - localization_error_m: None, - } - } - - /// Pattern description for AgentDB pattern-store — human-readable. - pub fn to_pattern_description(&self) -> String { - format!( - "{} mission: {} drones over {}x{}m, {} victims confirmed in {:.1}s, {:.0}% coverage, {} collisions", - self.mission_profile, - self.num_drones, - self.area_width_m as u32, - self.area_height_m as u32, - self.victims_confirmed, - self.elapsed_secs, - self.coverage_pct * 100.0, - self.collision_events, - ) - } - - /// Pattern type tag for AgentDB. - pub fn pattern_type(&self) -> &str { - match self.mission_profile.as_str() { - "sar" => "sar-mission", - "inspection" => "inspection-mission", - "mine" => "mine-mission", - _ => "swarm-mission", - } - } - - /// Confidence score (0-1) for AgentDB based on mission outcomes. - pub fn pattern_confidence(&self) -> f32 { - let victim_score = if self.victims_total > 0 { - self.victims_confirmed as f32 / self.victims_total as f32 - } else { - 0.5 - }; - let coverage_score = self.coverage_pct as f32; - let collision_penalty = (self.collision_events as f32 * 0.1).min(0.5); - ((victim_score * 0.5 + coverage_score * 0.5) - collision_penalty).clamp(0.0, 1.0) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - fn make_stats(victims_confirmed: u32, cells_covered: u32, collision_events: u32) -> MissionStats { - MissionStats { - cells_covered, - victims_confirmed, - collision_events, - steps: 100, - elapsed_secs: 30.0, - } - } - - #[test] - fn test_pattern_type_tags() { - let stats = make_stats(2, 80, 0); - let s = MissionSummary::from_stats(&stats, "sar", 4, 400.0, 400.0, 3, 0.85); - assert_eq!(s.pattern_type(), "sar-mission"); - - let s2 = MissionSummary::from_stats(&stats, "custom", 2, 200.0, 200.0, 0, 0.5); - assert_eq!(s2.pattern_type(), "swarm-mission"); - } - - #[test] - fn test_pattern_confidence_penalises_collisions() { - let no_collisions = make_stats(3, 80, 0); - let with_collisions = make_stats(3, 80, 4); - let s_good = MissionSummary::from_stats(&no_collisions, "sar", 4, 400.0, 400.0, 3, 0.9); - let s_bad = MissionSummary::from_stats(&with_collisions, "sar", 4, 400.0, 400.0, 3, 0.9); - assert!(s_good.pattern_confidence() > s_bad.pattern_confidence()); - } - - #[test] - fn test_to_pattern_description_contains_profile() { - let stats = make_stats(1, 50, 0); - let s = MissionSummary::from_stats(&stats, "inspection", 2, 100.0, 100.0, 1, 0.75); - let desc = s.to_pattern_description(); - assert!(desc.contains("inspection"), "description should include profile: {desc}"); - assert!(desc.contains("2 drones"), "description should include drone count: {desc}"); - } -} diff --git a/v2/crates/ruview-swarm/src/ruflo/mock_backend.rs b/v2/crates/ruview-swarm/src/ruflo/mock_backend.rs deleted file mode 100644 index 6a70c13b..00000000 --- a/v2/crates/ruview-swarm/src/ruflo/mock_backend.rs +++ /dev/null @@ -1,158 +0,0 @@ -//! In-memory mock RufloBackend for testing — no network, zero latency. -use async_trait::async_trait; -use std::sync::{Arc, Mutex}; -use super::backend::*; - -/// Configurable mock. All writes go to in-memory vecs; searches return stored items. -pub struct MockRufloBackend { - pub missions: Arc>>, // (key, value) - pub patterns: Arc>>, // (pattern, type, confidence) - pub scan_safe: bool, // set false to simulate a detected threat - pub traj_ids: Arc>>, -} - -impl Default for MockRufloBackend { - fn default() -> Self { - Self { - missions: Arc::new(Mutex::new(Vec::new())), - patterns: Arc::new(Mutex::new(Vec::new())), - scan_safe: true, - traj_ids: Arc::new(Mutex::new(Vec::new())), - } - } -} - -impl MockRufloBackend { - pub fn new() -> Self { Self::default() } - - /// Pre-load a past mission for search to return. - pub fn seed_mission(&self, key: &str, value: &str) { - self.missions.lock().unwrap().push((key.to_string(), value.to_string())); - } - - /// Pre-load a pattern for search to return. - pub fn seed_pattern(&self, pattern: &str, ptype: &str, confidence: f32) { - self.patterns.lock().unwrap().push((pattern.to_string(), ptype.to_string(), confidence)); - } - - /// Configure the scanner to reject the next message. - pub fn reject_next(self) -> Self { Self { scan_safe: false, ..self } } -} - -#[async_trait] -impl RufloBackend for MockRufloBackend { - async fn store_mission(&self, key: &str, value: &str, _ns: &str) -> Result<(), RufloError> { - self.missions.lock().unwrap().push((key.to_string(), value.to_string())); - Ok(()) - } - - async fn search_missions(&self, query: &str, limit: usize, _ns: &str) - -> Result, RufloError> - { - let missions = self.missions.lock().unwrap(); - Ok(missions.iter().take(limit).map(|(k, v)| MissionMemoryEntry { - key: k.clone(), - value: v.clone(), - score: if v.contains(query) { 0.9 } else { 0.5 }, - }).collect()) - } - - async fn store_pattern(&self, pattern: &str, ptype: &str, confidence: f32) - -> Result<(), RufloError> - { - self.patterns.lock().unwrap().push((pattern.to_string(), ptype.to_string(), confidence)); - Ok(()) - } - - async fn search_patterns(&self, _query: &str, top_k: usize, min_conf: f32) - -> Result, RufloError> - { - let patterns = self.patterns.lock().unwrap(); - Ok(patterns.iter() - .filter(|(_, _, c)| *c >= min_conf) - .take(top_k) - .map(|(p, t, c)| PatternEntry { - pattern: p.clone(), - pattern_type: t.clone(), - confidence: *c, - score: *c, - }) - .collect()) - } - - async fn mavlink_is_safe(&self, _msg: &str) -> Result { - Ok(self.scan_safe) - } - - async fn mavlink_scan(&self, _msg: &str) -> Result { - Ok(MavlinkScanResult { - safe: self.scan_safe, - threats: if self.scan_safe { - vec![] - } else { - vec!["suspicious_coordinates".into()] - }, - }) - } - - async fn trajectory_start(&self, task: &str, _agent: &str) - -> Result - { - let id = format!("mock-traj-{}", task.len()); // deterministic for testing - self.traj_ids.lock().unwrap().push(id.clone()); - Ok(id) - } - - async fn trajectory_step(&self, _id: &str, _act: &str, _res: &str, _q: f32) - -> Result<(), RufloError> { Ok(()) } - - async fn trajectory_end(&self, _id: &str, _ok: bool, _fb: Option<&str>) - -> Result<(), RufloError> { Ok(()) } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[tokio::test] - async fn test_mock_store_and_search_mission() { - let mock = MockRufloBackend::new(); - mock.store_mission("m1", r#"{"victims":2}"#, "swarm-missions").await.unwrap(); - let results = mock.search_missions("victims", 5, "swarm-missions").await.unwrap(); - assert_eq!(results.len(), 1); - assert_eq!(results[0].key, "m1"); - assert!(results[0].score > 0.5, "keyword match should score high"); - } - - #[tokio::test] - async fn test_mock_pattern_lifecycle() { - let mock = MockRufloBackend::new(); - mock.store_pattern("approach from 3 angles when P > 0.7", "sar-trajectory", 0.9).await.unwrap(); - let results = mock.search_patterns("SAR convergence", 5, 0.5).await.unwrap(); - assert_eq!(results.len(), 1); - assert_eq!(results[0].confidence, 0.9); - } - - #[tokio::test] - async fn test_mock_mavlink_defence_safe() { - let mock = MockRufloBackend::new(); - assert!(mock.mavlink_is_safe(r#"{"drone_id":1,"confidence":0.8}"#).await.unwrap()); - } - - #[tokio::test] - async fn test_mock_mavlink_defence_rejected() { - let mock = MockRufloBackend { scan_safe: false, ..Default::default() }; - let scan = mock.mavlink_scan("SUSPICIOUS MESSAGE").await.unwrap(); - assert!(!scan.safe); - assert!(!scan.threats.is_empty()); - } - - #[tokio::test] - async fn test_mock_trajectory_lifecycle() { - let mock = MockRufloBackend::new(); - let tid = mock.trajectory_start("SAR 400x400", "swarm-specialist").await.unwrap(); - mock.trajectory_step(&tid, "scan (5,3)", "prob=0.6", 0.7).await.unwrap(); - mock.trajectory_end(&tid, true, Some("victim found")).await.unwrap(); - assert!(!mock.traj_ids.lock().unwrap().is_empty()); - } -} diff --git a/v2/crates/ruview-swarm/src/ruflo/mod.rs b/v2/crates/ruview-swarm/src/ruflo/mod.rs deleted file mode 100644 index c1e7dc41..00000000 --- a/v2/crates/ruview-swarm/src/ruflo/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -//! Ruflo AI-agent capabilities integration. -//! -//! Integrates the claude-flow daemon's AgentDB, AIDefence, and SONA intelligence -//! hooks into the ruview-swarm orchestrator via a trait-based backend. -//! -//! Feature gate: `ruflo`. The `RufloBackend` trait and `MockRufloBackend` are always -//! compiled so tests can use them without enabling the `ruflo` feature. Only -//! `HttpRufloBackend` (which requires `reqwest` + `serde_json`) is gated. - -pub mod backend; -pub mod mock_backend; -pub mod mission_summary; - -#[cfg(feature = "ruflo")] -pub mod http_backend; - -pub use backend::{RufloBackend, RufloError, MissionMemoryEntry, PatternEntry, MavlinkScanResult}; -pub use mock_backend::MockRufloBackend; -pub use mission_summary::MissionSummary; - -#[cfg(feature = "ruflo")] -pub use http_backend::HttpRufloBackend; diff --git a/v2/crates/ruview-swarm/src/security/antijamming.rs b/v2/crates/ruview-swarm/src/security/antijamming.rs deleted file mode 100644 index e79060b4..00000000 --- a/v2/crates/ruview-swarm/src/security/antijamming.rs +++ /dev/null @@ -1,208 +0,0 @@ -//! FHSS (Frequency Hopping Spread Spectrum) anti-jamming interface. -//! -//! Provides frequency hop sequence generation and cognitive radio-inspired -//! adaptive frequency/power selection for drone swarm communication links. - -use serde::{Deserialize, Serialize}; - -/// FHSS configuration for a swarm communication link. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct FhssConfig { - /// Hop rate in hops-per-second (typical: 100–200). - pub hop_rate_hz: f64, - /// Available frequency channels in MHz. - pub channels_mhz: Vec, - /// Minimum RSSI (dBm) before triggering channel switch. - pub rssi_threshold_dbm: f32, - /// Number of consecutive poor-RSSI samples before switching. - pub jamming_detect_window: usize, -} - -impl Default for FhssConfig { - fn default() -> Self { - // 900 MHz ISM band: 902–928 MHz, 50 channels at 512 kHz spacing - let channels: Vec = (0..50).map(|i| 902.0 + i as f64 * 0.512).collect(); - Self { - hop_rate_hz: 200.0, - channels_mhz: channels, - rssi_threshold_dbm: -85.0, - jamming_detect_window: 5, - } - } -} - -/// State of the FHSS radio at one node. -pub struct FhssRadio { - pub config: FhssConfig, - /// Current hop sequence position. - hop_index: usize, - /// Rolling RSSI history (most recent last). - rssi_history: Vec, - /// Elapsed time since last hop (ms). - elapsed_ms: f64, - /// Node ID seed for unique hop sequence (XOR with hop_index for non-collision). - node_seed: u32, - /// Number of jammer-evasion channel jumps taken. - pub evasion_count: u64, -} - -impl FhssRadio { - pub fn new(node_seed: u32, config: FhssConfig) -> Self { - Self { - config, - hop_index: 0, - rssi_history: Vec::new(), - elapsed_ms: 0.0, - node_seed, - evasion_count: 0, - } - } - - /// Returns the current active channel frequency in MHz. - /// - /// `FhssConfig` is `Deserialize`, so `channels_mhz` can arrive empty from a - /// malformed or hostile config. An empty channel list would make `% n` - /// (n = 0) panic with a divide-by-zero. Guard it and return a benign `0.0` - /// sentinel instead of crashing the radio task (DoS-resistance). - pub fn current_channel_mhz(&self) -> f64 { - let n = self.config.channels_mhz.len(); - if n == 0 { - return 0.0; - } - // XOR node seed into hop index so each node uses a different offset - let idx = (self.hop_index ^ (self.node_seed as usize)) % n; - self.config.channels_mhz[idx] - } - - /// Advance the hop sequence by one step (call at hop_rate_hz). - pub fn next_hop(&mut self) { - let n = self.config.channels_mhz.len(); - if n == 0 { - return; // no channels configured — nothing to hop (avoid `% 0` panic) - } - self.hop_index = (self.hop_index + 1) % n; - } - - /// Update with latest RSSI measurement. Drives jamming detection. - pub fn observe_rssi(&mut self, rssi_dbm: f32) { - self.rssi_history.push(rssi_dbm); - if self.rssi_history.len() > self.config.jamming_detect_window { - self.rssi_history.remove(0); - } - } - - /// Returns true if jamming is detected (all recent RSSI samples below threshold). - pub fn jamming_detected(&self) -> bool { - if self.rssi_history.len() < self.config.jamming_detect_window { - return false; - } - self.rssi_history.iter().all(|&r| r < self.config.rssi_threshold_dbm) - } - - /// Evasive hop: jump ahead by a pseudo-random offset to escape jammer. - /// Uses a simple LCG seeded by node_seed + evasion_count for determinism. - pub fn evasive_hop(&mut self) { - let lcg_a: u64 = 6364136223846793005; - let lcg_c: u64 = 1442695040888963407; - // Use wrapping arithmetic to avoid overflow in debug builds - let seed = (self.node_seed as u64) - .wrapping_mul(lcg_a) - .wrapping_add(self.evasion_count) - .wrapping_add(lcg_c); - let len = self.config.channels_mhz.len(); - if len == 0 { - return; // no channels configured — avoid `% 0` panic - } - let n = len as u64; - let offset = (seed % n / 4 + 3) as usize; - self.hop_index = (self.hop_index + offset) % len; - self.evasion_count += 1; - self.rssi_history.clear(); - } - - /// Tick the radio by dt_ms milliseconds. Handles automatic hopping. - /// - /// Multiple hops may fire within a single tick if dt_ms > hop_interval_ms. - pub fn tick(&mut self, dt_ms: f64) { - self.elapsed_ms += dt_ms; - let hop_interval_ms = 1000.0 / self.config.hop_rate_hz; - while self.elapsed_ms >= hop_interval_ms { - self.elapsed_ms -= hop_interval_ms; - self.next_hop(); - } - if self.jamming_detected() { - self.evasive_hop(); - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_different_nodes_different_channels() { - let cfg = FhssConfig::default(); - let r0 = FhssRadio::new(0, cfg.clone()); - let r1 = FhssRadio::new(7, cfg); - // Nodes with different seeds should use different channels at hop 0 - assert_ne!(r0.current_channel_mhz(), r1.current_channel_mhz(), - "different nodes should use different initial channels"); - } - - #[test] - fn test_jamming_detection() { - let cfg = FhssConfig { jamming_detect_window: 3, rssi_threshold_dbm: -85.0, ..Default::default() }; - let mut radio = FhssRadio::new(0, cfg); - // Feed 3 below-threshold RSSI values - radio.observe_rssi(-90.0); - radio.observe_rssi(-92.0); - assert!(!radio.jamming_detected(), "need full window"); - radio.observe_rssi(-91.0); - assert!(radio.jamming_detected()); - } - - #[test] - fn test_evasive_hop_changes_channel() { - let cfg = FhssConfig::default(); - let mut radio = FhssRadio::new(42, cfg); - let before = radio.current_channel_mhz(); - radio.evasive_hop(); - let after = radio.current_channel_mhz(); - assert_ne!(before, after, "evasive hop should change channel"); - } - - #[test] - fn test_tick_advances_hop() { - let cfg = FhssConfig { hop_rate_hz: 1000.0, ..Default::default() }; // 1 hop/ms - let mut radio = FhssRadio::new(0, cfg); - let initial_idx = radio.hop_index; - radio.tick(2.0); // 2 ms = 2 hops - assert_eq!(radio.hop_index, (initial_idx + 2) % 50); - } - - /// Security/DoS: an empty `channels_mhz` (deserialized from a malformed or - /// hostile config) must not panic with a `% 0` divide-by-zero. Fails on old - /// code, where `next_hop`/`current_channel_mhz`/`evasive_hop`/`tick` all do - /// modulo / index by `channels_mhz.len()`. - #[test] - fn test_empty_channels_does_not_panic() { - let cfg = FhssConfig { channels_mhz: vec![], jamming_detect_window: 1, ..Default::default() }; - let mut radio = FhssRadio::new(7, cfg); - // None of these may panic. - let _ = radio.current_channel_mhz(); - radio.next_hop(); - radio.observe_rssi(-99.0); // window=1 → jamming_detected() true → evasive_hop() - radio.tick(100.0); - radio.evasive_hop(); - assert_eq!(radio.current_channel_mhz(), 0.0, "empty channel list returns sentinel"); - } - - #[test] - fn test_channel_in_valid_range() { - let cfg = FhssConfig::default(); - let radio = FhssRadio::new(99, cfg.clone()); - let ch = radio.current_channel_mhz(); - assert!(ch >= 902.0 && ch <= 928.0, "channel {} out of ISM band", ch); - } -} diff --git a/v2/crates/ruview-swarm/src/security/geofence.rs b/v2/crates/ruview-swarm/src/security/geofence.rs deleted file mode 100644 index 47599ea0..00000000 --- a/v2/crates/ruview-swarm/src/security/geofence.rs +++ /dev/null @@ -1,184 +0,0 @@ -//! Geofence: polygon boundary with hard/soft margins. - -use crate::types::Position3D; -use serde::{Deserialize, Serialize}; - -/// Polygon geofence with altitude bounds. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct Geofence { - /// Polygon vertices (x, y) in local NED metres. - pub boundary: Vec<(f64, f64)>, - pub min_altitude_m: f64, - pub max_altitude_m: f64, - /// Hard margin: triggers RTH immediately. - pub hard_margin_m: f64, - /// Soft margin: triggers warning + speed reduction. - pub soft_margin_m: f64, -} - -/// Result of a geofence check. -#[derive(Debug, Clone, PartialEq)] -pub enum GeofenceResult { - Safe, - SoftWarning { distance_to_boundary_m: f64 }, - HardBreach, -} - -impl Geofence { - /// Check a position against this geofence. - pub fn check(&self, pos: &Position3D) -> GeofenceResult { - // Fail CLOSED on a non-finite position. A NaN/Inf component (from a - // corrupt GPS/EKF estimate or a forged position) makes every subsequent - // comparison false: `NaN < min || NaN > max` is `false`, so the altitude - // breach is skipped, and a NaN altitude with otherwise-valid x/y would - // return `Safe` — a silent geofence bypass on a flight-safety boundary. - // Treat any non-finite coordinate as a hard breach. - if !pos.x.is_finite() || !pos.y.is_finite() || !pos.z.is_finite() { - return GeofenceResult::HardBreach; - } - - let altitude_m = -pos.z; // NED: negative z = altitude above ground - - // Altitude check - if altitude_m < self.min_altitude_m || altitude_m > self.max_altitude_m { - return GeofenceResult::HardBreach; - } - - let inside = self.point_in_polygon(pos.x, pos.y); - let dist = self.distance_to_boundary(pos.x, pos.y); - - if !inside { - return GeofenceResult::HardBreach; - } - - if dist <= self.hard_margin_m { - GeofenceResult::HardBreach - } else if dist <= self.soft_margin_m { - GeofenceResult::SoftWarning { distance_to_boundary_m: dist } - } else { - GeofenceResult::Safe - } - } - - /// Ray-casting algorithm: even number of crossings = outside. - fn point_in_polygon(&self, x: f64, y: f64) -> bool { - let n = self.boundary.len(); - if n < 3 { - return false; - } - let mut inside = false; - let mut j = n - 1; - for i in 0..n { - let (xi, yi) = self.boundary[i]; - let (xj, yj) = self.boundary[j]; - if ((yi > y) != (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi) { - inside = !inside; - } - j = i; - } - inside - } - - /// Minimum distance from (x, y) to any boundary edge. - fn distance_to_boundary(&self, x: f64, y: f64) -> f64 { - let n = self.boundary.len(); - if n == 0 { - return f64::INFINITY; - } - let mut min_dist = f64::INFINITY; - let mut j = n - 1; - for i in 0..n { - let (ax, ay) = self.boundary[j]; - let (bx, by) = self.boundary[i]; - let dist = point_to_segment_dist(x, y, ax, ay, bx, by); - if dist < min_dist { - min_dist = dist; - } - j = i; - } - min_dist - } -} - -fn point_to_segment_dist(px: f64, py: f64, ax: f64, ay: f64, bx: f64, by: f64) -> f64 { - let dx = bx - ax; - let dy = by - ay; - let len_sq = dx * dx + dy * dy; - if len_sq < 1e-12 { - return ((px - ax).powi(2) + (py - ay).powi(2)).sqrt(); - } - let t = ((px - ax) * dx + (py - ay) * dy) / len_sq; - let t = t.clamp(0.0, 1.0); - let cx = ax + t * dx; - let cy = ay + t * dy; - ((px - cx).powi(2) + (py - cy).powi(2)).sqrt() -} - -#[cfg(test)] -mod tests { - use super::*; - - fn square_fence() -> Geofence { - Geofence { - boundary: vec![(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)], - min_altitude_m: 0.0, - max_altitude_m: 120.0, - hard_margin_m: 10.0, - soft_margin_m: 25.0, - } - } - - #[test] - fn test_centre_is_safe() { - let f = square_fence(); - let pos = Position3D { x: 50.0, y: 50.0, z: -30.0 }; - assert_eq!(f.check(&pos), GeofenceResult::Safe); - } - - #[test] - fn test_outside_is_hard_breach() { - let f = square_fence(); - let pos = Position3D { x: 150.0, y: 50.0, z: -30.0 }; - assert_eq!(f.check(&pos), GeofenceResult::HardBreach); - } - - #[test] - fn test_near_edge_is_soft_warning() { - let f = square_fence(); - // 15m from boundary → beyond hard (10m) but within soft (25m) - let pos = Position3D { x: 15.0, y: 50.0, z: -30.0 }; - assert!(matches!(f.check(&pos), GeofenceResult::SoftWarning { .. })); - } - - #[test] - fn test_altitude_breach() { - let f = square_fence(); - let pos = Position3D { x: 50.0, y: 50.0, z: -200.0 }; // 200m altitude - assert_eq!(f.check(&pos), GeofenceResult::HardBreach); - } - - /// Security: a NaN altitude with an otherwise in-bounds x/y must fail closed - /// to HardBreach. Fails on old code where `NaN < min || NaN > max` is `false`, - /// the altitude check is skipped, and the point-in-polygon path returns Safe — - /// a silent geofence bypass. - #[test] - fn test_nan_altitude_fails_closed() { - let f = square_fence(); - let pos = Position3D { x: 50.0, y: 50.0, z: f64::NAN }; - assert_eq!(f.check(&pos), GeofenceResult::HardBreach); - } - - /// Security: NaN/Inf horizontal coordinates must also fail closed. - #[test] - fn test_nonfinite_horizontal_fails_closed() { - let f = square_fence(); - assert_eq!( - f.check(&Position3D { x: f64::NAN, y: 50.0, z: -30.0 }), - GeofenceResult::HardBreach - ); - assert_eq!( - f.check(&Position3D { x: 50.0, y: f64::INFINITY, z: -30.0 }), - GeofenceResult::HardBreach - ); - } -} diff --git a/v2/crates/ruview-swarm/src/security/mavlink_signing.rs b/v2/crates/ruview-swarm/src/security/mavlink_signing.rs deleted file mode 100644 index ef442cc2..00000000 --- a/v2/crates/ruview-swarm/src/security/mavlink_signing.rs +++ /dev/null @@ -1,100 +0,0 @@ -//! MAVLink v2 HMAC-SHA256 link-level signing. - -use hmac::{Hmac, Mac}; -use sha2::Sha256; -use std::sync::atomic::{AtomicU64, Ordering}; - -type HmacSha256 = Hmac; - -/// Signs and verifies MAVLink v2 messages using HMAC-SHA256. -pub struct MavlinkSigner { - key: [u8; 32], - link_id: u8, - timestamp: AtomicU64, -} - -impl MavlinkSigner { - pub fn new(key: [u8; 32], link_id: u8) -> Self { - Self { - key, - link_id, - timestamp: AtomicU64::new(1), - } - } - - /// Advance and return a monotonic 48-bit timestamp (units: 10 µs since epoch). - fn next_timestamp(&self) -> u64 { - self.timestamp.fetch_add(1, Ordering::SeqCst) - } - - /// Compute the 6-byte MAVLink v2 signature. - /// Signature = first 6 bytes of HMAC-SHA256(key, link_id || timestamp_6bytes || message_bytes) - pub fn sign(&self, message_bytes: &[u8]) -> [u8; 6] { - let ts = self.next_timestamp(); - let ts_bytes = ts.to_le_bytes(); // 8 bytes, MAVLink uses 6 but we include all for simplicity - - let mut mac = HmacSha256::new_from_slice(&self.key) - .expect("HMAC accepts any key length"); - mac.update(&[self.link_id]); - mac.update(&ts_bytes[..6]); - mac.update(message_bytes); - - let result = mac.finalize().into_bytes(); - let mut sig = [0u8; 6]; - sig.copy_from_slice(&result[..6]); - sig - } - - /// Verify that `signature` is valid for `message_bytes`. - /// This implementation re-computes against all recent timestamps within a - /// small window (for demo/test). Production code should maintain a timestamp - /// window per link_id. - pub fn verify(&self, message_bytes: &[u8], signature: &[u8; 6]) -> bool { - let current_ts = self.timestamp.load(Ordering::SeqCst); - // Check ±32 timestamps to handle reordering in tests - let start = current_ts.saturating_sub(32); - for ts in start..=current_ts + 1 { - let ts_bytes = ts.to_le_bytes(); - let mut mac = HmacSha256::new_from_slice(&self.key) - .expect("HMAC accepts any key length"); - mac.update(&[self.link_id]); - mac.update(&ts_bytes[..6]); - mac.update(message_bytes); - let result = mac.finalize().into_bytes(); - if &result[..6] == signature.as_ref() { - return true; - } - } - false - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_sign_produces_6_bytes() { - let signer = MavlinkSigner::new([0xABu8; 32], 0); - let sig = signer.sign(b"heartbeat"); - assert_eq!(sig.len(), 6); - } - - #[test] - fn test_verify_correct_signature() { - let signer = MavlinkSigner::new([0x42u8; 32], 1); - let msg = b"test_message"; - let sig = signer.sign(msg); - assert!(signer.verify(msg, &sig)); - } - - #[test] - fn test_verify_wrong_key_fails() { - let signer1 = MavlinkSigner::new([0x01u8; 32], 1); - let signer2 = MavlinkSigner::new([0x02u8; 32], 1); - let msg = b"test_message"; - let sig = signer1.sign(msg); - // signer2 has a different key — can't verify signer1's sig - assert!(!signer2.verify(msg, &sig)); - } -} diff --git a/v2/crates/ruview-swarm/src/security/mod.rs b/v2/crates/ruview-swarm/src/security/mod.rs deleted file mode 100644 index 8da45ff0..00000000 --- a/v2/crates/ruview-swarm/src/security/mod.rs +++ /dev/null @@ -1,13 +0,0 @@ -//! Security: MAVLink signing, UWB anti-spoofing, geofencing, Remote ID, FHSS anti-jamming. - -pub mod mavlink_signing; -pub mod uwb_antispoofing; -pub mod geofence; -pub mod remote_id; -pub mod antijamming; - -pub use mavlink_signing::MavlinkSigner; -pub use uwb_antispoofing::UwbAntiSpoofing; -pub use geofence::{Geofence, GeofenceResult}; -pub use remote_id::RemoteIdBroadcast; -pub use antijamming::{FhssConfig, FhssRadio}; diff --git a/v2/crates/ruview-swarm/src/security/remote_id.rs b/v2/crates/ruview-swarm/src/security/remote_id.rs deleted file mode 100644 index a4289222..00000000 --- a/v2/crates/ruview-swarm/src/security/remote_id.rs +++ /dev/null @@ -1,143 +0,0 @@ -//! ASTM F3411 Remote ID — **Basic ID message only** (ADR-159 §A3). -//! -//! Only the Basic ID message (`encode_basic_id`) is implemented. The -//! Location/Vector message is **not** encoded yet because the drone position is -//! tracked in a local NED frame (north/east metres relative to a takeoff datum), -//! and a compliant Location/Vector message requires WGS84 latitude/longitude. -//! Broadcasting NED metres in lat/lon fields would emit physically-impossible -//! coordinates (e.g. "latitude = 12.4 metres"), so we deliberately keep the -//! drone position in honest `drone_north_m` / `drone_east_m` fields until a real -//! local-tangent-plane NED→WGS84 transform (with an operator datum) lands. See -//! the `ACCEPTED-FUTURE` note in ADR-159 §A3. - -use crate::types::DroneState; -use serde::{Deserialize, Serialize}; - -/// Remote ID broadcast state for one drone. -/// -/// Drone position is stored as **NED metres** (`drone_north_m` / `drone_east_m`) -/// relative to the operator/takeoff datum — *not* WGS84 lat/lon — because no -/// datum-anchored geodetic transform is wired yet. The operator position is true -/// WGS84 (it comes from the operator's GNSS, not the local frame). -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct RemoteIdBroadcast { - pub uas_id: [u8; 20], // 20-byte UAS ID (ANSI/CTA-2063-A) - /// Operator latitude (WGS84 degrees) — real geodetic position. - pub operator_lat: f64, - /// Operator longitude (WGS84 degrees) — real geodetic position. - pub operator_lon: f64, - /// Drone north offset in **metres** from the operator/takeoff datum (NED x). - /// NOT a latitude. See module docs — Location/Vector encoding is deferred - /// until a real NED→WGS84 transform exists. - pub drone_north_m: f64, - /// Drone east offset in **metres** from the operator/takeoff datum (NED y). - /// NOT a longitude. - pub drone_east_m: f64, - pub altitude_msl_m: f32, - pub speed_ms: f32, - pub heading_deg: f32, - pub timestamp_ms: u64, - pub emergency_status: bool, -} - -impl RemoteIdBroadcast { - pub fn new(uas_id: [u8; 20]) -> Self { - Self { - uas_id, - operator_lat: 0.0, - operator_lon: 0.0, - drone_north_m: 0.0, - drone_east_m: 0.0, - altitude_msl_m: 0.0, - speed_ms: 0.0, - heading_deg: 0.0, - timestamp_ms: 0, - emergency_status: false, - } - } - - /// Update from a drone state and operator position. - /// - /// The drone position is stored as honest NED metres — we do **not** fake a - /// lat/lon from a local-frame offset. The operator position is true WGS84. - pub fn update(&mut self, state: &DroneState, operator_pos: (f64, f64)) { - // NED metres, stored as-is in metre-typed fields (no fabricated geodetic - // coordinates). A future Location/Vector encoder must transform these - // through a datum-anchored NED→WGS84 projection before broadcast. - self.drone_north_m = state.position.x; // NED x = north offset, metres - self.drone_east_m = state.position.y; // NED y = east offset, metres - self.altitude_msl_m = state.altitude_agl_m as f32; - self.speed_ms = state.velocity.magnitude() as f32; - self.heading_deg = state.heading_rad.to_degrees() as f32; - self.timestamp_ms = state.timestamp_ms; - self.operator_lat = operator_pos.0; - self.operator_lon = operator_pos.1; - } - - /// Encode a 25-byte ASTM F3411 Basic ID message. - /// Format: [message_type(1)] [id_type(1)] [uas_id(20)] [reserved(3)] - pub fn encode_basic_id(&self) -> [u8; 25] { - let mut buf = [0u8; 25]; - buf[0] = 0x00; // Message type: Basic ID - buf[1] = 0x01; // ID type: Serial Number - buf[2..22].copy_from_slice(&self.uas_id); - // bytes 22-24: reserved - buf - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_encode_basic_id_length() { - let rid = RemoteIdBroadcast::new([0x41u8; 20]); - let buf = rid.encode_basic_id(); - assert_eq!(buf.len(), 25); - assert_eq!(buf[1], 0x01); // ID type: serial number - } - - #[test] - fn test_uas_id_in_encoded_buffer() { - let mut id = [0u8; 20]; - id[0] = 0xFF; - let rid = RemoteIdBroadcast::new(id); - let buf = rid.encode_basic_id(); - assert_eq!(buf[2], 0xFF); - } - - /// ADR-159 §A3 — a known NED offset must land in honest **metre** fields, - /// never in WGS84 lat/lon fields (which would broadcast physically-impossible - /// coordinates like "latitude = 37.5 m"). Fails on old code, where the same - /// values were stored into `drone_lat`/`drone_lon`. - #[test] - fn test_ned_offset_stored_as_metres_not_latlon() { - use crate::types::{DroneState, NodeId, Position3D}; - - let mut state = DroneState::default_at_origin(NodeId(7)); - // 37.5 m north, -12.0 m east of the takeoff datum. - state.position = Position3D { - x: 37.5, - y: -12.0, - z: 5.0, - }; - let mut rid = RemoteIdBroadcast::new([0x41u8; 20]); - // Operator at a real WGS84 fix (San Francisco-ish). - rid.update(&state, (37.7749, -122.4194)); - - // Drone offset is honest NED metres. - assert_eq!(rid.drone_north_m, 37.5); - assert_eq!(rid.drone_east_m, -12.0); - - // Operator position is the real geodetic fix and is plausibly a lat/lon. - assert!((-90.0..=90.0).contains(&rid.operator_lat)); - assert!((-180.0..=180.0).contains(&rid.operator_lon)); - assert!((rid.operator_lat - 37.7749).abs() < 1e-9); - - // The drone NED metres would have been an out-of-range "latitude" only - // if a value happened to exceed 90 — but the contract is the field name - // itself: these are metres, not degrees. A future Location/Vector - // encoder must project them through a real NED→WGS84 transform. - } -} diff --git a/v2/crates/ruview-swarm/src/security/uwb_antispoofing.rs b/v2/crates/ruview-swarm/src/security/uwb_antispoofing.rs deleted file mode 100644 index d623a3c1..00000000 --- a/v2/crates/ruview-swarm/src/security/uwb_antispoofing.rs +++ /dev/null @@ -1,82 +0,0 @@ -//! UWB-based GPS anti-spoofing: cross-validates GPS position against UWB ranging. - -use crate::types::{NodeId, Position3D}; - -/// Cross-validates GPS against UWB ranging to neighbours. -pub struct UwbAntiSpoofing { - /// Tolerance for GPS vs UWB distance discrepancy, metres. - pub tolerance_m: f64, - /// Minimum number of UWB neighbours required for a valid cross-check. - pub min_neighbors: usize, -} - -impl UwbAntiSpoofing { - pub fn new(tolerance_m: f64, min_neighbors: usize) -> Self { - Self { tolerance_m, min_neighbors } - } - - /// Returns `true` if the GPS position is consistent with UWB ranging data. - pub fn is_gps_valid( - &self, - gps_position: &Position3D, - uwb_ranges: &[(NodeId, f64)], - neighbor_gps: &[(NodeId, Position3D)], - ) -> bool { - if uwb_ranges.len() < self.min_neighbors { - // Not enough UWB anchors to validate — allow through with warning - return true; - } - - let validated_count = uwb_ranges - .iter() - .filter_map(|(id, uwb_dist)| { - neighbor_gps - .iter() - .find(|(nid, _)| nid == id) - .map(|(_, ngps)| { - let gps_dist = gps_position.distance_to(ngps); - (gps_dist - uwb_dist).abs() <= self.tolerance_m - }) - }) - .filter(|&ok| ok) - .count(); - - // Require majority of ranges to be consistent - validated_count * 2 >= uwb_ranges.len() - } -} - -impl Default for UwbAntiSpoofing { - fn default() -> Self { - Self::new(2.0, 2) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_consistent_gps_valid() { - let anti = UwbAntiSpoofing::new(2.0, 2); - let gps = Position3D { x: 0.0, y: 0.0, z: 0.0 }; - let n1_pos = Position3D { x: 10.0, y: 0.0, z: 0.0 }; - let n2_pos = Position3D { x: 0.0, y: 10.0, z: 0.0 }; - let uwb_ranges = vec![(NodeId(1), 10.0), (NodeId(2), 10.0)]; - let neighbor_gps = vec![(NodeId(1), n1_pos), (NodeId(2), n2_pos)]; - assert!(anti.is_gps_valid(&gps, &uwb_ranges, &neighbor_gps)); - } - - #[test] - fn test_spoofed_gps_invalid() { - let anti = UwbAntiSpoofing::new(2.0, 2); - // GPS claims (0,0) but UWB says drone is 50m from both neighbours - let gps = Position3D { x: 0.0, y: 0.0, z: 0.0 }; - let n1_pos = Position3D { x: 10.0, y: 0.0, z: 0.0 }; - let n2_pos = Position3D { x: 0.0, y: 10.0, z: 0.0 }; - // UWB reports 50m but GPS only shows 10m — spoof detected - let uwb_ranges = vec![(NodeId(1), 50.0), (NodeId(2), 50.0)]; - let neighbor_gps = vec![(NodeId(1), n1_pos), (NodeId(2), n2_pos)]; - assert!(!anti.is_gps_valid(&gps, &uwb_ranges, &neighbor_gps)); - } -} diff --git a/v2/crates/ruview-swarm/src/sensing/mod.rs b/v2/crates/ruview-swarm/src/sensing/mod.rs deleted file mode 100644 index 07f5f1c6..00000000 --- a/v2/crates/ruview-swarm/src/sensing/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -pub mod payload; -pub mod multiview; -pub mod occworld_bridge; - -pub use payload::{CsiPayloadPipeline, PayloadConfig}; -pub use multiview::{MultiViewFusion, FusedDetection}; -pub use occworld_bridge::{OccWorldBridge, OccupancyPrior, VoxelCell}; diff --git a/v2/crates/ruview-swarm/src/sensing/multiview.rs b/v2/crates/ruview-swarm/src/sensing/multiview.rs deleted file mode 100644 index daa7f95b..00000000 --- a/v2/crates/ruview-swarm/src/sensing/multiview.rs +++ /dev/null @@ -1,237 +0,0 @@ -use crate::types::{NodeId, Position3D, CsiDetection}; - -/// A fused detection result from multiple drone viewpoints. -#[derive(Debug, Clone)] -pub struct FusedDetection { - pub confidence: f32, - pub estimated_position: Position3D, - pub contributing_drones: Vec, - /// Localization uncertainty ellipse (std dev in metres). - pub uncertainty_m: f64, -} - -/// Geometric diversity metric (Cramer-Rao bound proxy). -/// More diverse viewpoints -> lower bound -> better localization. -fn geometric_diversity_index(positions: &[Position3D]) -> f64 { - if positions.len() < 2 { - return 0.0; - } - // Compute average pairwise angular separation - let n = positions.len(); - let centroid = Position3D { - x: positions.iter().map(|p| p.x).sum::() / n as f64, - y: positions.iter().map(|p| p.y).sum::() / n as f64, - z: positions.iter().map(|p| p.z).sum::() / n as f64, - }; - - let mut total_angle = 0.0_f64; - let mut pairs = 0; - for i in 0..n { - for j in (i + 1)..n { - let a = (positions[i].x - centroid.x, positions[i].y - centroid.y); - let b = (positions[j].x - centroid.x, positions[j].y - centroid.y); - let dot = a.0 * b.0 + a.1 * b.1; - let mag_a = (a.0 * a.0 + a.1 * a.1).sqrt().max(1e-9); - let mag_b = (b.0 * b.0 + b.1 * b.1).sqrt().max(1e-9); - let cos_angle = (dot / (mag_a * mag_b)).clamp(-1.0, 1.0); - total_angle += cos_angle.acos(); - pairs += 1; - } - } - - if pairs > 0 { total_angle / pairs as f64 } else { 0.0 } -} - -/// Multi-drone CSI fusion via confidence-weighted position averaging with geometric bias. -pub struct MultiViewFusion { - /// Minimum number of independent viewpoints required to produce a fused result. - pub min_viewpoints: usize, - /// Minimum confidence of individual detections to include in fusion. - pub min_confidence: f32, -} - -impl Default for MultiViewFusion { - fn default() -> Self { - Self { min_viewpoints: 2, min_confidence: 0.5 } - } -} - -impl MultiViewFusion { - /// Fuse multiple CSI detections from different drone viewpoints. - /// Returns None if fewer than min_viewpoints pass the confidence threshold. - pub fn fuse( - &self, - detections: &[CsiDetection], - drone_positions: &[(NodeId, Position3D)], - ) -> Option { - // Filter by confidence and require a FINITE estimated position. - // - // A peer detection (received via `receive_peer_detection`) carries f32/f64 - // fields that can deserialize to NaN/Inf. A NaN `victim_position` passes - // `is_some()` and would propagate through the confidence-weighted average - // into the fused position — dispatching a NaN "confirmed victim" location - // to the swarm. A NaN `confidence` is already rejected by `>= min_confidence` - // (NaN comparisons are false), but we make that explicit and also require - // the victim position components to be finite. Fail CLOSED: drop poisoned - // detections rather than fusing them. - let valid: Vec<(&CsiDetection, &Position3D)> = detections - .iter() - .filter(|d| { - d.confidence.is_finite() - && d.confidence >= self.min_confidence - && d.victim_position - .map(|p| p.x.is_finite() && p.y.is_finite() && p.z.is_finite()) - .unwrap_or(false) - }) - .filter_map(|d| { - let drone_pos = drone_positions - .iter() - .find(|(id, _)| *id == d.drone_id) - .map(|(_, p)| p)?; - Some((d, drone_pos)) - }) - .collect(); - - if valid.len() < self.min_viewpoints { - return None; - } - - // Compute geometric diversity index for uncertainty estimate - let drone_pos_list: Vec = valid.iter().map(|(_, p)| **p).collect(); - let gdi = geometric_diversity_index(&drone_pos_list); - - // Weighted average of victim position estimates - let total_weight: f32 = valid.iter().map(|(d, _)| d.confidence).sum(); - let mut fused_x = 0.0_f64; - let mut fused_y = 0.0_f64; - let mut fused_z = 0.0_f64; - let mut fused_conf = 0.0_f32; - - for (det, _) in &valid { - let w = det.confidence / total_weight; - let vp = det.victim_position.unwrap(); - fused_x += w as f64 * vp.x; - fused_y += w as f64 * vp.y; - fused_z += w as f64 * vp.z; - fused_conf += w * det.confidence; - } - - // Uncertainty shrinks with geometric diversity and number of viewpoints: - // baseline 5 m (single drone) -> scales down by sqrt(n) and gdi factor - let base_uncertainty_m = 5.0; - let n = valid.len() as f64; - let gdi_factor = (1.0 + gdi / std::f64::consts::PI).clamp(1.0, 2.0); - let uncertainty_m = base_uncertainty_m / (n.sqrt() * gdi_factor); - - Some(FusedDetection { - confidence: fused_conf, - estimated_position: Position3D { x: fused_x, y: fused_y, z: fused_z }, - contributing_drones: valid.iter().map(|(d, _)| d.drone_id).collect(), - uncertainty_m, - }) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_fusion_single_view_insufficient() { - let fusion = MultiViewFusion { min_viewpoints: 2, min_confidence: 0.5 }; - let det = CsiDetection { - drone_id: NodeId(0), - confidence: 0.9, - victim_position: Some(Position3D { x: 10.0, y: 5.0, z: 0.0 }), - timestamp_ms: 0, - }; - let result = fusion.fuse(&[det], &[(NodeId(0), Position3D::zero())]); - assert!(result.is_none(), "single viewpoint should not produce fusion"); - } - - #[test] - fn test_fusion_three_views() { - let fusion = MultiViewFusion::default(); - let victim = Position3D { x: 50.0, y: 50.0, z: 0.0 }; - let detections = vec![ - CsiDetection { - drone_id: NodeId(0), - confidence: 0.85, - victim_position: Some(Position3D { x: 51.0, y: 49.0, z: 0.0 }), - timestamp_ms: 0, - }, - CsiDetection { - drone_id: NodeId(1), - confidence: 0.78, - victim_position: Some(Position3D { x: 49.0, y: 51.0, z: 0.0 }), - timestamp_ms: 0, - }, - CsiDetection { - drone_id: NodeId(2), - confidence: 0.92, - victim_position: Some(Position3D { x: 50.0, y: 50.0, z: 0.0 }), - timestamp_ms: 0, - }, - ]; - let positions = vec![ - (NodeId(0), Position3D { x: 0.0, y: 0.0, z: -30.0 }), - (NodeId(1), Position3D { x: 100.0, y: 0.0, z: -30.0 }), - (NodeId(2), Position3D { x: 50.0, y: 86.6, z: -30.0 }), // equilateral triangle - ]; - - let result = fusion.fuse(&detections, &positions).unwrap(); - let err = result.estimated_position.distance_to(&victim); - assert!( - err < 3.0, - "fusion error {} m should be < 3 m for 3 equilateral viewpoints", - err - ); - assert!( - result.uncertainty_m < 5.0, - "uncertainty {} should be < 5 m single-drone baseline", - result.uncertainty_m - ); - } - - /// Security: a detection with a NaN victim position (poisoned peer report) - /// must be dropped, not fused. Fails on old code where the NaN propagates - /// into the confidence-weighted average and the fused position is NaN. - #[test] - fn test_nan_victim_position_dropped_from_fusion() { - let fusion = MultiViewFusion { min_viewpoints: 2, min_confidence: 0.5 }; - let detections = vec![ - CsiDetection { - drone_id: NodeId(0), - confidence: 0.9, - victim_position: Some(Position3D { x: 50.0, y: 50.0, z: 0.0 }), - timestamp_ms: 0, - }, - CsiDetection { - drone_id: NodeId(1), - confidence: 0.9, - victim_position: Some(Position3D { x: f64::NAN, y: 50.0, z: 0.0 }), - timestamp_ms: 0, - }, - CsiDetection { - drone_id: NodeId(2), - confidence: 0.9, - victim_position: Some(Position3D { x: 50.0, y: 50.0, z: 0.0 }), - timestamp_ms: 0, - }, - ]; - let positions = vec![ - (NodeId(0), Position3D { x: 0.0, y: 0.0, z: -30.0 }), - (NodeId(1), Position3D { x: 100.0, y: 0.0, z: -30.0 }), - (NodeId(2), Position3D { x: 50.0, y: 86.6, z: -30.0 }), - ]; - // Two finite viewpoints remain → still fuses, but the result must be finite. - let result = fusion.fuse(&detections, &positions).unwrap(); - assert!( - result.estimated_position.x.is_finite() - && result.estimated_position.y.is_finite() - && result.estimated_position.z.is_finite(), - "fused position must be finite when a NaN detection is present" - ); - assert!(!result.contributing_drones.contains(&NodeId(1)), "NaN detection must be excluded"); - } -} diff --git a/v2/crates/ruview-swarm/src/sensing/occworld_bridge.rs b/v2/crates/ruview-swarm/src/sensing/occworld_bridge.rs deleted file mode 100644 index 9af48486..00000000 --- a/v2/crates/ruview-swarm/src/sensing/occworld_bridge.rs +++ /dev/null @@ -1,146 +0,0 @@ -//! Bridge between OccWorld Python subprocess (ADR-147) and the Rust swarm planner. -use crate::types::Position3D; -use std::path::PathBuf; - -/// A 3-D occupancy grid cell. -#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize)] -pub struct VoxelCell { - pub x: f32, - pub y: f32, - pub z: f32, - pub occupancy: f32, // 0.0 = free, 1.0 = occupied - pub semantic_class: u8, // 0=free, 1=wall, 2=floor, 3=person, 4=furniture -} - -/// Occupancy prior produced by OccWorld inference (ADR-147). -pub struct OccupancyPrior { - pub voxels: Vec, - pub resolution_m: f32, - pub origin: (f32, f32, f32), - pub timestamp_ms: u64, -} - -impl OccupancyPrior { - /// Extract free-space cells (occupancy < threshold) at a given altitude band. - /// Used by RRT* as valid sampling space. - pub fn free_cells_at_altitude(&self, target_z: f32, band_m: f32, threshold: f32) -> Vec<(f32, f32)> { - self.voxels - .iter() - .filter(|v| v.occupancy < threshold && (v.z - target_z).abs() < band_m) - .map(|v| (v.x, v.y)) - .collect() - } - - /// Extract occupied cells (walls, debris). Used as obstacles for path planning. - pub fn obstacle_cells(&self, threshold: f32) -> Vec { - self.voxels - .iter() - .filter(|v| v.occupancy >= threshold) - .map(|v| Position3D { x: v.x as f64, y: v.y as f64, z: v.z as f64 }) - .collect() - } - - /// Cells where a person voxel is predicted (semantic_class == 3). - /// Initializes the Bayesian probability grid with a prior. - pub fn person_cells(&self) -> Vec { - self.voxels - .iter() - .filter(|v| v.semantic_class == 3) - .map(|v| Position3D { x: v.x as f64, y: v.y as f64, z: v.z as f64 }) - .collect() - } - - /// Generate a synthetic 20 × 20 × 3 m room prior for demo mode. - /// - /// The room has wall voxels on the perimeter and free-space voxels in the - /// interior, at the requested voxel resolution. - pub fn synthetic_room(resolution_m: f32) -> Self { - let mut voxels = Vec::new(); - let room = 20.0f32; - let steps = (room / resolution_m) as i32; - for xi in 0..steps { - for yi in 0..steps { - for zi in 0..15i32 { // 3 m height (15 × 0.2 m slices) - let x = xi as f32 * resolution_m - room / 2.0; - let y = yi as f32 * resolution_m - room / 2.0; - let z = zi as f32 * resolution_m; - let is_wall = xi == 0 || xi == steps - 1 || yi == 0 || yi == steps - 1; - voxels.push(VoxelCell { - x, - y, - z, - occupancy: if is_wall { 1.0 } else { 0.0 }, - semantic_class: if is_wall { 1 } else if zi == 0 { 2 } else { 0 }, - }); - } - } - } - OccupancyPrior { voxels, resolution_m, origin: (0.0, 0.0, 0.0), timestamp_ms: 0 } - } -} - -/// Bridge to the OccWorld Python subprocess (ADR-147). -/// Provides 3-D occupancy priors for the RRT* path planner and the Bayesian -/// victim-probability grid. In demo mode, returns a synthetic room prior. -pub struct OccWorldBridge { - /// Path to the OccWorld Python script. - pub script_path: PathBuf, - /// Cache of the last inference result. - last_prior: Option, -} - -impl Default for OccWorldBridge { - fn default() -> Self { - Self { script_path: PathBuf::from("occworld_infer.py"), last_prior: None } - } -} - -impl OccWorldBridge { - pub fn new(script_path: PathBuf) -> Self { - Self { script_path, last_prior: None } - } - - /// Run a demo-mode inference using the synthetic room prior. - /// No subprocess is spawned; the result is immediately available. - pub async fn infer_demo(&mut self) -> &OccupancyPrior { - self.last_prior = Some(OccupancyPrior::synthetic_room(0.2)); - self.last_prior.as_ref().unwrap() - } - - /// Run OccWorld inference and return the occupancy prior. - /// In demo mode: returns a synthetic prior with configurable obstacles. - pub async fn infer(&mut self, demo_mode: bool) -> crate::SwarmResult<&OccupancyPrior> { - if demo_mode { - self.last_prior = Some(OccupancyPrior::synthetic_room(0.2)); - } else { - // Production: spawn Python subprocess, read JSON output. - // let output = tokio::process::Command::new("python3") - // .arg(&self.script_path) - // .arg("--mode=infer") - // .output().await?; - // parse JSON output into OccupancyPrior. - // Fallback to synthetic for now until subprocess integration is complete. - self.last_prior = Some(OccupancyPrior::synthetic_room(0.2)); - } - Ok(self.last_prior.as_ref().unwrap()) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_synthetic_room_has_walls() { - let prior = OccupancyPrior::synthetic_room(0.5); - let obstacles = prior.obstacle_cells(0.5); - assert!(!obstacles.is_empty(), "room should have wall voxels"); - } - - #[test] - fn test_free_cells_at_altitude() { - let prior = OccupancyPrior::synthetic_room(0.5); - let free = prior.free_cells_at_altitude(1.5, 0.5, 0.5); - assert!(!free.is_empty(), "room interior should have free cells"); - } -} diff --git a/v2/crates/ruview-swarm/src/sensing/payload.rs b/v2/crates/ruview-swarm/src/sensing/payload.rs deleted file mode 100644 index 8806d8bb..00000000 --- a/v2/crates/ruview-swarm/src/sensing/payload.rs +++ /dev/null @@ -1,137 +0,0 @@ -use crate::types::{NodeId, Position3D, CsiDetection}; - -/// Configuration for the onboard CSI sensing payload. -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] -pub struct PayloadConfig { - pub scan_freq_hz: f64, // 10.0 nominal, 20.0 during Phase 3 convergence - pub detection_range_m: f64, // ~28.0 m (Wi2SAR validated) - pub confidence_threshold: f32, // minimum confidence to report detection (0.6) - pub esp32_baud_rate: u32, // 921600 -} - -impl Default for PayloadConfig { - fn default() -> Self { - Self { - scan_freq_hz: 10.0, - detection_range_m: 28.0, - confidence_threshold: 0.6, - esp32_baud_rate: 921600, - } - } -} - -/// Represents the CSI sensing payload pipeline running on the drone's companion compute. -/// In production: reads from ESP32-S3 via serial TDM; runs CIR (ADR-134) -> RF encoder (ADR-146). -/// In demo/sim mode: generates synthetic detections. -pub struct CsiPayloadPipeline { - pub node_id: NodeId, - pub config: PayloadConfig, - mode: PipelineMode, -} - -// Fields in Live and Replay variants are unused until the serial/file backends are wired up. -#[allow(dead_code)] -enum PipelineMode { - /// Live pipeline: reads from serial port. - Live { port_path: String }, - /// Demo/simulation mode: synthetic CSI generation. - Synthetic { - victim_positions: Vec, - noise_std: f64, - rng_seed: u64, - }, - /// Replay mode: reads from recorded CSI file. - Replay { file_path: String, loop_replay: bool }, -} - -impl CsiPayloadPipeline { - pub fn new_live(node_id: NodeId, config: PayloadConfig, port: &str) -> Self { - Self { node_id, config, mode: PipelineMode::Live { port_path: port.to_string() } } - } - - pub fn new_synthetic( - node_id: NodeId, - config: PayloadConfig, - victims: Vec, - noise_std: f64, - seed: u64, - ) -> Self { - Self { - node_id, - config, - mode: PipelineMode::Synthetic { - victim_positions: victims, - noise_std, - rng_seed: seed, - }, - } - } - - pub fn new_replay(node_id: NodeId, config: PayloadConfig, path: &str, loop_replay: bool) -> Self { - Self { - node_id, - config, - mode: PipelineMode::Replay { - file_path: path.to_string(), - loop_replay, - }, - } - } - - /// Scan the current position and return a detection report (if any). - pub async fn scan(&self, drone_pos: &Position3D) -> Option { - match &self.mode { - PipelineMode::Synthetic { victim_positions, noise_std, rng_seed } => { - self.synthetic_scan(drone_pos, victim_positions, *noise_std, *rng_seed) - } - PipelineMode::Live { .. } => { - // Production: would read from serial port, run CIR+RF encoder pipeline - // For now: return None (requires hardware) - None - } - PipelineMode::Replay { .. } => { - // Production: would read from recorded file - None - } - } - } - - fn synthetic_scan( - &self, - drone_pos: &Position3D, - victims: &[Position3D], - noise_std: f64, - _seed: u64, - ) -> Option { - use rand::Rng; - let mut rng = rand::thread_rng(); - - for victim in victims { - let dist = drone_pos.distance_to(victim); - if dist < self.config.detection_range_m { - let base_confidence = (-dist / self.config.detection_range_m).exp(); - let noise: f64 = rng.gen_range(-noise_std..noise_std); - let confidence = (base_confidence + noise).clamp(0.0, 1.0) as f32; - - if confidence >= self.config.confidence_threshold { - let pos_noise_x: f64 = rng.gen_range(-noise_std * 5.0..noise_std * 5.0); - let pos_noise_y: f64 = rng.gen_range(-noise_std * 5.0..noise_std * 5.0); - return Some(CsiDetection { - drone_id: self.node_id, - confidence, - victim_position: Some(Position3D { - x: victim.x + pos_noise_x, - y: victim.y + pos_noise_y, - z: victim.z, - }), - timestamp_ms: std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .map(|d| d.as_millis() as u64) - .unwrap_or(0), - }); - } - } - } - None - } -} diff --git a/v2/crates/ruview-swarm/src/topology/gossip.rs b/v2/crates/ruview-swarm/src/topology/gossip.rs deleted file mode 100644 index 350f2154..00000000 --- a/v2/crates/ruview-swarm/src/topology/gossip.rs +++ /dev/null @@ -1,78 +0,0 @@ -//! Gossip-based state dissemination for the swarm. - -use crate::types::NodeId; -use rand::seq::SliceRandom; -use serde::{Deserialize, Serialize}; - -/// A gossip-propagated state value with versioning. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct GossipState { - pub value: T, - pub version: u64, - pub origin: NodeId, - pub timestamp_ms: u64, -} - -impl GossipState { - pub fn new(value: T, origin: NodeId, timestamp_ms: u64) -> Self { - Self { value, version: 1, origin, timestamp_ms } - } - - /// Last-write-wins merge: higher version wins; ties go to higher origin id. - pub fn merge(a: GossipState, b: GossipState) -> GossipState { - if a.version > b.version { - a - } else if b.version > a.version { - b - } else if a.origin.0 >= b.origin.0 { - a - } else { - b - } - } - - /// Increment the version (call when mutating a local copy before gossiping). - pub fn bump(&mut self) { - self.version += 1; - } - - /// Choose `fanout` random peer IDs to spread this state to, excluding the - /// local node and the origin to avoid trivial loops. - pub fn spread( - &self, - fanout: usize, - all_peers: &[NodeId], - local_id: NodeId, - rng: &mut impl rand::Rng, - ) -> Vec { - let mut candidates: Vec = all_peers - .iter() - .copied() - .filter(|&n| n != local_id && n != self.origin) - .collect(); - candidates.shuffle(rng); - candidates.truncate(fanout); - candidates - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_merge_higher_version_wins() { - let a: GossipState = GossipState { value: 1, version: 2, origin: NodeId(1), timestamp_ms: 0 }; - let b: GossipState = GossipState { value: 2, version: 5, origin: NodeId(2), timestamp_ms: 0 }; - let merged = GossipState::merge(a, b); - assert_eq!(merged.value, 2); - } - - #[test] - fn test_merge_tie_higher_origin_wins() { - let a: GossipState = GossipState { value: 10, version: 3, origin: NodeId(5), timestamp_ms: 0 }; - let b: GossipState = GossipState { value: 20, version: 3, origin: NodeId(2), timestamp_ms: 0 }; - let merged = GossipState::merge(a, b); - assert_eq!(merged.value, 10); // origin 5 > 2 - } -} diff --git a/v2/crates/ruview-swarm/src/topology/mesh.rs b/v2/crates/ruview-swarm/src/topology/mesh.rs deleted file mode 100644 index 814afe71..00000000 --- a/v2/crates/ruview-swarm/src/topology/mesh.rs +++ /dev/null @@ -1,84 +0,0 @@ -//! Mesh topology: maintains a live view of all drone nodes. - -use crate::types::{DroneState, NodeId}; -use std::collections::HashMap; - -/// Hierarchical-mesh topology view. -pub struct MeshTopology { - pub nodes: HashMap, - pub cluster_head: Option, -} - -impl MeshTopology { - pub fn new() -> Self { - Self { - nodes: HashMap::new(), - cluster_head: None, - } - } - - /// Upsert a node's state. - pub fn update_node(&mut self, state: DroneState) { - self.nodes.insert(state.id, state); - } - - /// Remove a node (e.g. on dropout). - pub fn remove_node(&mut self, id: &NodeId) { - self.nodes.remove(id); - if self.cluster_head == Some(*id) { - self.cluster_head = None; - } - } - - /// All active nodes (sorted by id for determinism). - pub fn active_nodes(&self) -> Vec<&DroneState> { - let mut v: Vec<_> = self.nodes.values().collect(); - v.sort_by_key(|s| s.id.0); - v - } - - /// Returns the `k` nearest nodes to `from`, sorted ascending by distance. - pub fn nearest_k(&self, from: NodeId, k: usize) -> Vec { - if let Some(origin) = self.nodes.get(&from) { - let mut distances: Vec<(f64, NodeId)> = self - .nodes - .iter() - .filter(|(&id, _)| id != from) - .map(|(&id, s)| (origin.position.distance_to(&s.position), id)) - .collect(); - distances.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap_or(std::cmp::Ordering::Equal)); - distances.truncate(k); - distances.into_iter().map(|(_, id)| id).collect() - } else { - vec![] - } - } -} - -impl Default for MeshTopology { - fn default() -> Self { - Self::new() - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::types::Position3D; - - #[test] - fn test_nearest_k() { - let mut topo = MeshTopology::new(); - let mut s0 = DroneState::default_at_origin(NodeId(0)); - s0.position = Position3D { x: 0.0, y: 0.0, z: 0.0 }; - let mut s1 = DroneState::default_at_origin(NodeId(1)); - s1.position = Position3D { x: 10.0, y: 0.0, z: 0.0 }; - let mut s2 = DroneState::default_at_origin(NodeId(2)); - s2.position = Position3D { x: 5.0, y: 0.0, z: 0.0 }; - topo.update_node(s0); - topo.update_node(s1); - topo.update_node(s2); - let nearest = topo.nearest_k(NodeId(0), 1); - assert_eq!(nearest, vec![NodeId(2)]); - } -} diff --git a/v2/crates/ruview-swarm/src/topology/mod.rs b/v2/crates/ruview-swarm/src/topology/mod.rs deleted file mode 100644 index 1d958e87..00000000 --- a/v2/crates/ruview-swarm/src/topology/mod.rs +++ /dev/null @@ -1,13 +0,0 @@ -//! Swarm topology: Raft consensus, gossip dissemination, mesh management. - -// NOTE: Raft consensus is ITAR-controlled (USML Category VIII(h)(12)). -// Gossip and mesh are ungated — they are not controlled technologies. -#[cfg(feature = "itar-unrestricted")] -pub mod raft; -pub mod gossip; -pub mod mesh; - -#[cfg(feature = "itar-unrestricted")] -pub use raft::{RaftConfig, RaftNode, RaftRole}; -pub use gossip::GossipState; -pub use mesh::MeshTopology; diff --git a/v2/crates/ruview-swarm/src/topology/raft.rs b/v2/crates/ruview-swarm/src/topology/raft.rs deleted file mode 100644 index 30f947e2..00000000 --- a/v2/crates/ruview-swarm/src/topology/raft.rs +++ /dev/null @@ -1,254 +0,0 @@ -//! Raft-based cluster-head election for drone swarms. - -use crate::types::{DroneState, NodeId}; -use serde::{Deserialize, Serialize}; -use std::time::Duration; - -/// Configuration for the Raft consensus engine. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct RaftConfig { - pub election_timeout_ms: u64, - pub heartbeat_ms: u64, - pub min_battery_pct: f32, - pub min_link_quality: f32, -} - -impl Default for RaftConfig { - fn default() -> Self { - Self { - election_timeout_ms: 300, - heartbeat_ms: 100, - min_battery_pct: 20.0, - min_link_quality: 0.4, - } - } -} - -/// Role within the Raft cluster. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum RaftRole { - Follower, - Candidate, - Leader, -} - -/// A log entry stored by the Raft leader. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct LogEntry { - pub term: u64, - pub data: Vec, -} - -/// Messages exchanged between Raft peers. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub enum RaftMessage { - RequestVote { - term: u64, - candidate_id: NodeId, - last_log_index: u64, - last_log_term: u64, - }, - VoteGranted { - term: u64, - voter_id: NodeId, - granted: bool, - }, - AppendEntries { - term: u64, - leader_id: NodeId, - prev_log_index: u64, - prev_log_term: u64, - entries: Vec, - leader_commit: u64, - }, - AppendEntriesAck { - term: u64, - follower_id: NodeId, - success: bool, - match_index: u64, - }, -} - -/// A Raft node driving cluster-head election within a swarm cluster. -pub struct RaftNode { - pub id: NodeId, - pub role: RaftRole, - pub current_term: u64, - pub voted_for: Option, - pub log: Vec, - pub commit_index: u64, - pub config: RaftConfig, - /// Votes received as candidate. - votes_received: u32, - /// Elapsed time since last heartbeat/election-timeout reset (ms). - elapsed_since_last_event_ms: u64, -} - -impl RaftNode { - pub fn new(id: NodeId, config: RaftConfig) -> Self { - Self { - id, - role: RaftRole::Follower, - current_term: 0, - voted_for: None, - log: Vec::new(), - commit_index: 0, - config, - votes_received: 0, - elapsed_since_last_event_ms: 0, - } - } - - /// Check whether a drone is eligible to become cluster head. - pub fn is_eligible_leader(state: &DroneState, config: &RaftConfig) -> bool { - state.battery_pct >= config.min_battery_pct - && state.link_quality >= config.min_link_quality - } - - /// Drive the Raft state machine by one time step. - /// Returns a message to broadcast if an election event fires. - pub fn tick(&mut self, elapsed: Duration, peers: &[DroneState]) -> Option { - let elapsed_ms = elapsed.as_millis() as u64; - self.elapsed_since_last_event_ms += elapsed_ms; - - match self.role { - RaftRole::Leader => { - if self.elapsed_since_last_event_ms >= self.config.heartbeat_ms { - self.elapsed_since_last_event_ms = 0; - let last_index = self.log.len() as u64; - let last_term = self.log.last().map(|e| e.term).unwrap_or(0); - return Some(RaftMessage::AppendEntries { - term: self.current_term, - leader_id: self.id, - prev_log_index: last_index, - prev_log_term: last_term, - entries: vec![], - leader_commit: self.commit_index, - }); - } - None - } - RaftRole::Follower | RaftRole::Candidate => { - if self.elapsed_since_last_event_ms >= self.config.election_timeout_ms { - self.elapsed_since_last_event_ms = 0; - self.current_term += 1; - self.role = RaftRole::Candidate; - self.voted_for = Some(self.id); - self.votes_received = 1; - - let last_index = self.log.len() as u64; - let last_term = self.log.last().map(|e| e.term).unwrap_or(0); - let quorum = (peers.len() / 2 + 1) as u32; - // Immediately win if quorum of 1 (single node) - if quorum <= 1 { - self.role = RaftRole::Leader; - } - return Some(RaftMessage::RequestVote { - term: self.current_term, - candidate_id: self.id, - last_log_index: last_index, - last_log_term: last_term, - }); - } - None - } - } - } - - /// Process an incoming Raft message and optionally produce a reply. - pub fn handle_message(&mut self, msg: RaftMessage) -> Option { - match msg { - RaftMessage::RequestVote { term, candidate_id, .. } => { - if term > self.current_term { - self.current_term = term; - self.role = RaftRole::Follower; - self.voted_for = None; - } - let vote_granted = term >= self.current_term - && (self.voted_for.is_none() || self.voted_for == Some(candidate_id)); - if vote_granted { - self.voted_for = Some(candidate_id); - self.elapsed_since_last_event_ms = 0; - } - Some(RaftMessage::VoteGranted { - term: self.current_term, - voter_id: self.id, - granted: vote_granted, - }) - } - RaftMessage::VoteGranted { term, granted, .. } => { - if term == self.current_term && self.role == RaftRole::Candidate && granted { - self.votes_received += 1; - // Assume we know how many peers there are via a simple threshold - // The caller is responsible for passing all peer votes - } - None - } - RaftMessage::AppendEntries { term, leader_id: _, entries, leader_commit, .. } => { - if term >= self.current_term { - self.current_term = term; - self.role = RaftRole::Follower; - self.voted_for = None; - self.elapsed_since_last_event_ms = 0; - for entry in entries { - self.log.push(entry); - } - if leader_commit > self.commit_index { - self.commit_index = leader_commit.min(self.log.len() as u64); - } - let match_index = self.log.len() as u64; - return Some(RaftMessage::AppendEntriesAck { - term: self.current_term, - follower_id: self.id, - success: true, - match_index, - }); - } - Some(RaftMessage::AppendEntriesAck { - term: self.current_term, - follower_id: self.id, - success: false, - match_index: self.log.len() as u64, - }) - } - RaftMessage::AppendEntriesAck { .. } => None, - } - } - - /// Promote to leader once quorum reached. Called by orchestrator. - pub fn try_promote(&mut self, cluster_size: usize) { - if self.role == RaftRole::Candidate { - let quorum = (cluster_size / 2 + 1) as u32; - if self.votes_received >= quorum { - self.role = RaftRole::Leader; - } - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::types::DroneState; - - #[test] - fn test_eligibility_check() { - let config = RaftConfig::default(); - let mut state = DroneState::default_at_origin(NodeId(1)); - state.battery_pct = 50.0; - state.link_quality = 0.9; - assert!(RaftNode::is_eligible_leader(&state, &config)); - - state.battery_pct = 5.0; - assert!(!RaftNode::is_eligible_leader(&state, &config)); - } - - #[test] - fn test_election_starts_after_timeout() { - let config = RaftConfig { election_timeout_ms: 100, ..Default::default() }; - let mut node = RaftNode::new(NodeId(1), config); - let result = node.tick(Duration::from_millis(200), &[]); - assert!(result.is_some()); - assert_eq!(node.role, RaftRole::Leader); // single node wins immediately - } -} diff --git a/v2/crates/ruview-swarm/src/types.rs b/v2/crates/ruview-swarm/src/types.rs deleted file mode 100644 index b4245e29..00000000 --- a/v2/crates/ruview-swarm/src/types.rs +++ /dev/null @@ -1,178 +0,0 @@ -//! Core domain types for the swarm control system. - -use serde::{Deserialize, Serialize}; - -/// Unique identifier for a drone node in the swarm. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] -pub struct NodeId(pub u32); - -/// Unique identifier for a swarm cluster. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] -pub struct ClusterId(pub u32); - -/// Unique identifier for a swarm task. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] -pub struct TaskId(pub u64); - -/// 3-D position in local NED (North-East-Down) frame, metres. -#[derive(Debug, Clone, Copy, Serialize, Deserialize, Default, PartialEq)] -pub struct Position3D { - pub x: f64, // north, m - pub y: f64, // east, m - pub z: f64, // down, m (negative = above ground) -} - -impl Position3D { - pub fn distance_to(&self, other: &Position3D) -> f64 { - let dx = self.x - other.x; - let dy = self.y - other.y; - let dz = self.z - other.z; - (dx * dx + dy * dy + dz * dz).sqrt() - } - - pub fn zero() -> Self { - Self { x: 0.0, y: 0.0, z: 0.0 } - } -} - -/// Velocity in local NED frame, m/s. -#[derive(Debug, Clone, Copy, Serialize, Deserialize, Default)] -pub struct Velocity3D { - pub vx: f64, - pub vy: f64, - pub vz: f64, -} - -impl Velocity3D { - pub fn magnitude(&self) -> f64 { - (self.vx * self.vx + self.vy * self.vy + self.vz * self.vz).sqrt() - } -} - -impl From<(f64, f64, f64)> for Position3D { - fn from(t: (f64, f64, f64)) -> Self { - Self { x: t.0, y: t.1, z: t.2 } - } -} - -impl From for Position3D { - fn from(v: Velocity3D) -> Self { - Self { x: v.vx, y: v.vy, z: v.vz } - } -} - -/// Full kinematic state of a drone node. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct DroneState { - pub id: NodeId, - pub position: Position3D, - pub velocity: Velocity3D, - pub heading_rad: f64, - pub altitude_agl_m: f64, - pub battery_pct: f32, // 0.0–100.0 - pub link_quality: f32, // 0.0–1.0 (RSSI normalised) - pub timestamp_ms: u64, -} - -impl DroneState { - /// Construct a default state for a node at the origin. - pub fn default_at_origin(id: NodeId) -> Self { - Self { - id, - position: Position3D::zero(), - velocity: Velocity3D::default(), - heading_rad: 0.0, - altitude_agl_m: 0.0, - battery_pct: 100.0, - link_quality: 1.0, - timestamp_ms: 0, - } - } -} - -/// CSI detection report from a drone's sensing payload. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct CsiDetection { - pub drone_id: NodeId, - pub confidence: f32, // 0.0–1.0 - pub victim_position: Option, - pub timestamp_ms: u64, -} - -/// A cell in the 2-D mission area probability grid. -#[derive(Debug, Clone, Copy, Serialize, Deserialize, Default)] -pub struct GridCell { - pub x_idx: u32, - pub y_idx: u32, - pub victim_probability: f32, // Bayesian posterior - pub pheromone: f32, // stigmergic coverage signal - pub last_scanned_ms: u64, -} - -/// Mission-level task that can be assigned to a drone. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct SwarmTask { - pub id: TaskId, - pub kind: TaskKind, - pub priority: f32, - pub target: Position3D, - pub deadline_ms: Option, - pub assigned_to: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub enum TaskKind { - CoverCell { grid_x: u32, grid_y: u32 }, - InvestigateVictim { estimated_position: Position3D }, - Triangulate { collaborators: Vec }, - ReturnToHome, - HoverRelay, - LandEmergency, -} - -/// Role of a node within the hierarchical swarm. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum SwarmRole { - ClusterHead, - Worker, - RelayNode, - GroundControlStation, -} - -/// Failsafe state alias re-exported from failsafe module. -/// Used here to break circular dependency. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub enum FailSafeState { - Nominal, - AutonomousHold, - LowBatteryWarn, - ReturnToHome, - EmergencyLand, - EmergencyDiverge, - ControlledDescent, -} - -/// Top-level swarm error type. -#[derive(Debug, thiserror::Error)] -pub enum SwarmError { - #[error("consensus error: {0}")] - Consensus(String), - #[error("communication error: {0}")] - Communication(String), - #[error("navigation error: {0}")] - Navigation(String), - #[error("security violation: {0}")] - Security(String), - #[error("geofence breach at {position:?}")] - GeofenceBreach { position: Position3D }, - #[error("task allocation failed: {0}")] - Allocation(String), - #[error("sensing error: {0}")] - Sensing(String), - #[error("config error: {0}")] - Config(#[from] toml::de::Error), - #[error("io error: {0}")] - Io(#[from] std::io::Error), -} - -pub type SwarmResult = Result; diff --git a/v2/crates/ruview-swarm/viz/sample_levy.jsonl b/v2/crates/ruview-swarm/viz/sample_levy.jsonl deleted file mode 100644 index 69897956..00000000 --- a/v2/crates/ruview-swarm/viz/sample_levy.jsonl +++ /dev/null @@ -1,161 +0,0 @@ -{"type":"meta","profile":"sar · flight=levy_flight · learn=curiosity","drones":4,"area_w":400.00,"area_h":400.00,"victims":[[80.00,120.00],[240.00,180.00]]} -{"type":"episode","ep":0,"mean_return":40.6910,"policy_loss":15.2719,"value_loss":12032.7422,"victims_found":0} -{"type":"episode","ep":1,"mean_return":40.6910,"policy_loss":-6.7265,"value_loss":11992.9619,"victims_found":0} -{"type":"episode","ep":2,"mean_return":40.6910,"policy_loss":-28.3518,"value_loss":11954.5889,"victims_found":0} -{"type":"episode","ep":3,"mean_return":40.6910,"policy_loss":-50.8272,"value_loss":11913.7246,"victims_found":0} -{"type":"episode","ep":4,"mean_return":40.6910,"policy_loss":-75.4711,"value_loss":11870.9639,"victims_found":0} -{"type":"episode","ep":5,"mean_return":40.6910,"policy_loss":-102.5510,"value_loss":11825.7627,"victims_found":0} -{"type":"episode","ep":6,"mean_return":40.6910,"policy_loss":-132.1274,"value_loss":11776.8301,"victims_found":0} -{"type":"episode","ep":7,"mean_return":40.6910,"policy_loss":-163.8047,"value_loss":11723.4932,"victims_found":0} -{"type":"episode","ep":8,"mean_return":40.6910,"policy_loss":-198.6059,"value_loss":11663.5625,"victims_found":0} -{"type":"episode","ep":9,"mean_return":40.6910,"policy_loss":-238.1701,"value_loss":11596.6914,"victims_found":0} -{"type":"episode","ep":10,"mean_return":40.6910,"policy_loss":-284.1328,"value_loss":11522.3838,"victims_found":0} -{"type":"episode","ep":11,"mean_return":40.6910,"policy_loss":-336.2621,"value_loss":11440.9395,"victims_found":0} -{"type":"episode","ep":12,"mean_return":40.6910,"policy_loss":-395.5074,"value_loss":11352.6396,"victims_found":0} -{"type":"episode","ep":13,"mean_return":40.6910,"policy_loss":-463.2714,"value_loss":11257.4121,"victims_found":0} -{"type":"episode","ep":14,"mean_return":40.6910,"policy_loss":-539.9746,"value_loss":11156.9658,"victims_found":0} -{"type":"episode","ep":15,"mean_return":40.6910,"policy_loss":-626.7112,"value_loss":11052.9521,"victims_found":0} -{"type":"episode","ep":16,"mean_return":40.6910,"policy_loss":-724.2371,"value_loss":10946.5713,"victims_found":0} -{"type":"episode","ep":17,"mean_return":40.6910,"policy_loss":-835.2675,"value_loss":10841.5166,"victims_found":0} -{"type":"episode","ep":18,"mean_return":40.6910,"policy_loss":-960.2383,"value_loss":10738.6182,"victims_found":0} -{"type":"step","ep":19,"step":0,"t":0.00,"coverage":0.0148,"drones":[{"id":0,"x":17.05,"y":13.77,"hdg":0.491,"batt":100.0,"det":false},{"id":1,"x":213.61,"y":17.14,"hdg":1.102,"batt":100.0,"det":false},{"id":2,"x":8.93,"y":217.93,"hdg":1.706,"batt":100.0,"det":false},{"id":3,"x":204.53,"y":215.83,"hdg":2.325,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":1,"t":1.00,"coverage":0.0202,"drones":[{"id":0,"x":10.79,"y":18.75,"hdg":2.471,"batt":100.0,"det":false},{"id":1,"x":206.36,"y":13.76,"hdg":-2.706,"batt":100.0,"det":false},{"id":2,"x":7.50,"y":210.06,"hdg":-1.750,"batt":100.0,"det":false},{"id":3,"x":205.22,"y":207.86,"hdg":-1.484,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":2,"t":2.00,"coverage":0.0227,"drones":[{"id":0,"x":18.00,"y":15.28,"hdg":-0.448,"batt":100.0,"det":false},{"id":1,"x":214.15,"y":11.93,"hdg":-0.231,"batt":100.0,"det":false},{"id":2,"x":14.93,"y":213.03,"hdg":0.380,"batt":100.0,"det":false},{"id":3,"x":210.75,"y":213.64,"hdg":0.807,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":3,"t":3.00,"coverage":0.0239,"drones":[{"id":0,"x":17.50,"y":23.27,"hdg":1.633,"batt":100.0,"det":false},{"id":1,"x":210.28,"y":18.94,"hdg":2.075,"batt":100.0,"det":false},{"id":2,"x":8.58,"y":217.89,"hdg":2.488,"batt":100.0,"det":false},{"id":3,"x":203.17,"y":211.09,"hdg":-2.817,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":4,"t":4.00,"coverage":0.0242,"drones":[{"id":0,"x":12.69,"y":16.87,"hdg":-2.216,"batt":100.0,"det":false},{"id":1,"x":210.61,"y":10.94,"hdg":-1.530,"batt":100.0,"det":false},{"id":2,"x":13.21,"y":211.37,"hdg":-0.953,"batt":100.0,"det":false},{"id":3,"x":210.71,"y":208.41,"hdg":-0.342,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":5,"t":5.00,"coverage":0.0253,"drones":[{"id":0,"x":20.33,"y":19.24,"hdg":0.300,"batt":100.0,"det":false},{"id":1,"x":215.51,"y":17.26,"hdg":0.911,"batt":100.0,"det":false},{"id":2,"x":13.60,"y":219.36,"hdg":1.522,"batt":100.0,"det":false},{"id":3,"x":206.44,"y":215.18,"hdg":2.133,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":6,"t":6.00,"coverage":0.0253,"drones":[{"id":0,"x":13.41,"y":23.24,"hdg":2.618,"batt":100.0,"det":false},{"id":1,"x":207.75,"y":15.33,"hdg":-2.897,"batt":100.0,"det":false},{"id":2,"x":9.45,"y":212.53,"hdg":-2.117,"batt":100.0,"det":false},{"id":3,"x":205.61,"y":207.22,"hdg":-1.675,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":7,"t":7.00,"coverage":0.0256,"drones":[{"id":0,"x":17.81,"y":16.56,"hdg":-0.988,"batt":100.0,"det":false},{"id":1,"x":215.27,"y":12.60,"hdg":-0.347,"batt":100.0,"det":false},{"id":2,"x":17.30,"y":214.03,"hdg":0.189,"batt":100.0,"det":false},{"id":3,"x":211.19,"y":212.96,"hdg":0.800,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":8,"t":8.00,"coverage":0.0264,"drones":[{"id":0,"x":18.85,"y":24.49,"hdg":1.441,"batt":100.0,"det":false},{"id":1,"x":211.56,"y":19.69,"hdg":2.053,"batt":100.0,"det":false},{"id":2,"x":14.49,"y":221.52,"hdg":1.930,"batt":100.0,"det":false},{"id":3,"x":203.26,"y":211.89,"hdg":-3.008,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":9,"t":9.00,"coverage":0.0264,"drones":[{"id":0,"x":13.97,"y":18.15,"hdg":-2.227,"batt":100.0,"det":false},{"id":1,"x":209.04,"y":12.10,"hdg":-1.891,"batt":100.0,"det":false},{"id":2,"x":17.80,"y":214.23,"hdg":-1.144,"batt":100.0,"det":false},{"id":3,"x":210.15,"y":207.83,"hdg":-0.533,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":10,"t":10.00,"coverage":0.0272,"drones":[{"id":0,"x":21.92,"y":19.02,"hdg":0.109,"batt":100.0,"det":false},{"id":1,"x":215.06,"y":17.37,"hdg":0.720,"batt":100.0,"det":false},{"id":2,"x":19.70,"y":222.00,"hdg":1.331,"batt":100.0,"det":false},{"id":3,"x":207.25,"y":215.28,"hdg":1.942,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":11,"t":11.00,"coverage":0.0273,"drones":[{"id":0,"x":17.11,"y":25.41,"hdg":2.216,"batt":100.0,"det":false},{"id":1,"x":207.07,"y":16.95,"hdg":-3.089,"batt":100.0,"det":false},{"id":2,"x":15.06,"y":215.49,"hdg":-2.189,"batt":100.0,"det":false},{"id":3,"x":204.91,"y":207.63,"hdg":-1.866,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":12,"t":12.00,"coverage":0.0278,"drones":[{"id":0,"x":21.28,"y":18.59,"hdg":-1.022,"batt":100.0,"det":false},{"id":1,"x":215.04,"y":16.23,"hdg":-0.090,"batt":100.0,"det":false},{"id":2,"x":23.06,"y":215.47,"hdg":-0.002,"batt":100.0,"det":false},{"id":3,"x":211.48,"y":212.20,"hdg":0.609,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":13,"t":13.00,"coverage":0.0289,"drones":[{"id":0,"x":23.80,"y":26.18,"hdg":1.250,"batt":100.0,"det":false},{"id":1,"x":212.75,"y":23.89,"hdg":1.861,"batt":100.0,"det":false},{"id":2,"x":17.22,"y":220.93,"hdg":2.389,"batt":100.0,"det":false},{"id":3,"x":203.49,"y":212.67,"hdg":3.084,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":14,"t":14.00,"coverage":0.0291,"drones":[{"id":0,"x":17.61,"y":21.12,"hdg":-2.457,"batt":100.0,"det":false},{"id":1,"x":207.02,"y":18.31,"hdg":-2.369,"batt":100.0,"det":false},{"id":2,"x":19.09,"y":213.15,"hdg":-1.336,"batt":100.0,"det":false},{"id":3,"x":209.48,"y":207.36,"hdg":-0.725,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":15,"t":15.00,"coverage":0.0294,"drones":[{"id":0,"x":25.58,"y":20.46,"hdg":-0.083,"batt":100.0,"det":false},{"id":1,"x":213.93,"y":22.34,"hdg":0.528,"batt":100.0,"det":false},{"id":2,"x":22.43,"y":220.42,"hdg":1.139,"batt":100.0,"det":false},{"id":3,"x":208.05,"y":215.24,"hdg":1.750,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":16,"t":16.00,"coverage":0.0297,"drones":[{"id":0,"x":19.72,"y":25.91,"hdg":2.392,"batt":100.0,"det":false},{"id":1,"x":206.00,"y":23.44,"hdg":3.003,"batt":100.0,"det":false},{"id":2,"x":20.23,"y":212.73,"hdg":-1.849,"batt":100.0,"det":false},{"id":3,"x":204.31,"y":208.17,"hdg":-2.058,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":17,"t":17.00,"coverage":0.0306,"drones":[{"id":0,"x":25.88,"y":20.79,"hdg":-0.693,"batt":100.0,"det":false},{"id":1,"x":212.03,"y":18.18,"hdg":-0.718,"batt":100.0,"det":false},{"id":2,"x":28.08,"y":211.19,"hdg":-0.194,"batt":100.0,"det":false},{"id":3,"x":211.62,"y":211.41,"hdg":0.417,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":18,"t":18.00,"coverage":0.0319,"drones":[{"id":0,"x":29.79,"y":27.77,"hdg":1.059,"batt":100.0,"det":false},{"id":1,"x":211.23,"y":26.14,"hdg":1.670,"batt":100.0,"det":false},{"id":2,"x":24.04,"y":218.09,"hdg":2.101,"batt":100.0,"det":false},{"id":3,"x":203.87,"y":213.38,"hdg":2.892,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":19,"t":19.00,"coverage":0.0320,"drones":[{"id":0,"x":23.66,"y":22.63,"hdg":-2.444,"batt":100.0,"det":false},{"id":1,"x":206.90,"y":19.41,"hdg":-2.143,"batt":100.0,"det":false},{"id":2,"x":24.39,"y":210.10,"hdg":-1.527,"batt":100.0,"det":false},{"id":3,"x":208.74,"y":207.04,"hdg":-0.916,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":20,"t":20.00,"coverage":0.0331,"drones":[{"id":0,"x":31.36,"y":20.46,"hdg":-0.274,"batt":100.0,"det":false},{"id":1,"x":214.45,"y":22.06,"hdg":0.337,"batt":100.0,"det":false},{"id":2,"x":29.05,"y":216.59,"hdg":0.948,"batt":100.0,"det":false},{"id":3,"x":208.84,"y":215.04,"hdg":1.559,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":21,"t":21.00,"coverage":0.0333,"drones":[{"id":0,"x":26.65,"y":26.93,"hdg":2.201,"batt":100.0,"det":false},{"id":1,"x":206.88,"y":24.65,"hdg":2.812,"batt":100.0,"det":false},{"id":2,"x":21.53,"y":213.88,"hdg":-2.795,"batt":100.0,"det":false},{"id":3,"x":203.82,"y":208.81,"hdg":-2.249,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":22,"t":22.00,"coverage":0.0338,"drones":[{"id":0,"x":26.23,"y":18.94,"hdg":-1.623,"batt":100.0,"det":false},{"id":1,"x":213.94,"y":20.88,"hdg":-0.491,"batt":100.0,"det":false},{"id":2,"x":28.94,"y":210.87,"hdg":-0.385,"batt":100.0,"det":false},{"id":3,"x":211.61,"y":210.60,"hdg":0.226,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":23,"t":23.00,"coverage":0.0345,"drones":[{"id":0,"x":31.41,"y":25.04,"hdg":0.868,"batt":100.0,"det":false},{"id":1,"x":214.68,"y":28.84,"hdg":1.479,"batt":100.0,"det":false},{"id":2,"x":24.98,"y":217.82,"hdg":2.090,"batt":100.0,"det":false},{"id":3,"x":204.38,"y":214.01,"hdg":2.701,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":24,"t":24.00,"coverage":0.0347,"drones":[{"id":0,"x":23.57,"y":23.44,"hdg":-2.941,"batt":100.0,"det":false},{"id":1,"x":208.55,"y":23.71,"hdg":-2.444,"batt":100.0,"det":false},{"id":2,"x":23.80,"y":209.91,"hdg":-1.718,"batt":100.0,"det":false},{"id":3,"x":207.95,"y":206.86,"hdg":-1.107,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":25,"t":25.00,"coverage":0.0347,"drones":[{"id":0,"x":30.72,"y":19.85,"hdg":-0.466,"batt":100.0,"det":false},{"id":1,"x":216.46,"y":24.87,"hdg":0.145,"batt":100.0,"det":false},{"id":2,"x":29.62,"y":215.40,"hdg":0.757,"batt":100.0,"det":false},{"id":3,"x":209.57,"y":214.69,"hdg":1.368,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":26,"t":26.00,"coverage":0.0348,"drones":[{"id":0,"x":28.91,"y":27.65,"hdg":1.799,"batt":100.0,"det":false},{"id":1,"x":209.52,"y":28.85,"hdg":2.620,"batt":100.0,"det":false},{"id":2,"x":21.83,"y":213.54,"hdg":-2.908,"batt":100.0,"det":false},{"id":3,"x":203.45,"y":209.53,"hdg":-2.441,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":27,"t":27.00,"coverage":0.0348,"drones":[{"id":0,"x":24.44,"y":21.01,"hdg":-2.163,"batt":100.0,"det":false},{"id":1,"x":212.71,"y":21.51,"hdg":-1.161,"batt":100.0,"det":false},{"id":2,"x":28.54,"y":209.18,"hdg":-0.577,"batt":100.0,"det":false},{"id":3,"x":211.45,"y":209.81,"hdg":0.034,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":28,"t":28.00,"coverage":0.0348,"drones":[{"id":0,"x":30.68,"y":26.01,"hdg":0.676,"batt":100.0,"det":false},{"id":1,"x":214.95,"y":29.19,"hdg":1.287,"batt":100.0,"det":false},{"id":2,"x":25.97,"y":216.76,"hdg":1.898,"batt":100.0,"det":false},{"id":3,"x":205.50,"y":215.16,"hdg":2.409,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":29,"t":29.00,"coverage":0.0348,"drones":[{"id":0,"x":22.68,"y":25.89,"hdg":-3.126,"batt":100.0,"det":false},{"id":1,"x":208.44,"y":24.54,"hdg":-2.521,"batt":100.0,"det":false},{"id":2,"x":23.31,"y":209.21,"hdg":-1.910,"batt":100.0,"det":false},{"id":3,"x":207.65,"y":207.45,"hdg":-1.299,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":30,"t":30.00,"coverage":0.0348,"drones":[{"id":0,"x":29.02,"y":21.01,"hdg":-0.657,"batt":100.0,"det":false},{"id":1,"x":216.43,"y":24.17,"hdg":-0.046,"batt":100.0,"det":false},{"id":2,"x":30.06,"y":213.50,"hdg":0.565,"batt":100.0,"det":false},{"id":3,"x":210.73,"y":214.84,"hdg":1.176,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":31,"t":31.00,"coverage":0.0350,"drones":[{"id":0,"x":27.06,"y":28.76,"hdg":1.818,"batt":100.0,"det":false},{"id":1,"x":210.38,"y":29.40,"hdg":2.429,"batt":100.0,"det":false},{"id":2,"x":22.11,"y":214.38,"hdg":3.031,"batt":100.0,"det":false},{"id":3,"x":203.74,"y":210.93,"hdg":-2.632,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":32,"t":32.00,"coverage":0.0350,"drones":[{"id":0,"x":23.65,"y":21.52,"hdg":-2.011,"batt":100.0,"det":false},{"id":1,"x":213.19,"y":21.91,"hdg":-1.212,"batt":100.0,"det":false},{"id":2,"x":27.86,"y":208.82,"hdg":-0.768,"batt":100.0,"det":false},{"id":3,"x":211.64,"y":209.68,"hdg":-0.157,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":33,"t":33.00,"coverage":0.0352,"drones":[{"id":0,"x":30.73,"y":25.25,"hdg":0.485,"batt":100.0,"det":false},{"id":1,"x":216.85,"y":29.03,"hdg":1.096,"batt":100.0,"det":false},{"id":2,"x":26.71,"y":216.73,"hdg":1.716,"batt":100.0,"det":false},{"id":3,"x":206.21,"y":215.55,"hdg":2.318,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":34,"t":34.00,"coverage":0.0356,"drones":[{"id":0,"x":28.43,"y":32.91,"hdg":1.863,"batt":100.0,"det":false},{"id":1,"x":209.57,"y":25.70,"hdg":-2.712,"batt":100.0,"det":false},{"id":2,"x":24.53,"y":209.04,"hdg":-1.847,"batt":100.0,"det":false},{"id":3,"x":206.85,"y":207.58,"hdg":-1.490,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":35,"t":35.00,"coverage":0.0364,"drones":[{"id":0,"x":35.79,"y":29.80,"hdg":-0.400,"batt":100.0,"det":false},{"id":1,"x":217.35,"y":23.82,"hdg":-0.237,"batt":100.0,"det":false},{"id":2,"x":31.97,"y":211.96,"hdg":0.374,"batt":100.0,"det":false},{"id":3,"x":211.28,"y":214.24,"hdg":0.985,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":36,"t":36.00,"coverage":0.0375,"drones":[{"id":0,"x":35.35,"y":37.79,"hdg":1.627,"batt":100.0,"det":false},{"id":1,"x":212.40,"y":30.10,"hdg":2.238,"batt":100.0,"det":false},{"id":2,"x":24.82,"y":215.54,"hdg":2.678,"batt":100.0,"det":false},{"id":3,"x":203.68,"y":211.74,"hdg":-2.823,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":37,"t":37.00,"coverage":0.0375,"drones":[{"id":0,"x":30.12,"y":31.73,"hdg":-2.283,"batt":100.0,"det":false},{"id":1,"x":212.40,"y":22.10,"hdg":-1.571,"batt":100.0,"det":false},{"id":2,"x":29.41,"y":208.99,"hdg":-0.959,"batt":100.0,"det":false},{"id":3,"x":211.03,"y":208.59,"hdg":-0.404,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":38,"t":38.00,"coverage":0.0377,"drones":[{"id":0,"x":37.78,"y":34.04,"hdg":0.293,"batt":100.0,"det":false},{"id":1,"x":217.07,"y":28.60,"hdg":0.948,"batt":100.0,"det":false},{"id":2,"x":29.85,"y":216.97,"hdg":1.516,"batt":100.0,"det":false},{"id":3,"x":206.81,"y":215.39,"hdg":2.127,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":39,"t":39.00,"coverage":0.0380,"drones":[{"id":0,"x":30.33,"y":36.96,"hdg":2.768,"batt":100.0,"det":false},{"id":1,"x":209.30,"y":26.71,"hdg":-2.904,"batt":100.0,"det":false},{"id":2,"x":24.57,"y":210.97,"hdg":-2.293,"batt":100.0,"det":false},{"id":3,"x":205.93,"y":207.44,"hdg":-1.682,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":40,"t":40.00,"coverage":0.0380,"drones":[{"id":0,"x":34.38,"y":30.06,"hdg":-1.040,"batt":100.0,"det":false},{"id":1,"x":216.67,"y":23.61,"hdg":-0.398,"batt":100.0,"det":false},{"id":2,"x":32.43,"y":212.42,"hdg":0.182,"batt":100.0,"det":false},{"id":3,"x":211.54,"y":213.14,"hdg":0.793,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":41,"t":41.00,"coverage":0.0380,"drones":[{"id":0,"x":35.46,"y":37.99,"hdg":1.435,"batt":100.0,"det":false},{"id":1,"x":213.01,"y":30.72,"hdg":2.046,"batt":100.0,"det":false},{"id":2,"x":25.35,"y":216.14,"hdg":2.657,"batt":100.0,"det":false},{"id":3,"x":203.60,"y":212.13,"hdg":-3.015,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":42,"t":42.00,"coverage":0.0380,"drones":[{"id":0,"x":29.71,"y":32.43,"hdg":-2.373,"batt":100.0,"det":false},{"id":1,"x":210.84,"y":23.02,"hdg":-1.845,"batt":100.0,"det":false},{"id":2,"x":28.62,"y":208.84,"hdg":-1.151,"batt":100.0,"det":false},{"id":3,"x":210.47,"y":208.02,"hdg":-0.540,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":43,"t":43.00,"coverage":0.0380,"drones":[{"id":0,"x":37.67,"y":33.24,"hdg":0.102,"batt":100.0,"det":false},{"id":1,"x":216.89,"y":28.26,"hdg":0.713,"batt":100.0,"det":false},{"id":2,"x":30.57,"y":216.60,"hdg":1.324,"batt":100.0,"det":false},{"id":3,"x":207.62,"y":215.49,"hdg":1.935,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":44,"t":44.00,"coverage":0.0384,"drones":[{"id":0,"x":33.06,"y":39.78,"hdg":2.185,"batt":100.0,"det":false},{"id":1,"x":208.90,"y":27.88,"hdg":-3.095,"batt":100.0,"det":false},{"id":2,"x":25.73,"y":210.23,"hdg":-2.220,"batt":100.0,"det":false},{"id":3,"x":205.23,"y":207.86,"hdg":-1.873,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":45,"t":45.00,"coverage":0.0389,"drones":[{"id":0,"x":37.03,"y":32.84,"hdg":-1.052,"batt":100.0,"det":false},{"id":1,"x":215.41,"y":23.24,"hdg":-0.620,"batt":100.0,"det":false},{"id":2,"x":33.73,"y":210.15,"hdg":-0.009,"batt":100.0,"det":false},{"id":3,"x":211.83,"y":212.39,"hdg":0.602,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":46,"t":46.00,"coverage":0.0395,"drones":[{"id":0,"x":39.60,"y":40.41,"hdg":1.244,"batt":100.0,"det":false},{"id":1,"x":213.17,"y":30.91,"hdg":1.855,"batt":100.0,"det":false},{"id":2,"x":27.54,"y":215.21,"hdg":2.456,"batt":100.0,"det":false},{"id":3,"x":203.84,"y":212.90,"hdg":3.077,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":47,"t":47.00,"coverage":0.0398,"drones":[{"id":0,"x":32.90,"y":36.05,"hdg":-2.564,"batt":100.0,"det":false},{"id":1,"x":205.84,"y":27.71,"hdg":-2.730,"batt":100.0,"det":false},{"id":2,"x":29.35,"y":207.42,"hdg":-1.342,"batt":100.0,"det":false},{"id":3,"x":209.80,"y":207.56,"hdg":-0.731,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":48,"t":48.00,"coverage":0.0400,"drones":[{"id":0,"x":40.86,"y":35.33,"hdg":-0.089,"batt":100.0,"det":false},{"id":1,"x":212.78,"y":31.70,"hdg":0.522,"batt":100.0,"det":false},{"id":2,"x":32.74,"y":214.67,"hdg":1.133,"batt":100.0,"det":false},{"id":3,"x":208.42,"y":215.44,"hdg":1.744,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":49,"t":49.00,"coverage":0.0406,"drones":[{"id":0,"x":35.04,"y":40.82,"hdg":2.386,"batt":100.0,"det":false},{"id":1,"x":204.86,"y":32.85,"hdg":2.997,"batt":100.0,"det":false},{"id":2,"x":25.60,"y":211.07,"hdg":-2.675,"batt":100.0,"det":false},{"id":3,"x":204.63,"y":208.40,"hdg":-2.064,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":50,"t":50.00,"coverage":0.0406,"drones":[{"id":0,"x":36.22,"y":32.91,"hdg":-1.423,"batt":100.0,"det":false},{"id":1,"x":210.73,"y":27.42,"hdg":-0.747,"batt":100.0,"det":false},{"id":2,"x":33.44,"y":209.48,"hdg":-0.200,"batt":100.0,"det":false},{"id":3,"x":211.97,"y":211.59,"hdg":0.411,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":51,"t":51.00,"coverage":0.0409,"drones":[{"id":0,"x":40.19,"y":39.86,"hdg":1.052,"batt":100.0,"det":false},{"id":1,"x":209.99,"y":35.38,"hdg":1.663,"batt":100.0,"det":false},{"id":2,"x":31.20,"y":217.16,"hdg":1.853,"batt":100.0,"det":false},{"id":3,"x":204.23,"y":213.61,"hdg":2.886,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":52,"t":52.00,"coverage":0.0409,"drones":[{"id":0,"x":34.51,"y":34.22,"hdg":-2.360,"batt":100.0,"det":false},{"id":1,"x":205.64,"y":28.66,"hdg":-2.145,"batt":100.0,"det":false},{"id":2,"x":31.50,"y":209.17,"hdg":-1.534,"batt":100.0,"det":false},{"id":3,"x":209.06,"y":207.24,"hdg":-0.923,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":53,"t":53.00,"coverage":0.0417,"drones":[{"id":0,"x":42.19,"y":32.01,"hdg":-0.281,"batt":100.0,"det":false},{"id":1,"x":213.21,"y":31.26,"hdg":0.330,"batt":100.0,"det":false},{"id":2,"x":36.21,"y":215.63,"hdg":0.941,"batt":100.0,"det":false},{"id":3,"x":209.21,"y":215.24,"hdg":1.552,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":54,"t":54.00,"coverage":0.0419,"drones":[{"id":0,"x":37.52,"y":38.50,"hdg":2.194,"batt":100.0,"det":false},{"id":1,"x":205.66,"y":33.90,"hdg":2.805,"batt":100.0,"det":false},{"id":2,"x":28.71,"y":212.85,"hdg":-2.786,"batt":100.0,"det":false},{"id":3,"x":204.14,"y":209.04,"hdg":-2.256,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":55,"t":55.00,"coverage":0.0422,"drones":[{"id":0,"x":37.07,"y":30.51,"hdg":-1.628,"batt":100.0,"det":false},{"id":1,"x":209.96,"y":27.15,"hdg":-1.003,"batt":100.0,"det":false},{"id":2,"x":36.11,"y":209.79,"hdg":-0.392,"batt":100.0,"det":false},{"id":3,"x":211.95,"y":210.78,"hdg":0.219,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":56,"t":56.00,"coverage":0.0423,"drones":[{"id":0,"x":42.28,"y":36.58,"hdg":0.861,"batt":100.0,"det":false},{"id":1,"x":210.75,"y":35.12,"hdg":1.472,"batt":100.0,"det":false},{"id":2,"x":32.18,"y":216.76,"hdg":2.083,"batt":100.0,"det":false},{"id":3,"x":204.74,"y":214.24,"hdg":2.694,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":57,"t":57.00,"coverage":0.0423,"drones":[{"id":0,"x":34.43,"y":35.04,"hdg":-2.947,"batt":100.0,"det":false},{"id":1,"x":203.97,"y":30.87,"hdg":-2.582,"batt":100.0,"det":false},{"id":2,"x":30.96,"y":208.86,"hdg":-1.725,"batt":100.0,"det":false},{"id":3,"x":208.27,"y":207.06,"hdg":-1.114,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":58,"t":58.00,"coverage":0.0423,"drones":[{"id":0,"x":41.56,"y":31.40,"hdg":-0.472,"batt":100.0,"det":false},{"id":1,"x":211.89,"y":31.97,"hdg":0.139,"batt":100.0,"det":false},{"id":2,"x":36.81,"y":214.31,"hdg":0.750,"batt":100.0,"det":false},{"id":3,"x":209.93,"y":214.89,"hdg":1.361,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":59,"t":59.00,"coverage":0.0425,"drones":[{"id":0,"x":38.21,"y":38.66,"hdg":2.003,"batt":100.0,"det":false},{"id":1,"x":204.98,"y":36.00,"hdg":2.614,"batt":100.0,"det":false},{"id":2,"x":28.84,"y":213.65,"hdg":-3.058,"batt":100.0,"det":false},{"id":3,"x":203.79,"y":209.77,"hdg":-2.447,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":60,"t":60.00,"coverage":0.0425,"drones":[{"id":0,"x":36.35,"y":30.88,"hdg":-1.805,"batt":100.0,"det":false},{"id":1,"x":208.13,"y":28.65,"hdg":-1.167,"batt":100.0,"det":false},{"id":2,"x":35.51,"y":209.24,"hdg":-0.583,"batt":100.0,"det":false},{"id":3,"x":211.78,"y":209.99,"hdg":0.028,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":61,"t":61.00,"coverage":0.0427,"drones":[{"id":0,"x":42.62,"y":35.85,"hdg":0.670,"batt":100.0,"det":false},{"id":1,"x":210.41,"y":36.31,"hdg":1.281,"batt":100.0,"det":false},{"id":2,"x":32.99,"y":216.83,"hdg":1.892,"batt":100.0,"det":false},{"id":3,"x":205.36,"y":214.76,"hdg":2.503,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":62,"t":62.00,"coverage":0.0427,"drones":[{"id":0,"x":34.62,"y":35.80,"hdg":-3.136,"batt":100.0,"det":false},{"id":1,"x":203.88,"y":31.70,"hdg":-2.528,"batt":100.0,"det":false},{"id":2,"x":30.28,"y":209.30,"hdg":-1.916,"batt":100.0,"det":false},{"id":3,"x":207.46,"y":207.04,"hdg":-1.305,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":63,"t":63.00,"coverage":0.0427,"drones":[{"id":0,"x":40.96,"y":30.92,"hdg":-0.657,"batt":100.0,"det":false},{"id":1,"x":211.86,"y":31.28,"hdg":-0.053,"batt":100.0,"det":false},{"id":2,"x":37.06,"y":213.54,"hdg":0.559,"batt":100.0,"det":false},{"id":3,"x":212.28,"y":213.42,"hdg":0.924,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":64,"t":64.00,"coverage":0.0427,"drones":[{"id":0,"x":39.05,"y":38.69,"hdg":1.811,"batt":100.0,"det":false},{"id":1,"x":207.88,"y":38.22,"hdg":2.092,"batt":100.0,"det":false},{"id":2,"x":29.12,"y":214.48,"hdg":3.024,"batt":100.0,"det":false},{"id":3,"x":205.27,"y":209.56,"hdg":-2.639,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":65,"t":65.00,"coverage":0.0427,"drones":[{"id":0,"x":35.74,"y":31.40,"hdg":-1.997,"batt":100.0,"det":false},{"id":1,"x":211.74,"y":31.21,"hdg":-1.068,"batt":100.0,"det":false},{"id":2,"x":34.84,"y":208.89,"hdg":-0.775,"batt":100.0,"det":false},{"id":3,"x":213.17,"y":208.26,"hdg":-0.164,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":66,"t":66.00,"coverage":0.0430,"drones":[{"id":0,"x":42.85,"y":35.08,"hdg":0.478,"batt":100.0,"det":false},{"id":1,"x":215.44,"y":38.30,"hdg":1.089,"batt":100.0,"det":false},{"id":2,"x":33.80,"y":216.82,"hdg":1.700,"batt":100.0,"det":false},{"id":3,"x":207.77,"y":214.17,"hdg":2.311,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":67,"t":67.00,"coverage":0.0431,"drones":[{"id":0,"x":34.99,"y":36.58,"hdg":2.953,"batt":100.0,"det":false},{"id":1,"x":208.14,"y":35.02,"hdg":-2.719,"batt":100.0,"det":false},{"id":2,"x":29.71,"y":209.95,"hdg":-2.108,"batt":100.0,"det":false},{"id":3,"x":208.36,"y":206.19,"hdg":-1.497,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":68,"t":68.00,"coverage":0.0431,"drones":[{"id":0,"x":40.24,"y":30.54,"hdg":-0.855,"batt":100.0,"det":false},{"id":1,"x":215.91,"y":33.09,"hdg":-0.244,"batt":100.0,"det":false},{"id":2,"x":37.18,"y":212.82,"hdg":0.367,"batt":100.0,"det":false},{"id":3,"x":212.83,"y":212.82,"hdg":0.978,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":69,"t":69.00,"coverage":0.0434,"drones":[{"id":0,"x":39.76,"y":38.53,"hdg":1.630,"batt":100.0,"det":false},{"id":1,"x":211.00,"y":39.41,"hdg":2.231,"batt":100.0,"det":false},{"id":2,"x":30.95,"y":217.84,"hdg":2.462,"batt":100.0,"det":false},{"id":3,"x":205.21,"y":210.37,"hdg":-2.830,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":70,"t":70.00,"coverage":0.0434,"drones":[{"id":0,"x":34.02,"y":32.96,"hdg":-2.372,"batt":100.0,"det":false},{"id":1,"x":210.95,"y":31.41,"hdg":-1.577,"batt":100.0,"det":false},{"id":2,"x":35.50,"y":211.26,"hdg":-0.966,"batt":100.0,"det":false},{"id":3,"x":212.72,"y":207.59,"hdg":-0.355,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":71,"t":71.00,"coverage":0.0437,"drones":[{"id":0,"x":41.69,"y":35.23,"hdg":0.287,"batt":100.0,"det":false},{"id":1,"x":215.94,"y":37.66,"hdg":0.898,"batt":100.0,"det":false},{"id":2,"x":36.00,"y":219.25,"hdg":1.509,"batt":100.0,"det":false},{"id":3,"x":208.54,"y":214.41,"hdg":2.120,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":72,"t":72.00,"coverage":0.0437,"drones":[{"id":0,"x":34.51,"y":38.76,"hdg":2.684,"batt":100.0,"det":false},{"id":1,"x":208.15,"y":35.83,"hdg":-2.910,"batt":100.0,"det":false},{"id":2,"x":30.67,"y":213.28,"hdg":-2.299,"batt":100.0,"det":false},{"id":3,"x":207.60,"y":206.47,"hdg":-1.688,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":73,"t":73.00,"coverage":0.0437,"drones":[{"id":0,"x":38.60,"y":31.88,"hdg":-1.034,"batt":100.0,"det":false},{"id":1,"x":216.01,"y":34.36,"hdg":-0.185,"batt":100.0,"det":false},{"id":2,"x":38.55,"y":214.68,"hdg":0.176,"batt":100.0,"det":false},{"id":3,"x":213.25,"y":212.13,"hdg":0.787,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":74,"t":74.00,"coverage":0.0439,"drones":[{"id":0,"x":39.74,"y":39.80,"hdg":1.429,"batt":100.0,"det":false},{"id":1,"x":212.40,"y":41.50,"hdg":2.040,"batt":100.0,"det":false},{"id":2,"x":31.49,"y":218.45,"hdg":2.651,"batt":100.0,"det":false},{"id":3,"x":205.31,"y":211.17,"hdg":-3.021,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":75,"t":75.00,"coverage":0.0439,"drones":[{"id":0,"x":33.95,"y":34.28,"hdg":-2.380,"batt":100.0,"det":false},{"id":1,"x":209.97,"y":33.87,"hdg":-1.879,"batt":100.0,"det":false},{"id":2,"x":34.71,"y":211.12,"hdg":-1.157,"batt":100.0,"det":false},{"id":3,"x":212.14,"y":207.02,"hdg":-0.546,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":76,"t":76.00,"coverage":0.0441,"drones":[{"id":0,"x":41.91,"y":35.04,"hdg":0.095,"batt":100.0,"det":false},{"id":1,"x":216.05,"y":39.07,"hdg":0.706,"batt":100.0,"det":false},{"id":2,"x":36.71,"y":218.87,"hdg":1.318,"batt":100.0,"det":false},{"id":3,"x":209.34,"y":214.51,"hdg":1.929,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":77,"t":77.00,"coverage":0.0441,"drones":[{"id":0,"x":35.18,"y":39.37,"hdg":2.570,"batt":100.0,"det":false},{"id":1,"x":208.06,"y":38.75,"hdg":-3.102,"batt":100.0,"det":false},{"id":2,"x":34.14,"y":211.29,"hdg":-1.897,"batt":100.0,"det":false},{"id":3,"x":206.91,"y":206.89,"hdg":-1.880,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":78,"t":78.00,"coverage":0.0447,"drones":[{"id":0,"x":42.14,"y":35.42,"hdg":-0.517,"batt":100.0,"det":false},{"id":1,"x":214.54,"y":34.06,"hdg":-0.627,"batt":100.0,"det":false},{"id":2,"x":42.14,"y":211.16,"hdg":-0.016,"batt":100.0,"det":false},{"id":3,"x":213.53,"y":211.38,"hdg":0.595,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":79,"t":79.00,"coverage":0.0456,"drones":[{"id":0,"x":44.76,"y":42.97,"hdg":1.237,"batt":100.0,"det":false},{"id":1,"x":212.35,"y":41.75,"hdg":1.848,"batt":100.0,"det":false},{"id":2,"x":36.35,"y":216.68,"hdg":2.380,"batt":100.0,"det":false},{"id":3,"x":205.56,"y":211.94,"hdg":3.070,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":80,"t":80.00,"coverage":0.0456,"drones":[{"id":0,"x":38.49,"y":38.00,"hdg":-2.470,"batt":100.0,"det":false},{"id":1,"x":209.31,"y":34.35,"hdg":-1.960,"batt":100.0,"det":false},{"id":2,"x":38.11,"y":208.88,"hdg":-1.349,"batt":100.0,"det":false},{"id":3,"x":211.47,"y":206.56,"hdg":-0.738,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":81,"t":81.00,"coverage":0.0459,"drones":[{"id":0,"x":46.46,"y":37.23,"hdg":-0.096,"batt":100.0,"det":false},{"id":1,"x":216.28,"y":38.29,"hdg":0.515,"batt":100.0,"det":false},{"id":2,"x":41.55,"y":216.10,"hdg":1.126,"batt":100.0,"det":false},{"id":3,"x":210.15,"y":214.45,"hdg":1.737,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":82,"t":82.00,"coverage":0.0459,"drones":[{"id":0,"x":40.67,"y":42.76,"hdg":2.379,"batt":100.0,"det":false},{"id":1,"x":208.37,"y":39.50,"hdg":2.990,"batt":100.0,"det":false},{"id":2,"x":34.38,"y":212.55,"hdg":-2.682,"batt":100.0,"det":false},{"id":3,"x":206.31,"y":207.43,"hdg":-2.071,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":83,"t":83.00,"coverage":0.0461,"drones":[{"id":0,"x":41.80,"y":34.84,"hdg":-1.429,"batt":100.0,"det":false},{"id":1,"x":215.01,"y":35.03,"hdg":-0.592,"batt":100.0,"det":false},{"id":2,"x":42.21,"y":210.91,"hdg":-0.207,"batt":100.0,"det":false},{"id":3,"x":213.67,"y":210.58,"hdg":0.404,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":84,"t":84.00,"coverage":0.0464,"drones":[{"id":0,"x":45.81,"y":41.76,"hdg":1.046,"batt":100.0,"det":false},{"id":1,"x":214.32,"y":43.00,"hdg":1.657,"batt":100.0,"det":false},{"id":2,"x":37.08,"y":217.04,"hdg":2.268,"batt":100.0,"det":false},{"id":3,"x":205.94,"y":212.65,"hdg":2.879,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":85,"t":85.00,"coverage":0.0466,"drones":[{"id":0,"x":38.38,"y":38.80,"hdg":-2.762,"batt":100.0,"det":false},{"id":1,"x":209.93,"y":36.32,"hdg":-2.151,"batt":100.0,"det":false},{"id":2,"x":37.32,"y":209.05,"hdg":-1.540,"batt":100.0,"det":false},{"id":3,"x":210.73,"y":206.25,"hdg":-0.929,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":86,"t":86.00,"coverage":0.0466,"drones":[{"id":0,"x":46.05,"y":36.53,"hdg":-0.287,"batt":100.0,"det":false},{"id":1,"x":217.52,"y":38.86,"hdg":0.324,"batt":100.0,"det":false},{"id":2,"x":42.07,"y":215.48,"hdg":0.935,"batt":100.0,"det":false},{"id":3,"x":210.93,"y":214.24,"hdg":1.546,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":87,"t":87.00,"coverage":0.0469,"drones":[{"id":0,"x":43.24,"y":44.02,"hdg":1.930,"batt":100.0,"det":false},{"id":1,"x":209.98,"y":41.55,"hdg":2.799,"batt":100.0,"det":false},{"id":2,"x":34.92,"y":211.90,"hdg":-2.677,"batt":100.0,"det":false},{"id":3,"x":205.83,"y":208.08,"hdg":-2.262,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":88,"t":88.00,"coverage":0.0470,"drones":[{"id":0,"x":42.49,"y":36.06,"hdg":-1.665,"batt":100.0,"det":false},{"id":1,"x":214.24,"y":34.78,"hdg":-1.009,"batt":100.0,"det":false},{"id":2,"x":42.29,"y":208.80,"hdg":-0.398,"batt":100.0,"det":false},{"id":3,"x":213.65,"y":209.77,"hdg":0.213,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":89,"t":89.00,"coverage":0.0470,"drones":[{"id":0,"x":47.74,"y":42.09,"hdg":0.854,"batt":100.0,"det":false},{"id":1,"x":215.08,"y":42.73,"hdg":1.466,"batt":100.0,"det":false},{"id":2,"x":38.42,"y":215.80,"hdg":2.077,"batt":100.0,"det":false},{"id":3,"x":207.67,"y":215.09,"hdg":2.414,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":90,"t":90.00,"coverage":0.0470,"drones":[{"id":0,"x":39.89,"y":40.57,"hdg":-2.950,"batt":100.0,"det":false},{"id":1,"x":209.50,"y":37.00,"hdg":-2.343,"batt":100.0,"det":false},{"id":2,"x":37.14,"y":207.90,"hdg":-1.732,"batt":100.0,"det":false},{"id":3,"x":211.16,"y":207.89,"hdg":-1.121,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":91,"t":91.00,"coverage":0.0472,"drones":[{"id":0,"x":46.99,"y":36.88,"hdg":-0.479,"batt":100.0,"det":false},{"id":1,"x":217.43,"y":38.06,"hdg":0.132,"batt":100.0,"det":false},{"id":2,"x":43.03,"y":213.31,"hdg":0.743,"batt":100.0,"det":false},{"id":3,"x":212.87,"y":215.70,"hdg":1.354,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":92,"t":92.00,"coverage":0.0473,"drones":[{"id":0,"x":43.69,"y":44.17,"hdg":1.996,"batt":100.0,"det":false},{"id":1,"x":210.55,"y":42.13,"hdg":2.607,"batt":100.0,"det":false},{"id":2,"x":35.05,"y":212.70,"hdg":-3.065,"batt":100.0,"det":false},{"id":3,"x":206.69,"y":210.62,"hdg":-2.454,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":93,"t":93.00,"coverage":0.0475,"drones":[{"id":0,"x":41.78,"y":36.40,"hdg":-1.812,"batt":100.0,"det":false},{"id":1,"x":214.13,"y":34.97,"hdg":-1.107,"batt":100.0,"det":false},{"id":2,"x":41.70,"y":208.25,"hdg":-0.590,"batt":100.0,"det":false},{"id":3,"x":214.69,"y":210.79,"hdg":0.021,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":94,"t":94.00,"coverage":0.0475,"drones":[{"id":0,"x":48.08,"y":41.32,"hdg":0.663,"batt":100.0,"det":false},{"id":1,"x":216.47,"y":42.63,"hdg":1.274,"batt":100.0,"det":false},{"id":2,"x":40.00,"y":216.07,"hdg":1.785,"batt":100.0,"det":false},{"id":3,"x":208.30,"y":215.60,"hdg":2.496,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":95,"t":95.00,"coverage":0.0475,"drones":[{"id":0,"x":40.08,"y":41.35,"hdg":3.138,"batt":100.0,"det":false},{"id":1,"x":209.90,"y":38.06,"hdg":-2.534,"batt":100.0,"det":false},{"id":2,"x":37.24,"y":208.56,"hdg":-1.923,"batt":100.0,"det":false},{"id":3,"x":210.35,"y":207.87,"hdg":-1.312,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":96,"t":96.00,"coverage":0.0477,"drones":[{"id":0,"x":47.41,"y":38.14,"hdg":-0.414,"batt":100.0,"det":false},{"id":1,"x":217.88,"y":37.59,"hdg":-0.059,"batt":100.0,"det":false},{"id":2,"x":44.05,"y":212.75,"hdg":0.552,"batt":100.0,"det":false},{"id":3,"x":213.52,"y":215.21,"hdg":1.163,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":97,"t":97.00,"coverage":0.0480,"drones":[{"id":0,"x":45.55,"y":45.92,"hdg":1.805,"batt":100.0,"det":false},{"id":1,"x":211.90,"y":42.90,"hdg":2.416,"batt":100.0,"det":false},{"id":2,"x":36.13,"y":213.90,"hdg":2.998,"batt":100.0,"det":false},{"id":3,"x":206.48,"y":211.40,"hdg":-2.645,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":98,"t":98.00,"coverage":0.0480,"drones":[{"id":0,"x":41.85,"y":38.83,"hdg":-2.052,"batt":100.0,"det":false},{"id":1,"x":213.32,"y":35.02,"hdg":-1.392,"batt":100.0,"det":false},{"id":2,"x":41.81,"y":208.27,"hdg":-0.781,"batt":100.0,"det":false},{"id":3,"x":214.28,"y":209.61,"hdg":-0.226,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":99,"t":99.00,"coverage":0.0481,"drones":[{"id":0,"x":48.97,"y":42.46,"hdg":0.472,"batt":100.0,"det":false},{"id":1,"x":217.07,"y":42.09,"hdg":1.083,"batt":100.0,"det":false},{"id":2,"x":40.83,"y":216.21,"hdg":1.694,"batt":100.0,"det":false},{"id":3,"x":208.92,"y":215.55,"hdg":2.305,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":100,"t":100.00,"coverage":0.0483,"drones":[{"id":0,"x":41.13,"y":44.01,"hdg":2.947,"batt":100.0,"det":false},{"id":1,"x":209.73,"y":38.90,"hdg":-2.732,"batt":100.0,"det":false},{"id":2,"x":36.69,"y":209.36,"hdg":-2.114,"batt":100.0,"det":false},{"id":3,"x":209.46,"y":207.57,"hdg":-1.503,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":101,"t":101.00,"coverage":0.0484,"drones":[{"id":0,"x":46.34,"y":37.94,"hdg":-0.862,"batt":100.0,"det":false},{"id":1,"x":217.48,"y":36.92,"hdg":-0.250,"batt":100.0,"det":false},{"id":2,"x":44.18,"y":212.18,"hdg":0.361,"batt":100.0,"det":false},{"id":3,"x":213.97,"y":214.18,"hdg":0.972,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":102,"t":102.00,"coverage":0.0484,"drones":[{"id":0,"x":45.99,"y":45.93,"hdg":1.613,"batt":100.0,"det":false},{"id":1,"x":212.62,"y":43.27,"hdg":2.225,"batt":100.0,"det":false},{"id":2,"x":36.55,"y":214.59,"hdg":2.836,"batt":100.0,"det":false},{"id":3,"x":206.34,"y":211.78,"hdg":-2.837,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":103,"t":103.00,"coverage":0.0484,"drones":[{"id":0,"x":41.32,"y":39.44,"hdg":-2.195,"batt":100.0,"det":false},{"id":1,"x":212.51,"y":35.27,"hdg":-1.584,"batt":100.0,"det":false},{"id":2,"x":41.06,"y":207.98,"hdg":-0.973,"batt":100.0,"det":false},{"id":3,"x":213.83,"y":208.95,"hdg":-0.362,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":104,"t":104.00,"coverage":0.0484,"drones":[{"id":0,"x":49.01,"y":41.65,"hdg":0.280,"batt":100.0,"det":false},{"id":1,"x":217.54,"y":41.50,"hdg":0.891,"batt":100.0,"det":false},{"id":2,"x":41.60,"y":215.96,"hdg":1.502,"batt":100.0,"det":false},{"id":3,"x":209.69,"y":215.80,"hdg":2.113,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":105,"t":105.00,"coverage":0.0484,"drones":[{"id":0,"x":42.70,"y":46.58,"hdg":2.479,"batt":100.0,"det":false},{"id":1,"x":209.74,"y":39.71,"hdg":-2.917,"batt":100.0,"det":false},{"id":2,"x":36.44,"y":209.85,"hdg":-2.272,"batt":100.0,"det":false},{"id":3,"x":208.71,"y":207.86,"hdg":-1.695,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":106,"t":106.00,"coverage":0.0486,"drones":[{"id":0,"x":47.43,"y":40.12,"hdg":-0.939,"batt":100.0,"det":false},{"id":1,"x":216.97,"y":36.29,"hdg":-0.442,"batt":100.0,"det":false},{"id":2,"x":44.33,"y":211.19,"hdg":0.169,"batt":100.0,"det":false},{"id":3,"x":214.39,"y":213.49,"hdg":0.780,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":107,"t":107.00,"coverage":0.0489,"drones":[{"id":0,"x":48.61,"y":48.03,"hdg":1.422,"batt":100.0,"det":false},{"id":1,"x":213.40,"y":43.45,"hdg":2.033,"batt":100.0,"det":false},{"id":2,"x":37.30,"y":215.01,"hdg":2.644,"batt":100.0,"det":false},{"id":3,"x":206.44,"y":212.58,"hdg":-3.028,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":108,"t":108.00,"coverage":0.0489,"drones":[{"id":0,"x":42.79,"y":42.55,"hdg":-2.386,"batt":100.0,"det":false},{"id":1,"x":207.97,"y":37.58,"hdg":-2.317,"batt":100.0,"det":false},{"id":2,"x":40.46,"y":207.66,"hdg":-1.164,"batt":100.0,"det":false},{"id":3,"x":213.25,"y":208.38,"hdg":-0.553,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":109,"t":109.00,"coverage":0.0491,"drones":[{"id":0,"x":50.76,"y":43.26,"hdg":0.089,"batt":100.0,"det":false},{"id":1,"x":214.09,"y":42.73,"hdg":0.700,"batt":100.0,"det":false},{"id":2,"x":42.52,"y":215.40,"hdg":1.311,"batt":100.0,"det":false},{"id":3,"x":210.50,"y":215.89,"hdg":1.922,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":110,"t":110.00,"coverage":0.0494,"drones":[{"id":0,"x":44.05,"y":47.63,"hdg":2.564,"batt":100.0,"det":false},{"id":1,"x":206.09,"y":42.46,"hdg":-3.108,"batt":100.0,"det":false},{"id":2,"x":36.12,"y":210.59,"hdg":-2.497,"batt":100.0,"det":false},{"id":3,"x":208.02,"y":208.28,"hdg":-1.886,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":111,"t":111.00,"coverage":0.0494,"drones":[{"id":0,"x":46.62,"y":40.05,"hdg":-1.244,"batt":100.0,"det":false},{"id":1,"x":212.54,"y":37.73,"hdg":-0.633,"batt":100.0,"det":false},{"id":2,"x":44.12,"y":210.41,"hdg":-0.022,"batt":100.0,"det":false},{"id":3,"x":214.67,"y":212.73,"hdg":0.589,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":112,"t":112.00,"coverage":0.0498,"drones":[{"id":0,"x":49.29,"y":47.59,"hdg":1.231,"batt":100.0,"det":false},{"id":1,"x":210.40,"y":45.44,"hdg":1.842,"batt":100.0,"det":false},{"id":2,"x":40.86,"y":217.72,"hdg":1.990,"batt":100.0,"det":false},{"id":3,"x":206.69,"y":213.35,"hdg":3.064,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":113,"t":113.00,"coverage":0.0498,"drones":[{"id":0,"x":43.53,"y":42.03,"hdg":-2.374,"batt":100.0,"det":false},{"id":1,"x":207.32,"y":38.06,"hdg":-1.966,"batt":100.0,"det":false},{"id":2,"x":42.57,"y":209.90,"hdg":-1.355,"batt":100.0,"det":false},{"id":3,"x":212.58,"y":207.93,"hdg":-0.744,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":114,"t":114.00,"coverage":0.0503,"drones":[{"id":0,"x":51.49,"y":41.21,"hdg":-0.103,"batt":100.0,"det":false},{"id":1,"x":214.31,"y":41.95,"hdg":0.509,"batt":100.0,"det":false},{"id":2,"x":46.06,"y":217.10,"hdg":1.120,"batt":100.0,"det":false},{"id":3,"x":211.30,"y":215.83,"hdg":1.731,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":115,"t":115.00,"coverage":0.0503,"drones":[{"id":0,"x":45.74,"y":46.78,"hdg":2.372,"batt":100.0,"det":false},{"id":1,"x":206.41,"y":43.21,"hdg":2.984,"batt":100.0,"det":false},{"id":2,"x":38.87,"y":213.60,"hdg":-2.689,"batt":100.0,"det":false},{"id":3,"x":207.42,"y":208.83,"hdg":-2.078,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":116,"t":116.00,"coverage":0.0503,"drones":[{"id":0,"x":46.91,"y":38.86,"hdg":-1.425,"batt":100.0,"det":false},{"id":1,"x":211.84,"y":37.34,"hdg":-0.825,"batt":100.0,"det":false},{"id":2,"x":46.69,"y":211.91,"hdg":-0.214,"batt":100.0,"det":false},{"id":3,"x":214.80,"y":211.93,"hdg":0.397,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":117,"t":117.00,"coverage":0.0505,"drones":[{"id":0,"x":50.96,"y":45.76,"hdg":1.039,"batt":100.0,"det":false},{"id":1,"x":211.20,"y":45.31,"hdg":1.650,"batt":100.0,"det":false},{"id":2,"x":41.59,"y":218.07,"hdg":2.261,"batt":100.0,"det":false},{"id":3,"x":207.09,"y":214.05,"hdg":2.872,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":118,"t":118.00,"coverage":0.0505,"drones":[{"id":0,"x":43.51,"y":42.85,"hdg":-2.769,"batt":100.0,"det":false},{"id":1,"x":205.54,"y":39.65,"hdg":-2.356,"batt":100.0,"det":false},{"id":2,"x":41.78,"y":210.07,"hdg":-1.547,"batt":100.0,"det":false},{"id":3,"x":211.83,"y":207.61,"hdg":-0.936,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":119,"t":119.00,"coverage":0.0506,"drones":[{"id":0,"x":51.17,"y":40.53,"hdg":-0.294,"batt":100.0,"det":false},{"id":1,"x":213.14,"y":42.15,"hdg":0.317,"batt":100.0,"det":false},{"id":2,"x":46.58,"y":216.48,"hdg":0.928,"batt":100.0,"det":false},{"id":3,"x":212.08,"y":215.61,"hdg":1.539,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":120,"t":120.00,"coverage":0.0509,"drones":[{"id":0,"x":46.58,"y":47.09,"hdg":2.181,"batt":100.0,"det":false},{"id":1,"x":205.63,"y":44.89,"hdg":2.792,"batt":100.0,"det":false},{"id":2,"x":38.85,"y":214.41,"hdg":-2.880,"batt":100.0,"det":false},{"id":3,"x":206.94,"y":209.48,"hdg":-2.269,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":121,"t":121.00,"coverage":0.0509,"drones":[{"id":0,"x":46.13,"y":39.10,"hdg":-1.627,"batt":100.0,"det":false},{"id":1,"x":209.84,"y":38.09,"hdg":-1.016,"batt":100.0,"det":false},{"id":2,"x":46.20,"y":211.26,"hdg":-0.405,"batt":100.0,"det":false},{"id":3,"x":214.77,"y":211.12,"hdg":0.206,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":122,"t":122.00,"coverage":0.0509,"drones":[{"id":0,"x":51.42,"y":45.10,"hdg":0.848,"batt":100.0,"det":false},{"id":1,"x":210.73,"y":46.04,"hdg":1.459,"batt":100.0,"det":false},{"id":2,"x":42.37,"y":218.28,"hdg":2.070,"batt":100.0,"det":false},{"id":3,"x":207.61,"y":214.67,"hdg":2.681,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":123,"t":123.00,"coverage":0.0509,"drones":[{"id":0,"x":43.72,"y":42.95,"hdg":-2.870,"batt":100.0,"det":false},{"id":1,"x":205.12,"y":40.34,"hdg":-2.349,"batt":100.0,"det":false},{"id":2,"x":41.04,"y":210.39,"hdg":-1.738,"batt":100.0,"det":false},{"id":3,"x":211.04,"y":207.45,"hdg":-1.127,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":124,"t":124.00,"coverage":0.0511,"drones":[{"id":0,"x":50.79,"y":39.22,"hdg":-0.485,"batt":100.0,"det":false},{"id":1,"x":213.05,"y":41.35,"hdg":0.126,"batt":100.0,"det":false},{"id":2,"x":46.96,"y":215.77,"hdg":0.737,"batt":100.0,"det":false},{"id":3,"x":214.54,"y":214.64,"hdg":1.118,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":125,"t":125.00,"coverage":0.0511,"drones":[{"id":0,"x":47.54,"y":46.53,"hdg":1.990,"batt":100.0,"det":false},{"id":1,"x":208.33,"y":47.80,"hdg":2.202,"batt":100.0,"det":false},{"id":2,"x":38.98,"y":215.21,"hdg":-3.071,"batt":100.0,"det":false},{"id":3,"x":208.33,"y":209.60,"hdg":-2.460,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":126,"t":126.00,"coverage":0.0514,"drones":[{"id":0,"x":45.58,"y":38.77,"hdg":-1.819,"batt":100.0,"det":false},{"id":1,"x":213.57,"y":41.76,"hdg":-0.857,"batt":100.0,"det":false},{"id":2,"x":45.60,"y":210.71,"hdg":-0.596,"batt":100.0,"det":false},{"id":3,"x":216.32,"y":209.72,"hdg":0.015,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":127,"t":127.00,"coverage":0.0520,"drones":[{"id":0,"x":51.92,"y":43.65,"hdg":0.656,"batt":100.0,"det":false},{"id":1,"x":215.96,"y":49.39,"hdg":1.268,"batt":100.0,"det":false},{"id":2,"x":43.18,"y":218.34,"hdg":1.879,"batt":100.0,"det":false},{"id":3,"x":209.97,"y":214.58,"hdg":2.490,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":128,"t":128.00,"coverage":0.0520,"drones":[{"id":0,"x":43.92,"y":43.74,"hdg":3.131,"batt":100.0,"det":false},{"id":1,"x":209.36,"y":44.87,"hdg":-2.541,"batt":100.0,"det":false},{"id":2,"x":40.37,"y":210.85,"hdg":-1.930,"batt":100.0,"det":false},{"id":3,"x":211.96,"y":206.83,"hdg":-1.319,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":129,"t":129.00,"coverage":0.0520,"drones":[{"id":0,"x":50.15,"y":38.73,"hdg":-0.677,"batt":100.0,"det":false},{"id":1,"x":217.34,"y":44.34,"hdg":-0.066,"batt":100.0,"det":false},{"id":2,"x":47.21,"y":215.00,"hdg":0.545,"batt":100.0,"det":false},{"id":3,"x":215.18,"y":214.15,"hdg":1.156,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":130,"t":130.00,"coverage":0.0522,"drones":[{"id":0,"x":49.05,"y":46.65,"hdg":1.709,"batt":100.0,"det":false},{"id":1,"x":211.39,"y":49.69,"hdg":2.409,"batt":100.0,"det":false},{"id":2,"x":39.48,"y":217.05,"hdg":2.883,"batt":100.0,"det":false},{"id":3,"x":208.12,"y":210.39,"hdg":-2.652,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":131,"t":131.00,"coverage":0.0522,"drones":[{"id":0,"x":43.37,"y":41.02,"hdg":-2.361,"batt":100.0,"det":false},{"id":1,"x":212.76,"y":41.81,"hdg":-1.399,"batt":100.0,"det":false},{"id":2,"x":45.12,"y":211.38,"hdg":-0.788,"batt":100.0,"det":false},{"id":3,"x":216.00,"y":208.98,"hdg":-0.177,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":132,"t":132.00,"coverage":0.0527,"drones":[{"id":0,"x":50.52,"y":44.61,"hdg":0.465,"batt":100.0,"det":false},{"id":1,"x":216.56,"y":48.85,"hdg":1.076,"batt":100.0,"det":false},{"id":2,"x":44.19,"y":219.32,"hdg":1.687,"batt":100.0,"det":false},{"id":3,"x":210.68,"y":214.96,"hdg":2.298,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":133,"t":133.00,"coverage":0.0527,"drones":[{"id":0,"x":42.71,"y":46.33,"hdg":2.924,"batt":100.0,"det":false},{"id":1,"x":209.22,"y":45.67,"hdg":-2.732,"batt":100.0,"det":false},{"id":2,"x":40.01,"y":212.50,"hdg":-2.121,"batt":100.0,"det":false},{"id":3,"x":211.17,"y":206.97,"hdg":-1.510,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":134,"t":134.00,"coverage":0.0527,"drones":[{"id":0,"x":47.88,"y":40.23,"hdg":-0.868,"batt":100.0,"det":false},{"id":1,"x":217.00,"y":43.80,"hdg":-0.235,"batt":100.0,"det":false},{"id":2,"x":47.51,"y":215.28,"hdg":0.354,"batt":100.0,"det":false},{"id":3,"x":215.72,"y":213.55,"hdg":0.965,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":135,"t":135.00,"coverage":0.0527,"drones":[{"id":0,"x":47.59,"y":48.22,"hdg":1.607,"batt":100.0,"det":false},{"id":1,"x":212.18,"y":50.19,"hdg":2.218,"batt":100.0,"det":false},{"id":2,"x":39.90,"y":217.74,"hdg":2.829,"batt":100.0,"det":false},{"id":3,"x":208.07,"y":211.20,"hdg":-2.843,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":136,"t":136.00,"coverage":0.0527,"drones":[{"id":0,"x":42.87,"y":41.76,"hdg":-2.201,"batt":100.0,"det":false},{"id":1,"x":211.97,"y":42.19,"hdg":-1.597,"batt":100.0,"det":false},{"id":2,"x":44.36,"y":211.10,"hdg":-0.979,"batt":100.0,"det":false},{"id":3,"x":215.54,"y":208.32,"hdg":-0.368,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":137,"t":137.00,"coverage":0.0527,"drones":[{"id":0,"x":50.57,"y":43.93,"hdg":0.274,"batt":100.0,"det":false},{"id":1,"x":217.04,"y":48.38,"hdg":0.885,"batt":100.0,"det":false},{"id":2,"x":44.96,"y":219.07,"hdg":1.496,"batt":100.0,"det":false},{"id":3,"x":211.45,"y":215.19,"hdg":2.107,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":138,"t":138.00,"coverage":0.0527,"drones":[{"id":0,"x":43.18,"y":46.99,"hdg":2.749,"batt":100.0,"det":false},{"id":1,"x":209.23,"y":46.65,"hdg":-2.923,"batt":100.0,"det":false},{"id":2,"x":42.47,"y":211.47,"hdg":-1.888,"batt":100.0,"det":false},{"id":3,"x":210.41,"y":207.26,"hdg":-1.701,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":139,"t":139.00,"coverage":0.0533,"drones":[{"id":0,"x":50.53,"y":43.83,"hdg":-0.406,"batt":100.0,"det":false},{"id":1,"x":216.44,"y":43.18,"hdg":-0.448,"batt":100.0,"det":false},{"id":2,"x":50.36,"y":212.77,"hdg":0.163,"batt":100.0,"det":false},{"id":3,"x":216.13,"y":212.85,"hdg":0.774,"batt":100.0,"det":false}]} -{"type":"episode","ep":19,"mean_return":40.6910,"policy_loss":-1099.2715,"value_loss":10639.4414,"victims_found":0} diff --git a/v2/crates/ruview-swarm/viz/sample_pheromone.jsonl b/v2/crates/ruview-swarm/viz/sample_pheromone.jsonl deleted file mode 100644 index fe968ac1..00000000 --- a/v2/crates/ruview-swarm/viz/sample_pheromone.jsonl +++ /dev/null @@ -1,161 +0,0 @@ -{"type":"meta","profile":"sar · flight=pheromone · learn=curiosity","drones":4,"area_w":400.00,"area_h":400.00,"victims":[[80.00,120.00],[240.00,180.00]]} -{"type":"episode","ep":0,"mean_return":909.8773,"policy_loss":-1373.0941,"value_loss":956946.5000,"victims_found":0} -{"type":"episode","ep":1,"mean_return":909.8773,"policy_loss":-2027.0466,"value_loss":955717.4375,"victims_found":0} -{"type":"episode","ep":2,"mean_return":909.8773,"policy_loss":-2704.4690,"value_loss":954429.7500,"victims_found":0} -{"type":"episode","ep":3,"mean_return":909.8773,"policy_loss":-3431.6497,"value_loss":953026.5000,"victims_found":0} -{"type":"episode","ep":4,"mean_return":909.8773,"policy_loss":-4220.8271,"value_loss":951425.5000,"victims_found":0} -{"type":"episode","ep":5,"mean_return":909.8773,"policy_loss":-5090.0303,"value_loss":949588.3750,"victims_found":0} -{"type":"episode","ep":6,"mean_return":909.8773,"policy_loss":-6055.3833,"value_loss":947438.6875,"victims_found":0} -{"type":"episode","ep":7,"mean_return":909.8773,"policy_loss":-7143.1519,"value_loss":944922.5000,"victims_found":0} -{"type":"episode","ep":8,"mean_return":909.8773,"policy_loss":-8401.0352,"value_loss":942037.0625,"victims_found":0} -{"type":"episode","ep":9,"mean_return":909.8773,"policy_loss":-9862.7295,"value_loss":938742.3125,"victims_found":0} -{"type":"episode","ep":10,"mean_return":909.8773,"policy_loss":-11555.9414,"value_loss":934963.1250,"victims_found":0} -{"type":"episode","ep":11,"mean_return":909.8773,"policy_loss":-13518.1543,"value_loss":930604.8125,"victims_found":0} -{"type":"episode","ep":12,"mean_return":909.8773,"policy_loss":-15794.6592,"value_loss":925595.4375,"victims_found":0} -{"type":"episode","ep":13,"mean_return":909.8773,"policy_loss":-18402.0176,"value_loss":919924.0000,"victims_found":0} -{"type":"episode","ep":14,"mean_return":909.8773,"policy_loss":-21357.6777,"value_loss":913558.3750,"victims_found":0} -{"type":"episode","ep":15,"mean_return":909.8773,"policy_loss":-24695.3242,"value_loss":906450.5000,"victims_found":0} -{"type":"episode","ep":16,"mean_return":909.8773,"policy_loss":-28444.9707,"value_loss":898552.9375,"victims_found":0} -{"type":"episode","ep":17,"mean_return":909.8773,"policy_loss":-32641.2109,"value_loss":889810.7500,"victims_found":0} -{"type":"episode","ep":18,"mean_return":909.8773,"policy_loss":-37315.1055,"value_loss":880183.2500,"victims_found":0} -{"type":"step","ep":19,"step":0,"t":0.00,"coverage":0.0139,"drones":[{"id":0,"x":18.00,"y":10.00,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":217.73,"y":12.07,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":6.95,"y":217.40,"hdg":1.962,"batt":100.0,"det":false},{"id":3,"x":215.66,"y":215.66,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":1,"t":1.00,"coverage":0.0192,"drones":[{"id":0,"x":18.00,"y":18.00,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":225.45,"y":14.14,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":9.02,"y":225.12,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":221.31,"y":221.31,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":2,"t":2.00,"coverage":0.0239,"drones":[{"id":0,"x":18.00,"y":26.00,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":233.18,"y":16.21,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":11.09,"y":232.85,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":226.97,"y":226.97,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":3,"t":3.00,"coverage":0.0292,"drones":[{"id":0,"x":18.00,"y":34.00,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":240.91,"y":18.28,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":13.16,"y":240.58,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":232.63,"y":232.63,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":4,"t":4.00,"coverage":0.0342,"drones":[{"id":0,"x":18.00,"y":42.00,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":248.64,"y":20.35,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":15.23,"y":248.31,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":238.28,"y":238.28,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":5,"t":5.00,"coverage":0.0400,"drones":[{"id":0,"x":18.00,"y":50.00,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":256.36,"y":22.42,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":17.30,"y":256.03,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":243.94,"y":243.94,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":6,"t":6.00,"coverage":0.0453,"drones":[{"id":0,"x":18.00,"y":58.00,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":264.09,"y":24.49,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":19.37,"y":263.76,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":249.60,"y":249.60,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":7,"t":7.00,"coverage":0.0503,"drones":[{"id":0,"x":18.00,"y":66.00,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":271.82,"y":26.56,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":21.44,"y":271.49,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":255.25,"y":255.25,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":8,"t":8.00,"coverage":0.0558,"drones":[{"id":0,"x":18.00,"y":74.00,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":279.55,"y":28.63,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":23.51,"y":279.22,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":260.91,"y":260.91,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":9,"t":9.00,"coverage":0.0608,"drones":[{"id":0,"x":18.00,"y":82.00,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":287.27,"y":30.71,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":25.58,"y":286.94,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":266.57,"y":266.57,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":10,"t":10.00,"coverage":0.0663,"drones":[{"id":0,"x":18.00,"y":90.00,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":295.00,"y":32.78,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":27.66,"y":294.67,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":272.23,"y":272.23,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":11,"t":11.00,"coverage":0.0712,"drones":[{"id":0,"x":18.00,"y":98.00,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":302.73,"y":34.85,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":29.73,"y":302.40,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":277.88,"y":277.88,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":12,"t":12.00,"coverage":0.0769,"drones":[{"id":0,"x":18.00,"y":106.00,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":310.46,"y":36.92,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":31.80,"y":310.12,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":283.54,"y":283.54,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":13,"t":13.00,"coverage":0.0817,"drones":[{"id":0,"x":18.00,"y":114.00,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":318.18,"y":38.99,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":33.87,"y":317.85,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":289.20,"y":289.20,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":14,"t":14.00,"coverage":0.0873,"drones":[{"id":0,"x":18.00,"y":122.00,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":325.91,"y":41.06,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":35.94,"y":325.58,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":294.85,"y":294.85,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":15,"t":15.00,"coverage":0.0925,"drones":[{"id":0,"x":12.62,"y":127.92,"hdg":2.309,"batt":100.0,"det":false},{"id":1,"x":333.64,"y":43.13,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":38.01,"y":333.31,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":300.51,"y":300.51,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":16,"t":16.00,"coverage":0.0980,"drones":[{"id":0,"x":12.62,"y":135.92,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":341.37,"y":45.20,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":40.08,"y":341.03,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":306.17,"y":306.17,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":17,"t":17.00,"coverage":0.1027,"drones":[{"id":0,"x":12.62,"y":143.92,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":349.09,"y":47.27,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":42.15,"y":348.76,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":311.82,"y":311.82,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":18,"t":18.00,"coverage":0.1080,"drones":[{"id":0,"x":12.62,"y":151.92,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":356.82,"y":49.34,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":44.22,"y":356.49,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":317.48,"y":317.48,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":19,"t":19.00,"coverage":0.1130,"drones":[{"id":0,"x":8.32,"y":158.67,"hdg":2.138,"batt":100.0,"det":false},{"id":1,"x":364.55,"y":51.41,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":46.29,"y":364.22,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":323.14,"y":323.14,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":20,"t":20.00,"coverage":0.1175,"drones":[{"id":0,"x":5.22,"y":166.04,"hdg":1.969,"batt":100.0,"det":false},{"id":1,"x":372.28,"y":53.48,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":48.36,"y":371.94,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":328.79,"y":328.79,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":21,"t":21.00,"coverage":0.1230,"drones":[{"id":0,"x":10.88,"y":171.70,"hdg":0.785,"batt":100.0,"det":false},{"id":1,"x":380.00,"y":55.55,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":50.43,"y":379.67,"hdg":1.309,"batt":100.0,"det":false},{"id":3,"x":334.45,"y":334.45,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":22,"t":22.00,"coverage":0.1281,"drones":[{"id":0,"x":16.53,"y":177.35,"hdg":0.785,"batt":100.0,"det":false},{"id":1,"x":384.00,"y":62.48,"hdg":1.047,"batt":100.0,"det":false},{"id":2,"x":57.36,"y":383.67,"hdg":0.524,"batt":100.0,"det":false},{"id":3,"x":340.11,"y":340.11,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":23,"t":23.00,"coverage":0.1338,"drones":[{"id":0,"x":24.53,"y":177.35,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":388.00,"y":69.41,"hdg":1.047,"batt":100.0,"det":false},{"id":2,"x":64.29,"y":387.67,"hdg":0.524,"batt":100.0,"det":false},{"id":3,"x":345.76,"y":345.76,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":24,"t":24.00,"coverage":0.1373,"drones":[{"id":0,"x":32.53,"y":177.35,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":391.55,"y":76.58,"hdg":1.111,"batt":100.0,"det":false},{"id":2,"x":71.42,"y":391.30,"hdg":0.470,"batt":100.0,"det":false},{"id":3,"x":351.42,"y":351.42,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":25,"t":25.00,"coverage":0.1419,"drones":[{"id":0,"x":40.53,"y":177.35,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":394.18,"y":84.13,"hdg":1.236,"batt":100.0,"det":false},{"id":2,"x":78.95,"y":394.00,"hdg":0.345,"batt":100.0,"det":false},{"id":3,"x":357.08,"y":357.08,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":26,"t":26.00,"coverage":0.1459,"drones":[{"id":0,"x":48.53,"y":177.35,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":396.05,"y":91.91,"hdg":1.335,"batt":100.0,"det":false},{"id":2,"x":86.71,"y":395.92,"hdg":0.243,"batt":100.0,"det":false},{"id":3,"x":362.74,"y":362.74,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":27,"t":27.00,"coverage":0.1497,"drones":[{"id":0,"x":56.53,"y":177.35,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":397.34,"y":99.81,"hdg":1.409,"batt":100.0,"det":false},{"id":2,"x":94.60,"y":397.25,"hdg":0.167,"batt":100.0,"det":false},{"id":3,"x":368.39,"y":368.39,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":28,"t":28.00,"coverage":0.1539,"drones":[{"id":0,"x":64.53,"y":177.35,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":398.21,"y":107.76,"hdg":1.461,"batt":100.0,"det":false},{"id":2,"x":102.55,"y":398.15,"hdg":0.113,"batt":100.0,"det":false},{"id":3,"x":374.05,"y":374.05,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":29,"t":29.00,"coverage":0.1577,"drones":[{"id":0,"x":72.53,"y":177.35,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":398.80,"y":115.74,"hdg":1.497,"batt":100.0,"det":false},{"id":2,"x":110.53,"y":398.76,"hdg":0.076,"batt":100.0,"det":false},{"id":3,"x":379.71,"y":379.71,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":30,"t":30.00,"coverage":0.1616,"drones":[{"id":0,"x":80.53,"y":177.35,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":396.73,"y":123.47,"hdg":1.833,"batt":100.0,"det":false},{"id":2,"x":118.26,"y":396.69,"hdg":-0.262,"batt":100.0,"det":false},{"id":3,"x":385.36,"y":385.36,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":31,"t":31.00,"coverage":0.1648,"drones":[{"id":0,"x":88.53,"y":177.35,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":397.80,"y":131.39,"hdg":1.437,"batt":100.0,"det":false},{"id":2,"x":126.18,"y":397.77,"hdg":0.136,"batt":100.0,"det":false},{"id":3,"x":391.02,"y":391.02,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":32,"t":32.00,"coverage":0.1680,"drones":[{"id":0,"x":96.53,"y":177.35,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":395.73,"y":139.12,"hdg":1.833,"batt":100.0,"det":false},{"id":2,"x":134.15,"y":398.50,"hdg":0.092,"batt":100.0,"det":false},{"id":3,"x":396.68,"y":396.68,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":33,"t":33.00,"coverage":0.1711,"drones":[{"id":0,"x":104.53,"y":177.35,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":397.12,"y":147.00,"hdg":1.396,"batt":100.0,"det":false},{"id":2,"x":141.88,"y":396.43,"hdg":-0.262,"batt":100.0,"det":false},{"id":3,"x":398.00,"y":388.79,"hdg":-1.404,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":34,"t":34.00,"coverage":0.1741,"drones":[{"id":0,"x":112.53,"y":177.35,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":398.06,"y":154.94,"hdg":1.452,"batt":100.0,"det":false},{"id":2,"x":149.79,"y":397.60,"hdg":0.146,"batt":100.0,"det":false},{"id":3,"x":398.00,"y":380.79,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":35,"t":35.00,"coverage":0.1772,"drones":[{"id":0,"x":120.53,"y":177.35,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":398.70,"y":162.92,"hdg":1.491,"batt":100.0,"det":false},{"id":2,"x":157.75,"y":398.39,"hdg":0.099,"batt":100.0,"det":false},{"id":3,"x":398.00,"y":372.79,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":36,"t":36.00,"coverage":0.1812,"drones":[{"id":0,"x":126.19,"y":171.70,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":396.63,"y":170.65,"hdg":1.833,"batt":100.0,"det":false},{"id":2,"x":165.74,"y":398.92,"hdg":0.066,"batt":100.0,"det":false},{"id":3,"x":398.00,"y":364.79,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":37,"t":37.00,"coverage":0.1847,"drones":[{"id":0,"x":131.85,"y":166.04,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":397.73,"y":178.57,"hdg":1.433,"batt":100.0,"det":false},{"id":2,"x":173.46,"y":396.85,"hdg":-0.262,"batt":100.0,"det":false},{"id":3,"x":398.00,"y":356.79,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":38,"t":38.00,"coverage":0.1886,"drones":[{"id":0,"x":137.50,"y":160.38,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":398.48,"y":186.54,"hdg":1.477,"batt":100.0,"det":false},{"id":2,"x":181.40,"y":397.88,"hdg":0.129,"batt":100.0,"det":false},{"id":3,"x":398.00,"y":348.79,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":39,"t":39.00,"coverage":0.1922,"drones":[{"id":0,"x":143.16,"y":154.73,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":398.98,"y":194.52,"hdg":1.508,"batt":100.0,"det":false},{"id":2,"x":189.37,"y":398.58,"hdg":0.087,"batt":100.0,"det":false},{"id":3,"x":398.00,"y":340.79,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":40,"t":40.00,"coverage":0.1955,"drones":[{"id":0,"x":148.82,"y":149.07,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":399.31,"y":202.51,"hdg":1.529,"batt":100.0,"det":false},{"id":2,"x":197.35,"y":399.04,"hdg":0.059,"batt":100.0,"det":false},{"id":3,"x":398.00,"y":332.79,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":41,"t":41.00,"coverage":0.1998,"drones":[{"id":0,"x":154.47,"y":143.41,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":399.54,"y":210.51,"hdg":1.543,"batt":100.0,"det":false},{"id":2,"x":205.35,"y":399.36,"hdg":0.039,"batt":100.0,"det":false},{"id":3,"x":398.00,"y":324.79,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":42,"t":42.00,"coverage":0.2027,"drones":[{"id":0,"x":160.13,"y":137.76,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":399.69,"y":218.51,"hdg":1.552,"batt":100.0,"det":false},{"id":2,"x":213.34,"y":399.57,"hdg":0.026,"batt":100.0,"det":false},{"id":3,"x":398.00,"y":316.79,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":43,"t":43.00,"coverage":0.2067,"drones":[{"id":0,"x":165.79,"y":132.10,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":399.79,"y":226.51,"hdg":1.558,"batt":100.0,"det":false},{"id":2,"x":221.34,"y":399.71,"hdg":0.018,"batt":100.0,"det":false},{"id":3,"x":398.00,"y":308.79,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":44,"t":44.00,"coverage":0.2102,"drones":[{"id":0,"x":171.45,"y":126.44,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":399.86,"y":234.51,"hdg":1.562,"batt":100.0,"det":false},{"id":2,"x":229.34,"y":399.81,"hdg":0.012,"batt":100.0,"det":false},{"id":3,"x":398.00,"y":300.79,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":45,"t":45.00,"coverage":0.2137,"drones":[{"id":0,"x":171.45,"y":118.44,"hdg":-1.571,"batt":100.0,"det":false},{"id":1,"x":399.91,"y":242.51,"hdg":1.565,"batt":100.0,"det":false},{"id":2,"x":237.34,"y":399.87,"hdg":0.008,"batt":100.0,"det":false},{"id":3,"x":398.00,"y":292.79,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":46,"t":46.00,"coverage":0.2173,"drones":[{"id":0,"x":171.45,"y":110.44,"hdg":-1.571,"batt":100.0,"det":false},{"id":1,"x":399.94,"y":250.51,"hdg":1.567,"batt":100.0,"det":false},{"id":2,"x":245.34,"y":399.91,"hdg":0.005,"batt":100.0,"det":false},{"id":3,"x":398.80,"y":284.83,"hdg":-1.470,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":47,"t":47.00,"coverage":0.2214,"drones":[{"id":0,"x":171.45,"y":102.44,"hdg":-1.571,"batt":100.0,"det":false},{"id":1,"x":392.21,"y":248.44,"hdg":-2.880,"batt":100.0,"det":false},{"id":2,"x":253.34,"y":399.94,"hdg":0.004,"batt":100.0,"det":false},{"id":3,"x":393.15,"y":279.17,"hdg":-2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":48,"t":48.00,"coverage":0.2266,"drones":[{"id":0,"x":171.45,"y":94.44,"hdg":-1.571,"batt":100.0,"det":false},{"id":1,"x":384.48,"y":246.37,"hdg":-2.880,"batt":100.0,"det":false},{"id":2,"x":261.34,"y":399.96,"hdg":0.002,"batt":100.0,"det":false},{"id":3,"x":385.15,"y":279.17,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":49,"t":49.00,"coverage":0.2311,"drones":[{"id":0,"x":171.45,"y":86.44,"hdg":-1.571,"batt":100.0,"det":false},{"id":1,"x":376.76,"y":244.30,"hdg":-2.880,"batt":100.0,"det":false},{"id":2,"x":269.34,"y":399.97,"hdg":0.002,"batt":100.0,"det":false},{"id":3,"x":377.15,"y":279.17,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":50,"t":50.00,"coverage":0.2364,"drones":[{"id":0,"x":171.45,"y":78.44,"hdg":-1.571,"batt":100.0,"det":false},{"id":1,"x":369.03,"y":242.22,"hdg":-2.880,"batt":100.0,"det":false},{"id":2,"x":277.34,"y":399.98,"hdg":0.001,"batt":100.0,"det":false},{"id":3,"x":369.15,"y":279.17,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":51,"t":51.00,"coverage":0.2412,"drones":[{"id":0,"x":171.45,"y":70.44,"hdg":-1.571,"batt":100.0,"det":false},{"id":1,"x":365.03,"y":235.30,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":285.34,"y":399.99,"hdg":0.001,"batt":100.0,"det":false},{"id":3,"x":361.15,"y":279.17,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":52,"t":52.00,"coverage":0.2462,"drones":[{"id":0,"x":171.45,"y":62.44,"hdg":-1.571,"batt":100.0,"det":false},{"id":1,"x":361.03,"y":228.37,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":293.34,"y":399.99,"hdg":0.000,"batt":100.0,"det":false},{"id":3,"x":355.49,"y":273.51,"hdg":-2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":53,"t":53.00,"coverage":0.2512,"drones":[{"id":0,"x":171.45,"y":54.44,"hdg":-1.571,"batt":100.0,"det":false},{"id":1,"x":357.03,"y":221.44,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":301.34,"y":399.99,"hdg":0.000,"batt":100.0,"det":false},{"id":3,"x":349.83,"y":267.86,"hdg":-2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":54,"t":54.00,"coverage":0.2559,"drones":[{"id":0,"x":171.45,"y":46.44,"hdg":-1.571,"batt":100.0,"det":false},{"id":1,"x":353.03,"y":214.51,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":309.34,"y":400.00,"hdg":0.000,"batt":100.0,"det":false},{"id":3,"x":344.18,"y":262.20,"hdg":-2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":55,"t":55.00,"coverage":0.2606,"drones":[{"id":0,"x":171.45,"y":38.44,"hdg":-1.571,"batt":100.0,"det":false},{"id":1,"x":349.03,"y":207.58,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":317.34,"y":400.00,"hdg":0.000,"batt":100.0,"det":false},{"id":3,"x":338.52,"y":256.54,"hdg":-2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":56,"t":56.00,"coverage":0.2656,"drones":[{"id":0,"x":171.45,"y":30.44,"hdg":-1.571,"batt":100.0,"det":false},{"id":1,"x":345.03,"y":200.66,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":325.34,"y":400.00,"hdg":0.000,"batt":100.0,"det":false},{"id":3,"x":332.86,"y":250.89,"hdg":-2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":57,"t":57.00,"coverage":0.2705,"drones":[{"id":0,"x":171.45,"y":22.44,"hdg":-1.571,"batt":100.0,"det":false},{"id":1,"x":341.03,"y":193.73,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":333.34,"y":400.00,"hdg":0.000,"batt":100.0,"det":false},{"id":3,"x":327.21,"y":245.23,"hdg":-2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":58,"t":58.00,"coverage":0.2752,"drones":[{"id":0,"x":165.79,"y":16.79,"hdg":-2.356,"batt":100.0,"det":false},{"id":1,"x":337.03,"y":186.80,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":341.34,"y":400.00,"hdg":0.000,"batt":100.0,"det":false},{"id":3,"x":321.55,"y":239.57,"hdg":-2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":59,"t":59.00,"coverage":0.2805,"drones":[{"id":0,"x":159.69,"y":11.61,"hdg":-2.438,"batt":100.0,"det":false},{"id":1,"x":333.03,"y":179.87,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":349.34,"y":400.00,"hdg":0.000,"batt":100.0,"det":false},{"id":3,"x":315.89,"y":233.92,"hdg":-2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":60,"t":60.00,"coverage":0.2847,"drones":[{"id":0,"x":152.79,"y":7.57,"hdg":-2.611,"batt":100.0,"det":false},{"id":1,"x":329.03,"y":172.94,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":357.34,"y":400.00,"hdg":0.000,"batt":100.0,"det":false},{"id":3,"x":310.24,"y":228.26,"hdg":-2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":61,"t":61.00,"coverage":0.2892,"drones":[{"id":0,"x":144.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":325.03,"y":166.01,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":365.34,"y":400.00,"hdg":0.000,"batt":100.0,"det":false},{"id":3,"x":304.58,"y":222.60,"hdg":-2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":62,"t":62.00,"coverage":0.2925,"drones":[{"id":0,"x":136.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":321.03,"y":159.09,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":373.34,"y":400.00,"hdg":0.000,"batt":100.0,"det":false},{"id":3,"x":296.58,"y":222.60,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":63,"t":63.00,"coverage":0.2959,"drones":[{"id":0,"x":128.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":317.03,"y":152.16,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":381.34,"y":400.00,"hdg":0.000,"batt":100.0,"det":false},{"id":3,"x":288.58,"y":222.60,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":64,"t":64.00,"coverage":0.3000,"drones":[{"id":0,"x":120.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":313.03,"y":145.23,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":389.34,"y":400.00,"hdg":0.000,"batt":100.0,"det":false},{"id":3,"x":280.58,"y":222.60,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":65,"t":65.00,"coverage":0.3031,"drones":[{"id":0,"x":112.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":309.03,"y":138.30,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":397.34,"y":400.00,"hdg":0.000,"batt":100.0,"det":false},{"id":3,"x":272.58,"y":222.60,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":66,"t":66.00,"coverage":0.3072,"drones":[{"id":0,"x":104.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":305.03,"y":131.37,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":390.41,"y":396.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":264.58,"y":222.60,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":67,"t":67.00,"coverage":0.3106,"drones":[{"id":0,"x":96.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":301.03,"y":124.45,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":383.48,"y":392.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":256.58,"y":222.60,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":68,"t":68.00,"coverage":0.3134,"drones":[{"id":0,"x":88.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":297.03,"y":117.52,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":376.56,"y":388.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":248.58,"y":222.60,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":69,"t":69.00,"coverage":0.3167,"drones":[{"id":0,"x":80.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":293.03,"y":110.59,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":369.63,"y":384.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":240.58,"y":222.60,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":70,"t":70.00,"coverage":0.3194,"drones":[{"id":0,"x":72.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":289.03,"y":103.66,"hdg":-2.094,"batt":100.0,"det":false},{"id":2,"x":362.70,"y":380.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":232.58,"y":222.60,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":71,"t":71.00,"coverage":0.3230,"drones":[{"id":0,"x":64.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":291.10,"y":95.93,"hdg":-1.309,"batt":100.0,"det":false},{"id":2,"x":355.77,"y":376.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":224.58,"y":222.60,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":72,"t":72.00,"coverage":0.3262,"drones":[{"id":0,"x":56.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":293.17,"y":88.21,"hdg":-1.309,"batt":100.0,"det":false},{"id":2,"x":348.84,"y":372.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":216.58,"y":222.60,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":73,"t":73.00,"coverage":0.3311,"drones":[{"id":0,"x":48.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":295.24,"y":80.48,"hdg":-1.309,"batt":100.0,"det":false},{"id":2,"x":341.92,"y":368.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":210.92,"y":228.26,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":74,"t":74.00,"coverage":0.3361,"drones":[{"id":0,"x":40.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":297.31,"y":72.75,"hdg":-1.309,"batt":100.0,"det":false},{"id":2,"x":334.99,"y":364.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":205.27,"y":233.92,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":75,"t":75.00,"coverage":0.3402,"drones":[{"id":0,"x":32.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":299.38,"y":65.02,"hdg":-1.309,"batt":100.0,"det":false},{"id":2,"x":328.06,"y":360.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":199.61,"y":239.57,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":76,"t":76.00,"coverage":0.3439,"drones":[{"id":0,"x":24.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":301.45,"y":57.30,"hdg":-1.309,"batt":100.0,"det":false},{"id":2,"x":321.13,"y":356.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":193.95,"y":245.23,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":77,"t":77.00,"coverage":0.3464,"drones":[{"id":0,"x":16.79,"y":7.57,"hdg":3.142,"batt":100.0,"det":false},{"id":1,"x":303.52,"y":49.57,"hdg":-1.309,"batt":100.0,"det":false},{"id":2,"x":314.20,"y":352.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":188.29,"y":250.89,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":78,"t":78.00,"coverage":0.3495,"drones":[{"id":0,"x":11.61,"y":13.67,"hdg":2.274,"batt":100.0,"det":false},{"id":1,"x":305.59,"y":41.84,"hdg":-1.309,"batt":100.0,"det":false},{"id":2,"x":307.27,"y":348.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":182.64,"y":256.54,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":79,"t":79.00,"coverage":0.3531,"drones":[{"id":0,"x":7.57,"y":20.57,"hdg":2.101,"batt":100.0,"det":false},{"id":1,"x":307.66,"y":34.11,"hdg":-1.309,"batt":100.0,"det":false},{"id":2,"x":300.35,"y":344.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":176.98,"y":262.20,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":80,"t":80.00,"coverage":0.3572,"drones":[{"id":0,"x":4.71,"y":28.04,"hdg":1.936,"batt":100.0,"det":false},{"id":1,"x":309.73,"y":26.39,"hdg":-1.309,"batt":100.0,"det":false},{"id":2,"x":293.42,"y":340.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":171.32,"y":267.86,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":81,"t":81.00,"coverage":0.3613,"drones":[{"id":0,"x":4.71,"y":36.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":311.85,"y":18.67,"hdg":-1.303,"batt":100.0,"det":false},{"id":2,"x":286.49,"y":336.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":165.67,"y":273.51,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":82,"t":82.00,"coverage":0.3661,"drones":[{"id":0,"x":4.71,"y":44.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":318.78,"y":14.67,"hdg":-0.524,"batt":100.0,"det":false},{"id":2,"x":279.56,"y":332.00,"hdg":-2.618,"batt":100.0,"det":false},{"id":3,"x":160.01,"y":279.17,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":83,"t":83.00,"coverage":0.3698,"drones":[{"id":0,"x":4.71,"y":52.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":325.71,"y":10.67,"hdg":-0.524,"batt":100.0,"det":false},{"id":2,"x":271.83,"y":334.07,"hdg":2.880,"batt":100.0,"det":false},{"id":3,"x":154.35,"y":284.83,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":84,"t":84.00,"coverage":0.3742,"drones":[{"id":0,"x":4.71,"y":60.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":333.03,"y":7.45,"hdg":-0.415,"batt":100.0,"det":false},{"id":2,"x":264.11,"y":336.14,"hdg":2.880,"batt":100.0,"det":false},{"id":3,"x":148.70,"y":290.48,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":85,"t":85.00,"coverage":0.3778,"drones":[{"id":0,"x":4.71,"y":68.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":340.68,"y":5.10,"hdg":-0.298,"batt":100.0,"det":false},{"id":2,"x":256.38,"y":338.21,"hdg":2.880,"batt":100.0,"det":false},{"id":3,"x":143.04,"y":296.14,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":86,"t":86.00,"coverage":0.3814,"drones":[{"id":0,"x":4.71,"y":76.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":348.51,"y":3.45,"hdg":-0.207,"batt":100.0,"det":false},{"id":2,"x":248.65,"y":340.28,"hdg":2.880,"batt":100.0,"det":false},{"id":3,"x":137.38,"y":301.80,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":87,"t":87.00,"coverage":0.3850,"drones":[{"id":0,"x":4.71,"y":84.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":356.43,"y":2.33,"hdg":-0.141,"batt":100.0,"det":false},{"id":2,"x":240.92,"y":342.35,"hdg":2.880,"batt":100.0,"det":false},{"id":3,"x":131.73,"y":307.45,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":88,"t":88.00,"coverage":0.3889,"drones":[{"id":0,"x":4.71,"y":92.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":364.39,"y":1.56,"hdg":-0.096,"batt":100.0,"det":false},{"id":2,"x":233.20,"y":344.42,"hdg":2.880,"batt":100.0,"det":false},{"id":3,"x":126.07,"y":313.11,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":89,"t":89.00,"coverage":0.3928,"drones":[{"id":0,"x":4.71,"y":100.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":372.37,"y":1.05,"hdg":-0.064,"batt":100.0,"det":false},{"id":2,"x":225.47,"y":346.49,"hdg":2.880,"batt":100.0,"det":false},{"id":3,"x":120.41,"y":318.77,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":90,"t":90.00,"coverage":0.3966,"drones":[{"id":0,"x":4.71,"y":108.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":380.10,"y":3.12,"hdg":0.262,"batt":100.0,"det":false},{"id":2,"x":217.74,"y":348.56,"hdg":2.880,"batt":100.0,"det":false},{"id":3,"x":114.76,"y":324.43,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":91,"t":91.00,"coverage":0.3998,"drones":[{"id":0,"x":4.71,"y":116.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":388.01,"y":1.88,"hdg":-0.155,"batt":100.0,"det":false},{"id":2,"x":210.01,"y":350.63,"hdg":2.880,"batt":100.0,"det":false},{"id":3,"x":109.10,"y":330.08,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":92,"t":92.00,"coverage":0.4034,"drones":[{"id":0,"x":4.71,"y":124.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":391.55,"y":9.05,"hdg":1.111,"batt":100.0,"det":false},{"id":2,"x":202.29,"y":352.71,"hdg":2.880,"batt":100.0,"det":false},{"id":3,"x":103.44,"y":335.74,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":93,"t":93.00,"coverage":0.4070,"drones":[{"id":0,"x":4.71,"y":132.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":394.18,"y":16.60,"hdg":1.236,"batt":100.0,"det":false},{"id":2,"x":194.56,"y":354.78,"hdg":2.880,"batt":100.0,"det":false},{"id":3,"x":97.79,"y":341.40,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":94,"t":94.00,"coverage":0.4108,"drones":[{"id":0,"x":4.71,"y":140.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":396.05,"y":24.38,"hdg":1.335,"batt":100.0,"det":false},{"id":2,"x":190.56,"y":361.70,"hdg":2.094,"batt":100.0,"det":false},{"id":3,"x":92.13,"y":347.05,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":95,"t":95.00,"coverage":0.4139,"drones":[{"id":0,"x":4.71,"y":148.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":397.34,"y":32.28,"hdg":1.409,"batt":100.0,"det":false},{"id":2,"x":186.56,"y":368.63,"hdg":2.094,"batt":100.0,"det":false},{"id":3,"x":86.47,"y":352.71,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":96,"t":96.00,"coverage":0.4170,"drones":[{"id":0,"x":4.71,"y":156.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":398.21,"y":40.23,"hdg":1.461,"batt":100.0,"det":false},{"id":2,"x":182.56,"y":375.56,"hdg":2.094,"batt":100.0,"det":false},{"id":3,"x":80.81,"y":358.37,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":97,"t":97.00,"coverage":0.4189,"drones":[{"id":0,"x":4.71,"y":164.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":398.80,"y":48.21,"hdg":1.497,"batt":100.0,"det":false},{"id":2,"x":178.56,"y":382.49,"hdg":2.094,"batt":100.0,"det":false},{"id":3,"x":75.16,"y":364.02,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":98,"t":98.00,"coverage":0.4191,"drones":[{"id":0,"x":4.71,"y":172.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":399.19,"y":56.20,"hdg":1.521,"batt":100.0,"det":false},{"id":2,"x":173.56,"y":388.74,"hdg":2.245,"batt":100.0,"det":false},{"id":3,"x":69.50,"y":369.68,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":99,"t":99.00,"coverage":0.4198,"drones":[{"id":0,"x":4.71,"y":180.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":399.46,"y":64.20,"hdg":1.538,"batt":100.0,"det":false},{"id":2,"x":165.84,"y":390.81,"hdg":2.880,"batt":100.0,"det":false},{"id":3,"x":63.84,"y":375.34,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":100,"t":100.00,"coverage":0.4208,"drones":[{"id":0,"x":4.71,"y":188.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":399.64,"y":72.19,"hdg":1.549,"batt":100.0,"det":false},{"id":2,"x":158.11,"y":392.88,"hdg":2.880,"batt":100.0,"det":false},{"id":3,"x":58.19,"y":380.99,"hdg":2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":101,"t":101.00,"coverage":0.4220,"drones":[{"id":0,"x":4.71,"y":196.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":399.76,"y":80.19,"hdg":1.556,"batt":100.0,"det":false},{"id":2,"x":150.37,"y":394.92,"hdg":2.884,"batt":100.0,"det":false},{"id":3,"x":52.42,"y":386.53,"hdg":2.377,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":102,"t":102.00,"coverage":0.4234,"drones":[{"id":0,"x":4.71,"y":204.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":399.84,"y":88.19,"hdg":1.561,"batt":100.0,"det":false},{"id":2,"x":142.51,"y":396.39,"hdg":2.956,"batt":100.0,"det":false},{"id":3,"x":44.42,"y":386.53,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":103,"t":103.00,"coverage":0.4245,"drones":[{"id":0,"x":4.71,"y":212.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":399.89,"y":96.19,"hdg":1.564,"batt":100.0,"det":false},{"id":2,"x":134.58,"y":397.45,"hdg":3.009,"batt":100.0,"det":false},{"id":3,"x":36.42,"y":386.53,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":104,"t":104.00,"coverage":0.4258,"drones":[{"id":0,"x":4.71,"y":220.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":399.93,"y":104.19,"hdg":1.566,"batt":100.0,"det":false},{"id":2,"x":126.62,"y":398.20,"hdg":3.048,"batt":100.0,"det":false},{"id":3,"x":28.42,"y":386.53,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":105,"t":105.00,"coverage":0.4272,"drones":[{"id":0,"x":4.71,"y":228.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":399.95,"y":112.19,"hdg":1.568,"batt":100.0,"det":false},{"id":2,"x":118.63,"y":398.73,"hdg":3.075,"batt":100.0,"det":false},{"id":3,"x":20.42,"y":386.53,"hdg":3.142,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":106,"t":106.00,"coverage":0.4280,"drones":[{"id":0,"x":4.71,"y":236.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":399.97,"y":120.19,"hdg":1.569,"batt":100.0,"det":false},{"id":2,"x":110.64,"y":399.11,"hdg":3.095,"batt":100.0,"det":false},{"id":3,"x":13.80,"y":391.03,"hdg":2.544,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":107,"t":107.00,"coverage":0.4283,"drones":[{"id":0,"x":4.71,"y":244.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":399.98,"y":128.19,"hdg":1.569,"batt":100.0,"det":false},{"id":2,"x":102.65,"y":399.37,"hdg":3.109,"batt":100.0,"det":false},{"id":3,"x":7.09,"y":395.39,"hdg":2.565,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":108,"t":108.00,"coverage":0.4288,"drones":[{"id":0,"x":4.71,"y":252.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":399.99,"y":136.19,"hdg":1.570,"batt":100.0,"det":false},{"id":2,"x":94.65,"y":399.56,"hdg":3.118,"batt":100.0,"det":false},{"id":3,"x":4.39,"y":387.86,"hdg":-1.915,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":109,"t":109.00,"coverage":0.4298,"drones":[{"id":0,"x":4.71,"y":260.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":399.99,"y":144.19,"hdg":1.570,"batt":100.0,"det":false},{"id":2,"x":86.65,"y":399.69,"hdg":3.125,"batt":100.0,"det":false},{"id":3,"x":4.39,"y":379.86,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":110,"t":110.00,"coverage":0.4311,"drones":[{"id":0,"x":4.71,"y":268.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":399.99,"y":152.19,"hdg":1.570,"batt":100.0,"det":false},{"id":2,"x":78.65,"y":399.78,"hdg":3.130,"batt":100.0,"det":false},{"id":3,"x":4.39,"y":371.86,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":111,"t":111.00,"coverage":0.4328,"drones":[{"id":0,"x":4.71,"y":276.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":400.00,"y":160.19,"hdg":1.571,"batt":100.0,"det":false},{"id":2,"x":70.65,"y":399.85,"hdg":3.133,"batt":100.0,"det":false},{"id":3,"x":4.39,"y":363.86,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":112,"t":112.00,"coverage":0.4347,"drones":[{"id":0,"x":4.71,"y":284.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":400.00,"y":168.19,"hdg":1.571,"batt":100.0,"det":false},{"id":2,"x":62.65,"y":399.89,"hdg":3.136,"batt":100.0,"det":false},{"id":3,"x":4.39,"y":355.86,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":113,"t":113.00,"coverage":0.4361,"drones":[{"id":0,"x":4.71,"y":292.04,"hdg":1.571,"batt":100.0,"det":false},{"id":1,"x":400.00,"y":176.19,"hdg":1.571,"batt":100.0,"det":false},{"id":2,"x":54.65,"y":399.92,"hdg":3.138,"batt":100.0,"det":false},{"id":3,"x":4.39,"y":347.86,"hdg":-1.571,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":114,"t":114.00,"coverage":0.4377,"drones":[{"id":0,"x":2.86,"y":299.82,"hdg":1.804,"batt":100.0,"det":false},{"id":1,"x":400.00,"y":184.19,"hdg":1.571,"batt":100.0,"det":false},{"id":2,"x":46.65,"y":399.95,"hdg":3.139,"batt":100.0,"det":false},{"id":3,"x":2.66,"y":340.05,"hdg":-1.789,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":115,"t":115.00,"coverage":0.4386,"drones":[{"id":0,"x":1.72,"y":307.74,"hdg":1.714,"batt":100.0,"det":false},{"id":1,"x":400.00,"y":192.19,"hdg":1.571,"batt":100.0,"det":false},{"id":2,"x":38.65,"y":399.96,"hdg":3.140,"batt":100.0,"det":false},{"id":3,"x":1.60,"y":332.12,"hdg":-1.704,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":116,"t":116.00,"coverage":0.4403,"drones":[{"id":0,"x":9.72,"y":307.74,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":397.93,"y":199.92,"hdg":1.833,"batt":100.0,"det":false},{"id":2,"x":30.65,"y":399.97,"hdg":3.140,"batt":100.0,"det":false},{"id":3,"x":9.60,"y":332.12,"hdg":0.000,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":117,"t":117.00,"coverage":0.4403,"drones":[{"id":0,"x":15.37,"y":302.09,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":398.61,"y":207.89,"hdg":1.486,"batt":100.0,"det":false},{"id":2,"x":22.65,"y":399.98,"hdg":3.141,"batt":100.0,"det":false},{"id":3,"x":15.25,"y":326.46,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":118,"t":118.00,"coverage":0.4403,"drones":[{"id":0,"x":21.03,"y":296.43,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":399.07,"y":215.88,"hdg":1.514,"batt":100.0,"det":false},{"id":2,"x":14.65,"y":399.99,"hdg":3.141,"batt":100.0,"det":false},{"id":3,"x":23.25,"y":326.46,"hdg":0.000,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":119,"t":119.00,"coverage":0.4403,"drones":[{"id":0,"x":26.69,"y":290.77,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":399.37,"y":223.87,"hdg":1.532,"batt":100.0,"det":false},{"id":2,"x":6.65,"y":399.99,"hdg":3.141,"batt":100.0,"det":false},{"id":3,"x":28.91,"y":320.81,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":120,"t":120.00,"coverage":0.4414,"drones":[{"id":0,"x":32.34,"y":285.11,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":399.58,"y":231.87,"hdg":1.545,"batt":100.0,"det":false},{"id":2,"x":0.00,"y":400.00,"hdg":3.141,"batt":100.0,"det":false},{"id":3,"x":34.57,"y":315.15,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":121,"t":121.00,"coverage":0.4431,"drones":[{"id":0,"x":38.00,"y":279.46,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":399.72,"y":239.87,"hdg":1.554,"batt":100.0,"det":false},{"id":2,"x":0.00,"y":392.00,"hdg":-1.571,"batt":100.0,"det":false},{"id":3,"x":40.22,"y":309.49,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":122,"t":122.00,"coverage":0.4458,"drones":[{"id":0,"x":43.66,"y":273.80,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":399.81,"y":247.87,"hdg":1.559,"batt":100.0,"det":false},{"id":2,"x":4.00,"y":385.07,"hdg":-1.047,"batt":100.0,"det":false},{"id":3,"x":45.88,"y":303.84,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":123,"t":123.00,"coverage":0.4484,"drones":[{"id":0,"x":49.31,"y":268.14,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":399.87,"y":255.87,"hdg":1.563,"batt":100.0,"det":false},{"id":2,"x":8.00,"y":378.14,"hdg":-1.047,"batt":100.0,"det":false},{"id":3,"x":51.54,"y":298.18,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":124,"t":124.00,"coverage":0.4514,"drones":[{"id":0,"x":54.97,"y":262.49,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":397.80,"y":263.60,"hdg":1.833,"batt":100.0,"det":false},{"id":2,"x":12.00,"y":371.22,"hdg":-1.047,"batt":100.0,"det":false},{"id":3,"x":57.19,"y":292.52,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":125,"t":125.00,"coverage":0.4545,"drones":[{"id":0,"x":60.63,"y":256.83,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":398.53,"y":271.56,"hdg":1.480,"batt":100.0,"det":false},{"id":2,"x":16.00,"y":364.29,"hdg":-1.047,"batt":100.0,"det":false},{"id":3,"x":62.85,"y":286.87,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":126,"t":126.00,"coverage":0.4575,"drones":[{"id":0,"x":66.28,"y":251.17,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":399.01,"y":279.55,"hdg":1.510,"batt":100.0,"det":false},{"id":2,"x":23.73,"y":362.22,"hdg":-0.262,"batt":100.0,"det":false},{"id":3,"x":68.51,"y":281.21,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":127,"t":127.00,"coverage":0.4606,"drones":[{"id":0,"x":71.94,"y":245.52,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":399.34,"y":287.54,"hdg":1.530,"batt":100.0,"det":false},{"id":2,"x":31.45,"y":360.15,"hdg":-0.262,"batt":100.0,"det":false},{"id":3,"x":74.16,"y":275.55,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":128,"t":128.00,"coverage":0.4630,"drones":[{"id":0,"x":77.60,"y":239.86,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":397.27,"y":295.27,"hdg":1.833,"batt":100.0,"det":false},{"id":2,"x":39.18,"y":358.08,"hdg":-0.262,"batt":100.0,"det":false},{"id":3,"x":79.82,"y":269.90,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":129,"t":129.00,"coverage":0.4655,"drones":[{"id":0,"x":83.25,"y":234.20,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":398.16,"y":303.22,"hdg":1.459,"batt":100.0,"det":false},{"id":2,"x":43.18,"y":351.15,"hdg":-1.047,"batt":100.0,"det":false},{"id":3,"x":85.48,"y":264.24,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":130,"t":130.00,"coverage":0.4688,"drones":[{"id":0,"x":88.91,"y":228.55,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":396.09,"y":310.95,"hdg":1.833,"batt":100.0,"det":false},{"id":2,"x":47.18,"y":344.22,"hdg":-1.047,"batt":100.0,"det":false},{"id":3,"x":91.13,"y":258.58,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":131,"t":131.00,"coverage":0.4725,"drones":[{"id":0,"x":94.57,"y":222.89,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":397.36,"y":318.84,"hdg":1.411,"batt":100.0,"det":false},{"id":2,"x":54.91,"y":342.15,"hdg":-0.262,"batt":100.0,"det":false},{"id":3,"x":96.79,"y":252.93,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":132,"t":132.00,"coverage":0.4766,"drones":[{"id":0,"x":100.22,"y":217.23,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":395.29,"y":326.57,"hdg":1.833,"batt":100.0,"det":false},{"id":2,"x":58.91,"y":335.22,"hdg":-1.047,"batt":100.0,"det":false},{"id":3,"x":102.45,"y":247.27,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":133,"t":133.00,"coverage":0.4800,"drones":[{"id":0,"x":105.88,"y":211.58,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":396.82,"y":334.42,"hdg":1.379,"batt":100.0,"det":false},{"id":2,"x":66.64,"y":333.15,"hdg":-0.262,"batt":100.0,"det":false},{"id":3,"x":108.11,"y":241.61,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":134,"t":134.00,"coverage":0.4847,"drones":[{"id":0,"x":111.54,"y":205.92,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":394.75,"y":342.15,"hdg":1.833,"batt":100.0,"det":false},{"id":2,"x":70.64,"y":326.22,"hdg":-1.047,"batt":100.0,"det":false},{"id":3,"x":113.76,"y":235.96,"hdg":-0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":135,"t":135.00,"coverage":0.4889,"drones":[{"id":0,"x":117.20,"y":200.26,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":396.44,"y":349.97,"hdg":1.357,"batt":100.0,"det":false},{"id":2,"x":74.64,"y":319.29,"hdg":-1.047,"batt":100.0,"det":false},{"id":3,"x":121.76,"y":235.96,"hdg":0.000,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":136,"t":136.00,"coverage":0.4927,"drones":[{"id":0,"x":122.85,"y":194.60,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":394.37,"y":357.70,"hdg":1.833,"batt":100.0,"det":false},{"id":2,"x":82.36,"y":317.22,"hdg":-0.262,"batt":100.0,"det":false},{"id":3,"x":129.76,"y":235.96,"hdg":0.000,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":137,"t":137.00,"coverage":0.4963,"drones":[{"id":0,"x":128.51,"y":188.95,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":396.18,"y":365.49,"hdg":1.343,"batt":100.0,"det":false},{"id":2,"x":86.36,"y":310.29,"hdg":-1.047,"batt":100.0,"det":false},{"id":3,"x":137.76,"y":235.96,"hdg":0.000,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":138,"t":138.00,"coverage":0.5002,"drones":[{"id":0,"x":134.17,"y":183.29,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":394.11,"y":373.22,"hdg":1.833,"batt":100.0,"det":false},{"id":2,"x":94.09,"y":308.22,"hdg":-0.262,"batt":100.0,"det":false},{"id":3,"x":145.76,"y":235.96,"hdg":0.000,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":139,"t":139.00,"coverage":0.5031,"drones":[{"id":0,"x":139.82,"y":177.63,"hdg":-0.785,"batt":100.0,"det":false},{"id":1,"x":396.00,"y":380.99,"hdg":1.332,"batt":100.0,"det":false},{"id":2,"x":101.82,"y":306.15,"hdg":-0.262,"batt":100.0,"det":false},{"id":3,"x":153.76,"y":235.96,"hdg":0.000,"batt":100.0,"det":false}]} -{"type":"episode","ep":19,"mean_return":909.8773,"policy_loss":-42498.6836,"value_loss":869627.1875,"victims_found":0} diff --git a/v2/crates/ruview-swarm/viz/sample_potential.jsonl b/v2/crates/ruview-swarm/viz/sample_potential.jsonl deleted file mode 100644 index ea561816..00000000 --- a/v2/crates/ruview-swarm/viz/sample_potential.jsonl +++ /dev/null @@ -1,161 +0,0 @@ -{"type":"meta","profile":"sar · flight=potential_field · learn=curiosity","drones":4,"area_w":400.00,"area_h":400.00,"victims":[[80.00,120.00],[240.00,180.00]]} -{"type":"episode","ep":0,"mean_return":790.7200,"policy_loss":-161.5661,"value_loss":732194.5000,"victims_found":0} -{"type":"episode","ep":1,"mean_return":790.7200,"policy_loss":-542.0729,"value_loss":731474.0625,"victims_found":0} -{"type":"episode","ep":2,"mean_return":790.7200,"policy_loss":-939.8240,"value_loss":730732.5000,"victims_found":0} -{"type":"episode","ep":3,"mean_return":790.7200,"policy_loss":-1360.9113,"value_loss":729943.0625,"victims_found":0} -{"type":"episode","ep":4,"mean_return":790.7200,"policy_loss":-1822.4675,"value_loss":729064.3125,"victims_found":0} -{"type":"episode","ep":5,"mean_return":790.7200,"policy_loss":-2340.6995,"value_loss":728044.3750,"victims_found":0} -{"type":"episode","ep":6,"mean_return":790.7200,"policy_loss":-2947.6719,"value_loss":726849.3125,"victims_found":0} -{"type":"episode","ep":7,"mean_return":790.7200,"policy_loss":-3673.3933,"value_loss":725479.9375,"victims_found":0} -{"type":"episode","ep":8,"mean_return":790.7200,"policy_loss":-4515.3745,"value_loss":723905.6875,"victims_found":0} -{"type":"episode","ep":9,"mean_return":790.7200,"policy_loss":-5475.6289,"value_loss":722112.9375,"victims_found":0} -{"type":"episode","ep":10,"mean_return":790.7200,"policy_loss":-6563.5044,"value_loss":720079.1875,"victims_found":0} -{"type":"episode","ep":11,"mean_return":790.7200,"policy_loss":-7794.2510,"value_loss":717761.7500,"victims_found":0} -{"type":"episode","ep":12,"mean_return":790.7200,"policy_loss":-9184.0117,"value_loss":715111.0000,"victims_found":0} -{"type":"episode","ep":13,"mean_return":790.7200,"policy_loss":-10754.7227,"value_loss":712075.4375,"victims_found":0} -{"type":"episode","ep":14,"mean_return":790.7200,"policy_loss":-12540.5859,"value_loss":708619.3125,"victims_found":0} -{"type":"episode","ep":15,"mean_return":790.7200,"policy_loss":-14575.9746,"value_loss":704713.6875,"victims_found":0} -{"type":"episode","ep":16,"mean_return":790.7200,"policy_loss":-16887.0879,"value_loss":700318.0625,"victims_found":0} -{"type":"episode","ep":17,"mean_return":790.7200,"policy_loss":-19494.5566,"value_loss":695366.0625,"victims_found":0} -{"type":"episode","ep":18,"mean_return":790.7200,"policy_loss":-22436.5410,"value_loss":689809.6875,"victims_found":0} -{"type":"step","ep":19,"step":0,"t":0.00,"coverage":0.0156,"drones":[{"id":0,"x":15.66,"y":15.66,"hdg":0.785,"batt":100.0,"det":false},{"id":1,"x":213.50,"y":17.19,"hdg":1.117,"batt":100.0,"det":false},{"id":2,"x":17.19,"y":213.50,"hdg":0.453,"batt":100.0,"det":false},{"id":3,"x":215.66,"y":215.66,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":1,"t":1.00,"coverage":0.0206,"drones":[{"id":0,"x":21.31,"y":21.31,"hdg":0.785,"batt":100.0,"det":false},{"id":1,"x":217.01,"y":24.38,"hdg":1.117,"batt":100.0,"det":false},{"id":2,"x":24.38,"y":217.01,"hdg":0.453,"batt":100.0,"det":false},{"id":3,"x":221.31,"y":221.31,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":2,"t":2.00,"coverage":0.0256,"drones":[{"id":0,"x":26.97,"y":26.97,"hdg":0.785,"batt":100.0,"det":false},{"id":1,"x":220.51,"y":31.57,"hdg":1.117,"batt":100.0,"det":false},{"id":2,"x":31.57,"y":220.51,"hdg":0.453,"batt":100.0,"det":false},{"id":3,"x":226.97,"y":226.97,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":3,"t":3.00,"coverage":0.0306,"drones":[{"id":0,"x":32.63,"y":32.63,"hdg":0.785,"batt":100.0,"det":false},{"id":1,"x":224.02,"y":38.77,"hdg":1.117,"batt":100.0,"det":false},{"id":2,"x":38.77,"y":224.02,"hdg":0.454,"batt":100.0,"det":false},{"id":3,"x":232.63,"y":232.63,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":4,"t":4.00,"coverage":0.0353,"drones":[{"id":0,"x":38.28,"y":38.28,"hdg":0.785,"batt":100.0,"det":false},{"id":1,"x":227.52,"y":45.96,"hdg":1.117,"batt":100.0,"det":false},{"id":2,"x":45.96,"y":227.52,"hdg":0.454,"batt":100.0,"det":false},{"id":3,"x":238.28,"y":238.28,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":5,"t":5.00,"coverage":0.0406,"drones":[{"id":0,"x":43.94,"y":43.94,"hdg":0.785,"batt":100.0,"det":false},{"id":1,"x":231.03,"y":53.15,"hdg":1.117,"batt":100.0,"det":false},{"id":2,"x":53.15,"y":231.03,"hdg":0.454,"batt":100.0,"det":false},{"id":3,"x":243.94,"y":243.94,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":6,"t":6.00,"coverage":0.0462,"drones":[{"id":0,"x":49.60,"y":49.60,"hdg":0.785,"batt":100.0,"det":false},{"id":1,"x":234.53,"y":60.34,"hdg":1.117,"batt":100.0,"det":false},{"id":2,"x":60.34,"y":234.54,"hdg":0.454,"batt":100.0,"det":false},{"id":3,"x":249.60,"y":249.60,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":7,"t":7.00,"coverage":0.0509,"drones":[{"id":0,"x":55.25,"y":55.25,"hdg":0.785,"batt":100.0,"det":false},{"id":1,"x":238.04,"y":67.53,"hdg":1.117,"batt":100.0,"det":false},{"id":2,"x":67.53,"y":238.04,"hdg":0.454,"batt":100.0,"det":false},{"id":3,"x":255.25,"y":255.25,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":8,"t":8.00,"coverage":0.0569,"drones":[{"id":0,"x":60.91,"y":60.91,"hdg":0.785,"batt":100.0,"det":false},{"id":1,"x":241.55,"y":74.72,"hdg":1.117,"batt":100.0,"det":false},{"id":2,"x":74.72,"y":241.55,"hdg":0.454,"batt":100.0,"det":false},{"id":3,"x":260.91,"y":260.91,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":9,"t":9.00,"coverage":0.0622,"drones":[{"id":0,"x":66.57,"y":66.57,"hdg":0.785,"batt":100.0,"det":false},{"id":1,"x":245.05,"y":81.91,"hdg":1.117,"batt":100.0,"det":false},{"id":2,"x":81.91,"y":245.05,"hdg":0.454,"batt":100.0,"det":false},{"id":3,"x":266.57,"y":266.57,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":10,"t":10.00,"coverage":0.0669,"drones":[{"id":0,"x":72.23,"y":72.23,"hdg":0.785,"batt":100.0,"det":false},{"id":1,"x":248.56,"y":89.10,"hdg":1.117,"batt":100.0,"det":false},{"id":2,"x":89.10,"y":248.56,"hdg":0.454,"batt":100.0,"det":false},{"id":3,"x":272.23,"y":272.23,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":11,"t":11.00,"coverage":0.0722,"drones":[{"id":0,"x":77.88,"y":77.88,"hdg":0.785,"batt":100.0,"det":false},{"id":1,"x":252.07,"y":96.29,"hdg":1.117,"batt":100.0,"det":false},{"id":2,"x":96.29,"y":252.07,"hdg":0.454,"batt":100.0,"det":false},{"id":3,"x":277.88,"y":277.88,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":12,"t":12.00,"coverage":0.0775,"drones":[{"id":0,"x":85.68,"y":76.10,"hdg":-0.224,"batt":100.0,"det":false},{"id":1,"x":258.84,"y":92.03,"hdg":-0.561,"batt":100.0,"det":false},{"id":2,"x":92.03,"y":258.84,"hdg":2.132,"batt":100.0,"det":false},{"id":3,"x":283.54,"y":283.54,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":13,"t":13.00,"coverage":0.0830,"drones":[{"id":0,"x":93.46,"y":74.25,"hdg":-0.234,"batt":100.0,"det":false},{"id":1,"x":265.58,"y":87.73,"hdg":-0.568,"batt":100.0,"det":false},{"id":2,"x":87.73,"y":265.58,"hdg":2.139,"batt":100.0,"det":false},{"id":3,"x":289.20,"y":289.20,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":14,"t":14.00,"coverage":0.0880,"drones":[{"id":0,"x":101.24,"y":72.38,"hdg":-0.236,"batt":100.0,"det":false},{"id":1,"x":272.30,"y":83.39,"hdg":-0.573,"batt":100.0,"det":false},{"id":2,"x":83.39,"y":272.30,"hdg":2.144,"batt":100.0,"det":false},{"id":3,"x":294.85,"y":294.85,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":15,"t":15.00,"coverage":0.0941,"drones":[{"id":0,"x":109.02,"y":70.50,"hdg":-0.237,"batt":100.0,"det":false},{"id":1,"x":279.01,"y":79.03,"hdg":-0.576,"batt":100.0,"det":false},{"id":2,"x":79.03,"y":279.01,"hdg":2.146,"batt":100.0,"det":false},{"id":3,"x":300.51,"y":300.51,"hdg":0.785,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":16,"t":16.00,"coverage":0.0975,"drones":[{"id":0,"x":110.37,"y":78.39,"hdg":1.401,"batt":100.0,"det":false},{"id":1,"x":276.32,"y":86.57,"hdg":1.914,"batt":100.0,"det":false},{"id":2,"x":83.38,"y":285.73,"hdg":0.996,"batt":100.0,"det":false},{"id":3,"x":303.14,"y":292.95,"hdg":-1.236,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":17,"t":17.00,"coverage":0.1011,"drones":[{"id":0,"x":118.12,"y":76.42,"hdg":-0.248,"batt":100.0,"det":false},{"id":1,"x":283.03,"y":82.21,"hdg":-0.576,"batt":100.0,"det":false},{"id":2,"x":89.41,"y":280.47,"hdg":-0.718,"batt":100.0,"det":false},{"id":3,"x":305.76,"y":285.40,"hdg":-1.236,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":18,"t":18.00,"coverage":0.1047,"drones":[{"id":0,"x":125.86,"y":74.38,"hdg":-0.259,"batt":100.0,"det":false},{"id":1,"x":289.70,"y":77.79,"hdg":-0.585,"batt":100.0,"det":false},{"id":2,"x":84.74,"y":286.96,"hdg":2.194,"batt":100.0,"det":false},{"id":3,"x":298.25,"y":288.15,"hdg":2.791,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":19,"t":19.00,"coverage":0.1067,"drones":[{"id":0,"x":123.08,"y":81.88,"hdg":1.925,"batt":100.0,"det":false},{"id":1,"x":284.42,"y":83.80,"hdg":2.292,"batt":100.0,"det":false},{"id":2,"x":80.88,"y":293.97,"hdg":2.074,"batt":100.0,"det":false},{"id":3,"x":303.70,"y":294.00,"hdg":0.821,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":20,"t":20.00,"coverage":0.1108,"drones":[{"id":0,"x":128.31,"y":87.94,"hdg":0.859,"batt":100.0,"det":false},{"id":1,"x":287.53,"y":91.17,"hdg":1.171,"batt":100.0,"det":false},{"id":2,"x":88.39,"y":296.71,"hdg":0.350,"batt":100.0,"det":false},{"id":3,"x":308.90,"y":300.08,"hdg":0.863,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":21,"t":21.00,"coverage":0.1166,"drones":[{"id":0,"x":133.56,"y":93.97,"hdg":0.855,"batt":100.0,"det":false},{"id":1,"x":290.34,"y":98.66,"hdg":1.212,"batt":100.0,"det":false},{"id":2,"x":95.95,"y":299.35,"hdg":0.336,"batt":100.0,"det":false},{"id":3,"x":314.33,"y":305.96,"hdg":0.825,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":22,"t":22.00,"coverage":0.1202,"drones":[{"id":0,"x":141.15,"y":91.44,"hdg":-0.323,"batt":100.0,"det":false},{"id":1,"x":296.41,"y":93.45,"hdg":-0.710,"batt":100.0,"det":false},{"id":2,"x":101.76,"y":293.86,"hdg":-0.757,"batt":100.0,"det":false},{"id":3,"x":316.66,"y":298.30,"hdg":-1.276,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":23,"t":23.00,"coverage":0.1227,"drones":[{"id":0,"x":148.71,"y":88.82,"hdg":-0.333,"batt":100.0,"det":false},{"id":1,"x":302.45,"y":88.20,"hdg":-0.715,"batt":100.0,"det":false},{"id":2,"x":96.31,"y":299.71,"hdg":2.322,"batt":100.0,"det":false},{"id":3,"x":309.05,"y":300.78,"hdg":2.827,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":24,"t":24.00,"coverage":0.1247,"drones":[{"id":0,"x":145.36,"y":96.08,"hdg":2.003,"batt":100.0,"det":false},{"id":1,"x":296.96,"y":94.02,"hdg":2.328,"batt":100.0,"det":false},{"id":2,"x":92.37,"y":306.67,"hdg":2.085,"batt":100.0,"det":false},{"id":3,"x":312.68,"y":293.65,"hdg":-1.100,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":25,"t":25.00,"coverage":0.1266,"drones":[{"id":0,"x":152.92,"y":93.47,"hdg":-0.332,"batt":100.0,"det":false},{"id":1,"x":304.07,"y":90.36,"hdg":-0.475,"batt":100.0,"det":false},{"id":2,"x":98.15,"y":301.14,"hdg":-0.763,"batt":100.0,"det":false},{"id":3,"x":315.10,"y":286.02,"hdg":-1.263,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":26,"t":26.00,"coverage":0.1295,"drones":[{"id":0,"x":160.46,"y":90.79,"hdg":-0.342,"batt":100.0,"det":false},{"id":1,"x":310.36,"y":85.42,"hdg":-0.666,"batt":100.0,"det":false},{"id":2,"x":93.64,"y":307.75,"hdg":2.170,"batt":100.0,"det":false},{"id":3,"x":307.54,"y":288.63,"hdg":2.809,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":27,"t":27.00,"coverage":0.1314,"drones":[{"id":0,"x":156.90,"y":97.96,"hdg":2.032,"batt":100.0,"det":false},{"id":1,"x":304.82,"y":91.19,"hdg":2.336,"batt":100.0,"det":false},{"id":2,"x":88.97,"y":314.24,"hdg":2.195,"batt":100.0,"det":false},{"id":3,"x":312.85,"y":294.62,"hdg":0.846,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":28,"t":28.00,"coverage":0.1348,"drones":[{"id":0,"x":161.90,"y":104.20,"hdg":0.895,"batt":100.0,"det":false},{"id":1,"x":307.96,"y":98.55,"hdg":1.168,"batt":100.0,"det":false},{"id":2,"x":96.60,"y":316.64,"hdg":0.305,"batt":100.0,"det":false},{"id":3,"x":317.52,"y":301.11,"hdg":0.947,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":29,"t":29.00,"coverage":0.1405,"drones":[{"id":0,"x":166.91,"y":110.44,"hdg":0.893,"batt":100.0,"det":false},{"id":1,"x":310.41,"y":106.16,"hdg":1.259,"batt":100.0,"det":false},{"id":2,"x":104.26,"y":318.95,"hdg":0.293,"batt":100.0,"det":false},{"id":3,"x":322.69,"y":307.22,"hdg":0.869,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":30,"t":30.00,"coverage":0.1439,"drones":[{"id":0,"x":174.21,"y":107.14,"hdg":-0.424,"batt":100.0,"det":false},{"id":1,"x":315.73,"y":100.18,"hdg":-0.844,"batt":100.0,"det":false},{"id":2,"x":109.85,"y":313.23,"hdg":-0.797,"batt":100.0,"det":false},{"id":3,"x":324.96,"y":299.55,"hdg":-1.283,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":31,"t":31.00,"coverage":0.1462,"drones":[{"id":0,"x":181.46,"y":103.78,"hdg":-0.435,"batt":100.0,"det":false},{"id":1,"x":321.05,"y":94.21,"hdg":-0.843,"batt":100.0,"det":false},{"id":2,"x":103.66,"y":318.29,"hdg":2.456,"batt":100.0,"det":false},{"id":3,"x":317.34,"y":302.00,"hdg":2.830,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":32,"t":32.00,"coverage":0.1473,"drones":[{"id":0,"x":177.37,"y":110.65,"hdg":2.108,"batt":100.0,"det":false},{"id":1,"x":315.34,"y":99.81,"hdg":2.365,"batt":100.0,"det":false},{"id":2,"x":96.48,"y":321.83,"hdg":2.684,"batt":100.0,"det":false},{"id":3,"x":310.50,"y":306.15,"hdg":2.596,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":33,"t":33.00,"coverage":0.1494,"drones":[{"id":0,"x":173.45,"y":117.63,"hdg":2.082,"batt":100.0,"det":false},{"id":1,"x":308.51,"y":103.98,"hdg":2.594,"batt":100.0,"det":false},{"id":2,"x":90.42,"y":327.05,"hdg":2.430,"batt":100.0,"det":false},{"id":3,"x":312.56,"y":298.42,"hdg":-1.311,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":34,"t":34.00,"coverage":0.1498,"drones":[{"id":0,"x":180.64,"y":114.12,"hdg":-0.454,"batt":100.0,"det":false},{"id":1,"x":313.57,"y":97.78,"hdg":-0.886,"batt":100.0,"det":false},{"id":2,"x":95.97,"y":321.28,"hdg":-0.805,"batt":100.0,"det":false},{"id":3,"x":314.91,"y":290.77,"hdg":-1.273,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":35,"t":35.00,"coverage":0.1509,"drones":[{"id":0,"x":187.90,"y":110.75,"hdg":-0.435,"batt":100.0,"det":false},{"id":1,"x":318.29,"y":91.32,"hdg":-0.940,"batt":100.0,"det":false},{"id":2,"x":99.98,"y":314.37,"hdg":-1.044,"batt":100.0,"det":false},{"id":3,"x":317.51,"y":283.20,"hdg":-1.240,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":36,"t":36.00,"coverage":0.1536,"drones":[{"id":0,"x":195.05,"y":107.16,"hdg":-0.466,"batt":100.0,"det":false},{"id":1,"x":323.49,"y":85.24,"hdg":-0.864,"batt":100.0,"det":false},{"id":2,"x":107.77,"y":316.21,"hdg":0.232,"batt":100.0,"det":false},{"id":3,"x":322.71,"y":289.28,"hdg":0.863,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":37,"t":37.00,"coverage":0.1564,"drones":[{"id":0,"x":199.76,"y":113.62,"hdg":0.941,"batt":100.0,"det":false},{"id":1,"x":325.66,"y":92.94,"hdg":1.296,"batt":100.0,"det":false},{"id":2,"x":115.46,"y":318.40,"hdg":0.278,"batt":100.0,"det":false},{"id":3,"x":327.68,"y":295.55,"hdg":0.899,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":38,"t":38.00,"coverage":0.1611,"drones":[{"id":0,"x":204.39,"y":120.14,"hdg":0.954,"batt":100.0,"det":false},{"id":1,"x":328.05,"y":100.57,"hdg":1.267,"batt":100.0,"det":false},{"id":2,"x":123.14,"y":320.64,"hdg":0.284,"batt":100.0,"det":false},{"id":3,"x":332.66,"y":301.81,"hdg":0.900,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":39,"t":39.00,"coverage":0.1664,"drones":[{"id":0,"x":208.99,"y":126.69,"hdg":0.959,"batt":100.0,"det":false},{"id":1,"x":330.16,"y":108.29,"hdg":1.304,"batt":100.0,"det":false},{"id":2,"x":130.83,"y":322.87,"hdg":0.282,"batt":100.0,"det":false},{"id":3,"x":337.37,"y":308.27,"hdg":0.940,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":40,"t":40.00,"coverage":0.1711,"drones":[{"id":0,"x":209.96,"y":134.63,"hdg":1.449,"batt":100.0,"det":false},{"id":1,"x":328.01,"y":115.99,"hdg":1.843,"batt":100.0,"det":false},{"id":2,"x":137.38,"y":327.45,"hdg":0.610,"batt":100.0,"det":false},{"id":3,"x":331.75,"y":313.96,"hdg":2.350,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":41,"t":41.00,"coverage":0.1767,"drones":[{"id":0,"x":210.88,"y":142.58,"hdg":1.456,"batt":100.0,"det":false},{"id":1,"x":325.77,"y":123.67,"hdg":1.855,"batt":100.0,"det":false},{"id":2,"x":143.92,"y":332.07,"hdg":0.615,"batt":100.0,"det":false},{"id":3,"x":326.10,"y":319.63,"hdg":2.355,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":42,"t":42.00,"coverage":0.1817,"drones":[{"id":0,"x":211.78,"y":150.53,"hdg":1.457,"batt":100.0,"det":false},{"id":1,"x":323.48,"y":131.34,"hdg":1.861,"batt":100.0,"det":false},{"id":2,"x":150.45,"y":336.69,"hdg":0.616,"batt":100.0,"det":false},{"id":3,"x":318.40,"y":321.81,"hdg":2.866,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":43,"t":43.00,"coverage":0.1864,"drones":[{"id":0,"x":206.68,"y":156.69,"hdg":2.262,"batt":100.0,"det":false},{"id":1,"x":317.42,"y":136.56,"hdg":2.431,"batt":100.0,"det":false},{"id":2,"x":143.13,"y":339.92,"hdg":2.726,"batt":100.0,"det":false},{"id":3,"x":310.69,"y":323.94,"hdg":2.872,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":44,"t":44.00,"coverage":0.1916,"drones":[{"id":0,"x":201.53,"y":162.81,"hdg":2.271,"batt":100.0,"det":false},{"id":1,"x":311.31,"y":141.72,"hdg":2.439,"batt":100.0,"det":false},{"id":2,"x":135.82,"y":343.17,"hdg":2.724,"batt":100.0,"det":false},{"id":3,"x":302.97,"y":326.02,"hdg":2.878,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":45,"t":45.00,"coverage":0.1973,"drones":[{"id":0,"x":196.36,"y":168.92,"hdg":2.273,"batt":100.0,"det":false},{"id":1,"x":305.19,"y":146.88,"hdg":2.442,"batt":100.0,"det":false},{"id":2,"x":128.48,"y":346.35,"hdg":2.732,"batt":100.0,"det":false},{"id":3,"x":295.23,"y":328.05,"hdg":2.885,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":46,"t":46.00,"coverage":0.2033,"drones":[{"id":0,"x":191.19,"y":175.02,"hdg":2.274,"batt":100.0,"det":false},{"id":1,"x":299.06,"y":152.02,"hdg":2.444,"batt":100.0,"det":false},{"id":2,"x":121.13,"y":349.52,"hdg":2.735,"batt":100.0,"det":false},{"id":3,"x":287.48,"y":330.04,"hdg":2.890,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":47,"t":47.00,"coverage":0.2081,"drones":[{"id":0,"x":186.01,"y":181.12,"hdg":2.275,"batt":100.0,"det":false},{"id":1,"x":292.92,"y":157.15,"hdg":2.445,"batt":100.0,"det":false},{"id":2,"x":113.78,"y":352.67,"hdg":2.736,"batt":100.0,"det":false},{"id":3,"x":279.73,"y":332.00,"hdg":2.894,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":48,"t":48.00,"coverage":0.2133,"drones":[{"id":0,"x":180.83,"y":187.21,"hdg":2.275,"batt":100.0,"det":false},{"id":1,"x":286.78,"y":162.28,"hdg":2.446,"batt":100.0,"det":false},{"id":2,"x":106.42,"y":355.82,"hdg":2.738,"batt":100.0,"det":false},{"id":3,"x":271.97,"y":333.95,"hdg":2.896,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":49,"t":49.00,"coverage":0.2184,"drones":[{"id":0,"x":175.64,"y":193.31,"hdg":2.276,"batt":100.0,"det":false},{"id":1,"x":280.64,"y":167.40,"hdg":2.446,"batt":100.0,"det":false},{"id":2,"x":99.06,"y":358.95,"hdg":2.739,"batt":100.0,"det":false},{"id":3,"x":274.73,"y":326.44,"hdg":-1.218,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":50,"t":50.00,"coverage":0.2200,"drones":[{"id":0,"x":181.71,"y":188.09,"hdg":-0.709,"batt":100.0,"det":false},{"id":1,"x":285.28,"y":160.88,"hdg":-0.953,"batt":100.0,"det":false},{"id":2,"x":104.19,"y":352.81,"hdg":-0.876,"batt":100.0,"det":false},{"id":3,"x":277.46,"y":318.92,"hdg":-1.223,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":51,"t":51.00,"coverage":0.2222,"drones":[{"id":0,"x":188.70,"y":184.19,"hdg":-0.510,"batt":100.0,"det":false},{"id":1,"x":289.14,"y":153.88,"hdg":-1.066,"batt":100.0,"det":false},{"id":2,"x":109.06,"y":346.46,"hdg":-0.916,"batt":100.0,"det":false},{"id":3,"x":280.24,"y":311.42,"hdg":-1.215,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":52,"t":52.00,"coverage":0.2234,"drones":[{"id":0,"x":194.97,"y":179.23,"hdg":-0.670,"batt":100.0,"det":false},{"id":1,"x":293.61,"y":147.24,"hdg":-0.978,"batt":100.0,"det":false},{"id":2,"x":114.13,"y":340.28,"hdg":-0.883,"batt":100.0,"det":false},{"id":3,"x":283.03,"y":303.92,"hdg":-1.215,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":53,"t":53.00,"coverage":0.2247,"drones":[{"id":0,"x":201.15,"y":174.15,"hdg":-0.687,"batt":100.0,"det":false},{"id":1,"x":298.17,"y":140.67,"hdg":-0.964,"batt":100.0,"det":false},{"id":2,"x":119.28,"y":334.15,"hdg":-0.873,"batt":100.0,"det":false},{"id":3,"x":285.79,"y":296.42,"hdg":-1.218,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":54,"t":54.00,"coverage":0.2258,"drones":[{"id":0,"x":207.30,"y":169.03,"hdg":-0.695,"batt":100.0,"det":false},{"id":1,"x":302.78,"y":134.13,"hdg":-0.956,"batt":100.0,"det":false},{"id":2,"x":124.46,"y":328.06,"hdg":-0.866,"batt":100.0,"det":false},{"id":3,"x":288.48,"y":288.88,"hdg":-1.229,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":55,"t":55.00,"coverage":0.2269,"drones":[{"id":0,"x":213.42,"y":163.87,"hdg":-0.700,"batt":100.0,"det":false},{"id":1,"x":307.43,"y":127.62,"hdg":-0.951,"batt":100.0,"det":false},{"id":2,"x":129.69,"y":322.00,"hdg":-0.859,"batt":100.0,"det":false},{"id":3,"x":289.30,"y":280.92,"hdg":-1.468,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":56,"t":56.00,"coverage":0.2300,"drones":[{"id":0,"x":219.52,"y":158.70,"hdg":-0.703,"batt":100.0,"det":false},{"id":1,"x":312.11,"y":121.13,"hdg":-0.946,"batt":100.0,"det":false},{"id":2,"x":133.78,"y":315.13,"hdg":-1.034,"batt":100.0,"det":false},{"id":3,"x":292.13,"y":273.44,"hdg":-1.208,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":57,"t":57.00,"coverage":0.2339,"drones":[{"id":0,"x":225.60,"y":153.50,"hdg":-0.707,"batt":100.0,"det":false},{"id":1,"x":316.83,"y":114.67,"hdg":-0.940,"batt":100.0,"det":false},{"id":2,"x":138.93,"y":309.01,"hdg":-0.871,"batt":100.0,"det":false},{"id":3,"x":294.99,"y":265.97,"hdg":-1.206,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":58,"t":58.00,"coverage":0.2375,"drones":[{"id":0,"x":231.65,"y":148.27,"hdg":-0.713,"batt":100.0,"det":false},{"id":1,"x":321.62,"y":108.26,"hdg":-0.930,"batt":100.0,"det":false},{"id":2,"x":144.11,"y":302.91,"hdg":-0.867,"batt":100.0,"det":false},{"id":3,"x":297.88,"y":258.51,"hdg":-1.201,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":59,"t":59.00,"coverage":0.2419,"drones":[{"id":0,"x":237.68,"y":143.01,"hdg":-0.717,"batt":100.0,"det":false},{"id":1,"x":326.46,"y":101.89,"hdg":-0.921,"batt":100.0,"det":false},{"id":2,"x":149.28,"y":296.81,"hdg":-0.867,"batt":100.0,"det":false},{"id":3,"x":300.79,"y":251.06,"hdg":-1.199,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":60,"t":60.00,"coverage":0.2466,"drones":[{"id":0,"x":243.69,"y":137.73,"hdg":-0.720,"batt":100.0,"det":false},{"id":1,"x":331.15,"y":95.42,"hdg":-0.944,"batt":100.0,"det":false},{"id":2,"x":154.46,"y":290.70,"hdg":-0.868,"batt":100.0,"det":false},{"id":3,"x":303.71,"y":243.61,"hdg":-1.197,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":61,"t":61.00,"coverage":0.2514,"drones":[{"id":0,"x":249.70,"y":132.45,"hdg":-0.722,"batt":100.0,"det":false},{"id":1,"x":336.07,"y":89.11,"hdg":-0.909,"batt":100.0,"det":false},{"id":2,"x":148.45,"y":285.42,"hdg":-2.420,"batt":100.0,"det":false},{"id":3,"x":296.05,"y":241.33,"hdg":-2.852,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":62,"t":62.00,"coverage":0.2547,"drones":[{"id":0,"x":241.74,"y":133.25,"hdg":3.041,"batt":100.0,"det":false},{"id":1,"x":328.22,"y":90.62,"hdg":2.951,"batt":100.0,"det":false},{"id":2,"x":142.40,"y":280.18,"hdg":-2.428,"batt":100.0,"det":false},{"id":3,"x":288.36,"y":239.11,"hdg":-2.861,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":63,"t":63.00,"coverage":0.2578,"drones":[{"id":0,"x":233.76,"y":133.87,"hdg":3.065,"batt":100.0,"det":false},{"id":1,"x":320.30,"y":91.79,"hdg":2.995,"batt":100.0,"det":false},{"id":2,"x":136.33,"y":274.97,"hdg":-2.432,"batt":100.0,"det":false},{"id":3,"x":280.66,"y":236.94,"hdg":-2.867,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":64,"t":64.00,"coverage":0.2609,"drones":[{"id":0,"x":225.80,"y":134.63,"hdg":3.046,"batt":100.0,"det":false},{"id":1,"x":312.37,"y":92.86,"hdg":3.007,"batt":100.0,"det":false},{"id":2,"x":130.25,"y":269.78,"hdg":-2.434,"batt":100.0,"det":false},{"id":3,"x":272.95,"y":234.80,"hdg":-2.871,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":65,"t":65.00,"coverage":0.2634,"drones":[{"id":0,"x":217.84,"y":135.44,"hdg":3.040,"batt":100.0,"det":false},{"id":1,"x":304.47,"y":94.13,"hdg":2.982,"batt":100.0,"det":false},{"id":2,"x":124.16,"y":264.58,"hdg":-2.436,"batt":100.0,"det":false},{"id":3,"x":265.24,"y":232.67,"hdg":-2.873,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":66,"t":66.00,"coverage":0.2653,"drones":[{"id":0,"x":209.88,"y":136.27,"hdg":3.037,"batt":100.0,"det":false},{"id":1,"x":296.81,"y":96.44,"hdg":2.849,"batt":100.0,"det":false},{"id":2,"x":118.07,"y":259.40,"hdg":-2.437,"batt":100.0,"det":false},{"id":3,"x":257.52,"y":230.56,"hdg":-2.874,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":67,"t":67.00,"coverage":0.2672,"drones":[{"id":0,"x":202.12,"y":138.20,"hdg":2.899,"batt":100.0,"det":false},{"id":1,"x":289.30,"y":99.19,"hdg":2.790,"batt":100.0,"det":false},{"id":2,"x":111.97,"y":254.23,"hdg":-2.438,"batt":100.0,"det":false},{"id":3,"x":249.81,"y":228.45,"hdg":-2.875,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":68,"t":68.00,"coverage":0.2700,"drones":[{"id":0,"x":195.42,"y":133.82,"hdg":-2.563,"batt":100.0,"det":false},{"id":1,"x":281.42,"y":97.83,"hdg":-2.971,"batt":100.0,"det":false},{"id":2,"x":108.70,"y":246.92,"hdg":-1.992,"batt":100.0,"det":false},{"id":3,"x":243.86,"y":223.10,"hdg":-2.409,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":69,"t":69.00,"coverage":0.2723,"drones":[{"id":0,"x":188.77,"y":129.37,"hdg":-2.552,"batt":100.0,"det":false},{"id":1,"x":273.82,"y":95.33,"hdg":-2.823,"batt":100.0,"det":false},{"id":2,"x":105.46,"y":239.61,"hdg":-1.988,"batt":100.0,"det":false},{"id":3,"x":237.94,"y":217.72,"hdg":-2.404,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":70,"t":70.00,"coverage":0.2745,"drones":[{"id":0,"x":182.13,"y":124.91,"hdg":-2.551,"batt":100.0,"det":false},{"id":1,"x":266.27,"y":92.70,"hdg":-2.807,"batt":100.0,"det":false},{"id":2,"x":102.22,"y":232.30,"hdg":-1.988,"batt":100.0,"det":false},{"id":3,"x":232.02,"y":212.34,"hdg":-2.403,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":71,"t":71.00,"coverage":0.2767,"drones":[{"id":0,"x":175.46,"y":120.49,"hdg":-2.556,"batt":100.0,"det":false},{"id":1,"x":258.72,"y":90.04,"hdg":-2.802,"batt":100.0,"det":false},{"id":2,"x":98.97,"y":224.98,"hdg":-1.988,"batt":100.0,"det":false},{"id":3,"x":226.10,"y":206.95,"hdg":-2.403,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":72,"t":72.00,"coverage":0.2794,"drones":[{"id":0,"x":168.67,"y":116.27,"hdg":-2.586,"batt":100.0,"det":false},{"id":1,"x":251.18,"y":87.36,"hdg":-2.801,"batt":100.0,"det":false},{"id":2,"x":95.73,"y":217.67,"hdg":-1.988,"batt":100.0,"det":false},{"id":3,"x":220.18,"y":201.57,"hdg":-2.404,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":73,"t":73.00,"coverage":0.2827,"drones":[{"id":0,"x":161.90,"y":111.99,"hdg":-2.578,"batt":100.0,"det":false},{"id":1,"x":243.65,"y":84.68,"hdg":-2.800,"batt":100.0,"det":false},{"id":2,"x":92.49,"y":210.36,"hdg":-1.988,"batt":100.0,"det":false},{"id":3,"x":214.26,"y":196.19,"hdg":-2.404,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":74,"t":74.00,"coverage":0.2855,"drones":[{"id":0,"x":155.16,"y":107.70,"hdg":-2.575,"batt":100.0,"det":false},{"id":1,"x":236.11,"y":82.00,"hdg":-2.800,"batt":100.0,"det":false},{"id":2,"x":89.25,"y":203.04,"hdg":-1.988,"batt":100.0,"det":false},{"id":3,"x":208.33,"y":190.82,"hdg":-2.405,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":75,"t":75.00,"coverage":0.2881,"drones":[{"id":0,"x":148.47,"y":103.30,"hdg":-2.560,"batt":100.0,"det":false},{"id":1,"x":228.57,"y":79.32,"hdg":-2.799,"batt":100.0,"det":false},{"id":2,"x":86.00,"y":195.73,"hdg":-1.988,"batt":100.0,"det":false},{"id":3,"x":202.40,"y":185.45,"hdg":-2.406,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":76,"t":76.00,"coverage":0.2903,"drones":[{"id":0,"x":141.85,"y":98.81,"hdg":-2.546,"batt":100.0,"det":false},{"id":1,"x":221.04,"y":76.63,"hdg":-2.799,"batt":100.0,"det":false},{"id":2,"x":82.76,"y":188.42,"hdg":-1.988,"batt":100.0,"det":false},{"id":3,"x":196.45,"y":180.10,"hdg":-2.409,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":77,"t":77.00,"coverage":0.2936,"drones":[{"id":0,"x":135.27,"y":94.26,"hdg":-2.536,"batt":100.0,"det":false},{"id":1,"x":213.50,"y":73.95,"hdg":-2.799,"batt":100.0,"det":false},{"id":2,"x":79.52,"y":181.10,"hdg":-1.988,"batt":100.0,"det":false},{"id":3,"x":190.68,"y":174.57,"hdg":-2.377,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":78,"t":78.00,"coverage":0.2977,"drones":[{"id":0,"x":128.71,"y":89.69,"hdg":-2.533,"batt":100.0,"det":false},{"id":1,"x":205.97,"y":71.26,"hdg":-2.799,"batt":100.0,"det":false},{"id":2,"x":76.27,"y":173.79,"hdg":-1.988,"batt":100.0,"det":false},{"id":3,"x":184.74,"y":169.21,"hdg":-2.407,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":79,"t":79.00,"coverage":0.3017,"drones":[{"id":0,"x":122.14,"y":85.11,"hdg":-2.533,"batt":100.0,"det":false},{"id":1,"x":198.43,"y":68.58,"hdg":-2.800,"batt":100.0,"det":false},{"id":2,"x":73.03,"y":166.48,"hdg":-1.988,"batt":100.0,"det":false},{"id":3,"x":178.80,"y":163.85,"hdg":-2.408,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":80,"t":80.00,"coverage":0.3061,"drones":[{"id":0,"x":115.58,"y":80.54,"hdg":-2.533,"batt":100.0,"det":false},{"id":1,"x":190.89,"y":65.90,"hdg":-2.800,"batt":100.0,"det":false},{"id":2,"x":69.79,"y":159.16,"hdg":-1.988,"batt":100.0,"det":false},{"id":3,"x":172.85,"y":158.50,"hdg":-2.408,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":81,"t":81.00,"coverage":0.3092,"drones":[{"id":0,"x":109.02,"y":75.96,"hdg":-2.533,"batt":100.0,"det":false},{"id":1,"x":183.35,"y":63.22,"hdg":-2.801,"batt":100.0,"det":false},{"id":2,"x":66.55,"y":151.85,"hdg":-1.988,"batt":100.0,"det":false},{"id":3,"x":166.91,"y":153.14,"hdg":-2.408,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":82,"t":82.00,"coverage":0.3142,"drones":[{"id":0,"x":102.46,"y":71.39,"hdg":-2.533,"batt":100.0,"det":false},{"id":1,"x":175.81,"y":60.56,"hdg":-2.802,"batt":100.0,"det":false},{"id":2,"x":63.31,"y":144.53,"hdg":-1.988,"batt":100.0,"det":false},{"id":3,"x":160.97,"y":147.78,"hdg":-2.408,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":83,"t":83.00,"coverage":0.3187,"drones":[{"id":0,"x":95.90,"y":66.81,"hdg":-2.532,"batt":100.0,"det":false},{"id":1,"x":168.26,"y":57.90,"hdg":-2.803,"batt":100.0,"det":false},{"id":2,"x":60.08,"y":137.22,"hdg":-1.987,"batt":100.0,"det":false},{"id":3,"x":155.03,"y":142.42,"hdg":-2.407,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":84,"t":84.00,"coverage":0.3219,"drones":[{"id":0,"x":89.34,"y":62.23,"hdg":-2.532,"batt":100.0,"det":false},{"id":1,"x":175.99,"y":55.84,"hdg":-0.261,"batt":100.0,"det":false},{"id":2,"x":67.44,"y":134.09,"hdg":-0.401,"batt":100.0,"det":false},{"id":3,"x":161.88,"y":138.29,"hdg":-0.544,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":85,"t":85.00,"coverage":0.3250,"drones":[{"id":0,"x":97.15,"y":60.54,"hdg":-0.213,"batt":100.0,"det":false},{"id":1,"x":183.67,"y":53.58,"hdg":-0.286,"batt":100.0,"det":false},{"id":2,"x":74.83,"y":131.02,"hdg":-0.394,"batt":100.0,"det":false},{"id":3,"x":168.74,"y":134.18,"hdg":-0.539,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":86,"t":86.00,"coverage":0.3278,"drones":[{"id":0,"x":104.96,"y":58.77,"hdg":-0.224,"batt":100.0,"det":false},{"id":1,"x":191.39,"y":51.49,"hdg":-0.265,"batt":100.0,"det":false},{"id":2,"x":82.23,"y":127.99,"hdg":-0.389,"batt":100.0,"det":false},{"id":3,"x":175.64,"y":130.13,"hdg":-0.532,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":87,"t":87.00,"coverage":0.3314,"drones":[{"id":0,"x":112.78,"y":57.09,"hdg":-0.212,"batt":100.0,"det":false},{"id":1,"x":199.12,"y":49.45,"hdg":-0.258,"batt":100.0,"det":false},{"id":2,"x":89.64,"y":124.97,"hdg":-0.387,"batt":100.0,"det":false},{"id":3,"x":182.56,"y":126.11,"hdg":-0.525,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":88,"t":88.00,"coverage":0.3339,"drones":[{"id":0,"x":120.60,"y":55.44,"hdg":-0.208,"batt":100.0,"det":false},{"id":1,"x":206.86,"y":47.43,"hdg":-0.255,"batt":100.0,"det":false},{"id":2,"x":97.05,"y":121.96,"hdg":-0.386,"batt":100.0,"det":false},{"id":3,"x":190.10,"y":123.46,"hdg":-0.339,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":89,"t":89.00,"coverage":0.3370,"drones":[{"id":0,"x":128.44,"y":53.80,"hdg":-0.206,"batt":100.0,"det":false},{"id":1,"x":214.61,"y":45.44,"hdg":-0.252,"batt":100.0,"det":false},{"id":2,"x":104.47,"y":118.96,"hdg":-0.385,"batt":100.0,"det":false},{"id":3,"x":196.92,"y":119.27,"hdg":-0.551,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":90,"t":90.00,"coverage":0.3400,"drones":[{"id":0,"x":136.27,"y":52.18,"hdg":-0.205,"batt":100.0,"det":false},{"id":1,"x":222.36,"y":43.46,"hdg":-0.250,"batt":100.0,"det":false},{"id":2,"x":111.88,"y":115.96,"hdg":-0.384,"batt":100.0,"det":false},{"id":3,"x":203.77,"y":115.13,"hdg":-0.544,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":91,"t":91.00,"coverage":0.3442,"drones":[{"id":0,"x":144.10,"y":50.56,"hdg":-0.204,"batt":100.0,"det":false},{"id":1,"x":230.12,"y":41.49,"hdg":-0.249,"batt":100.0,"det":false},{"id":2,"x":119.30,"y":112.96,"hdg":-0.384,"batt":100.0,"det":false},{"id":3,"x":210.63,"y":111.02,"hdg":-0.539,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":92,"t":92.00,"coverage":0.3466,"drones":[{"id":0,"x":148.92,"y":56.94,"hdg":0.924,"batt":100.0,"det":false},{"id":1,"x":233.70,"y":48.64,"hdg":1.107,"batt":100.0,"det":false},{"id":2,"x":124.92,"y":118.65,"hdg":0.791,"batt":100.0,"det":false},{"id":3,"x":215.15,"y":117.62,"hdg":0.970,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":93,"t":93.00,"coverage":0.3489,"drones":[{"id":0,"x":153.68,"y":63.38,"hdg":0.935,"batt":100.0,"det":false},{"id":1,"x":237.22,"y":55.83,"hdg":1.115,"batt":100.0,"det":false},{"id":2,"x":130.49,"y":124.40,"hdg":0.801,"batt":100.0,"det":false},{"id":3,"x":219.63,"y":124.25,"hdg":0.977,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":94,"t":94.00,"coverage":0.3505,"drones":[{"id":0,"x":158.39,"y":69.84,"hdg":0.940,"batt":100.0,"det":false},{"id":1,"x":240.72,"y":63.02,"hdg":1.117,"batt":100.0,"det":false},{"id":2,"x":136.05,"y":130.15,"hdg":0.804,"batt":100.0,"det":false},{"id":3,"x":224.10,"y":130.89,"hdg":0.978,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":95,"t":95.00,"coverage":0.3514,"drones":[{"id":0,"x":163.10,"y":76.31,"hdg":0.942,"batt":100.0,"det":false},{"id":1,"x":244.23,"y":70.21,"hdg":1.117,"batt":100.0,"det":false},{"id":2,"x":141.59,"y":135.92,"hdg":0.805,"batt":100.0,"det":false},{"id":3,"x":228.61,"y":137.49,"hdg":0.971,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":96,"t":96.00,"coverage":0.3520,"drones":[{"id":0,"x":167.81,"y":82.77,"hdg":0.941,"batt":100.0,"det":false},{"id":1,"x":247.76,"y":77.39,"hdg":1.114,"batt":100.0,"det":false},{"id":2,"x":147.12,"y":141.71,"hdg":0.808,"batt":100.0,"det":false},{"id":3,"x":232.97,"y":144.20,"hdg":0.994,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":97,"t":97.00,"coverage":0.3531,"drones":[{"id":0,"x":172.53,"y":89.23,"hdg":0.939,"batt":100.0,"det":false},{"id":1,"x":251.33,"y":84.55,"hdg":1.108,"batt":100.0,"det":false},{"id":2,"x":152.59,"y":147.54,"hdg":0.817,"batt":100.0,"det":false},{"id":3,"x":237.36,"y":150.89,"hdg":0.991,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":98,"t":98.00,"coverage":0.3548,"drones":[{"id":0,"x":177.27,"y":95.67,"hdg":0.937,"batt":100.0,"det":false},{"id":1,"x":255.11,"y":91.60,"hdg":1.079,"batt":100.0,"det":false},{"id":2,"x":157.95,"y":153.48,"hdg":0.837,"batt":100.0,"det":false},{"id":3,"x":241.78,"y":157.55,"hdg":0.985,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":99,"t":99.00,"coverage":0.3573,"drones":[{"id":0,"x":182.03,"y":102.11,"hdg":0.934,"batt":100.0,"det":false},{"id":1,"x":258.31,"y":98.93,"hdg":1.158,"batt":100.0,"det":false},{"id":2,"x":163.33,"y":159.40,"hdg":0.833,"batt":100.0,"det":false},{"id":3,"x":246.18,"y":164.23,"hdg":0.988,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":100,"t":100.00,"coverage":0.3603,"drones":[{"id":0,"x":186.80,"y":108.53,"hdg":0.932,"batt":100.0,"det":false},{"id":1,"x":261.69,"y":106.18,"hdg":1.135,"batt":100.0,"det":false},{"id":2,"x":168.75,"y":165.29,"hdg":0.828,"batt":100.0,"det":false},{"id":3,"x":250.58,"y":170.92,"hdg":0.989,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":101,"t":101.00,"coverage":0.3628,"drones":[{"id":0,"x":191.59,"y":114.94,"hdg":0.929,"batt":100.0,"det":false},{"id":1,"x":265.11,"y":113.41,"hdg":1.128,"batt":100.0,"det":false},{"id":2,"x":174.18,"y":171.16,"hdg":0.824,"batt":100.0,"det":false},{"id":3,"x":254.98,"y":177.60,"hdg":0.989,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":102,"t":102.00,"coverage":0.3652,"drones":[{"id":0,"x":196.39,"y":121.33,"hdg":0.927,"batt":100.0,"det":false},{"id":1,"x":268.56,"y":120.63,"hdg":1.125,"batt":100.0,"det":false},{"id":2,"x":179.62,"y":177.02,"hdg":0.822,"batt":100.0,"det":false},{"id":3,"x":259.37,"y":184.29,"hdg":0.989,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":103,"t":103.00,"coverage":0.3675,"drones":[{"id":0,"x":200.73,"y":128.06,"hdg":0.998,"batt":100.0,"det":false},{"id":1,"x":272.03,"y":127.84,"hdg":1.123,"batt":100.0,"det":false},{"id":2,"x":185.08,"y":182.87,"hdg":0.820,"batt":100.0,"det":false},{"id":3,"x":263.77,"y":190.97,"hdg":0.989,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":104,"t":104.00,"coverage":0.3697,"drones":[{"id":0,"x":205.53,"y":134.46,"hdg":0.927,"batt":100.0,"det":false},{"id":1,"x":275.50,"y":135.05,"hdg":1.122,"batt":100.0,"det":false},{"id":2,"x":190.56,"y":188.70,"hdg":0.817,"batt":100.0,"det":false},{"id":3,"x":268.16,"y":197.65,"hdg":0.989,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":105,"t":105.00,"coverage":0.3720,"drones":[{"id":0,"x":210.30,"y":140.88,"hdg":0.933,"batt":100.0,"det":false},{"id":1,"x":278.96,"y":142.26,"hdg":1.122,"batt":100.0,"det":false},{"id":2,"x":196.05,"y":194.52,"hdg":0.814,"batt":100.0,"det":false},{"id":3,"x":272.56,"y":204.34,"hdg":0.989,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":106,"t":106.00,"coverage":0.3736,"drones":[{"id":0,"x":214.86,"y":147.45,"hdg":0.964,"batt":100.0,"det":false},{"id":1,"x":282.43,"y":149.47,"hdg":1.122,"batt":100.0,"det":false},{"id":2,"x":201.56,"y":200.32,"hdg":0.812,"batt":100.0,"det":false},{"id":3,"x":276.96,"y":211.02,"hdg":0.988,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":107,"t":107.00,"coverage":0.3742,"drones":[{"id":0,"x":219.48,"y":153.98,"hdg":0.955,"batt":100.0,"det":false},{"id":1,"x":285.90,"y":156.68,"hdg":1.123,"batt":100.0,"det":false},{"id":2,"x":207.08,"y":206.11,"hdg":0.810,"batt":100.0,"det":false},{"id":3,"x":281.37,"y":217.69,"hdg":0.988,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":108,"t":108.00,"coverage":0.3752,"drones":[{"id":0,"x":224.12,"y":160.50,"hdg":0.952,"batt":100.0,"det":false},{"id":1,"x":289.36,"y":163.89,"hdg":1.123,"batt":100.0,"det":false},{"id":2,"x":212.61,"y":211.89,"hdg":0.808,"batt":100.0,"det":false},{"id":3,"x":285.78,"y":224.37,"hdg":0.986,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":109,"t":109.00,"coverage":0.3764,"drones":[{"id":0,"x":218.78,"y":166.45,"hdg":2.302,"batt":100.0,"det":false},{"id":1,"x":283.28,"y":169.08,"hdg":2.435,"batt":100.0,"det":false},{"id":2,"x":206.73,"y":217.33,"hdg":2.395,"batt":100.0,"det":false},{"id":3,"x":279.03,"y":228.66,"hdg":2.575,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":110,"t":110.00,"coverage":0.3791,"drones":[{"id":0,"x":223.58,"y":172.85,"hdg":0.926,"batt":100.0,"det":false},{"id":1,"x":286.87,"y":176.23,"hdg":1.105,"batt":100.0,"det":false},{"id":2,"x":212.38,"y":222.99,"hdg":0.787,"batt":100.0,"det":false},{"id":3,"x":283.66,"y":235.19,"hdg":0.955,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":111,"t":111.00,"coverage":0.3820,"drones":[{"id":0,"x":228.47,"y":179.19,"hdg":0.914,"batt":100.0,"det":false},{"id":1,"x":290.53,"y":183.34,"hdg":1.095,"batt":100.0,"det":false},{"id":2,"x":218.09,"y":228.59,"hdg":0.776,"batt":100.0,"det":false},{"id":3,"x":288.55,"y":241.51,"hdg":0.912,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":112,"t":112.00,"coverage":0.3847,"drones":[{"id":0,"x":233.37,"y":185.50,"hdg":0.910,"batt":100.0,"det":false},{"id":1,"x":294.22,"y":190.44,"hdg":1.092,"batt":100.0,"det":false},{"id":2,"x":223.83,"y":234.17,"hdg":0.771,"batt":100.0,"det":false},{"id":3,"x":292.91,"y":248.22,"hdg":0.994,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":113,"t":113.00,"coverage":0.3867,"drones":[{"id":0,"x":238.29,"y":191.81,"hdg":0.909,"batt":100.0,"det":false},{"id":1,"x":297.90,"y":197.54,"hdg":1.092,"batt":100.0,"det":false},{"id":2,"x":229.57,"y":239.74,"hdg":0.770,"batt":100.0,"det":false},{"id":3,"x":297.53,"y":254.75,"hdg":0.955,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":114,"t":114.00,"coverage":0.3883,"drones":[{"id":0,"x":232.37,"y":197.19,"hdg":2.405,"batt":100.0,"det":false},{"id":1,"x":291.39,"y":202.19,"hdg":2.523,"batt":100.0,"det":false},{"id":2,"x":223.13,"y":244.48,"hdg":2.508,"batt":100.0,"det":false},{"id":3,"x":290.43,"y":258.44,"hdg":2.663,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":115,"t":115.00,"coverage":0.3897,"drones":[{"id":0,"x":226.39,"y":202.51,"hdg":2.414,"batt":100.0,"det":false},{"id":1,"x":284.83,"y":206.77,"hdg":2.531,"batt":100.0,"det":false},{"id":2,"x":216.65,"y":249.17,"hdg":2.515,"batt":100.0,"det":false},{"id":3,"x":283.30,"y":262.07,"hdg":2.670,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":116,"t":116.00,"coverage":0.3914,"drones":[{"id":0,"x":220.35,"y":207.75,"hdg":2.428,"batt":100.0,"det":false},{"id":1,"x":278.26,"y":211.33,"hdg":2.535,"batt":100.0,"det":false},{"id":2,"x":210.14,"y":253.82,"hdg":2.522,"batt":100.0,"det":false},{"id":3,"x":276.16,"y":265.67,"hdg":2.675,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":117,"t":117.00,"coverage":0.3925,"drones":[{"id":0,"x":214.38,"y":213.08,"hdg":2.412,"batt":100.0,"det":false},{"id":1,"x":272.45,"y":216.84,"hdg":2.383,"batt":100.0,"det":false},{"id":2,"x":203.61,"y":258.44,"hdg":2.525,"batt":100.0,"det":false},{"id":3,"x":269.01,"y":269.25,"hdg":2.677,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":118,"t":118.00,"coverage":0.3948,"drones":[{"id":0,"x":208.99,"y":219.00,"hdg":2.310,"batt":100.0,"det":false},{"id":1,"x":265.85,"y":221.35,"hdg":2.542,"batt":100.0,"det":false},{"id":2,"x":197.08,"y":263.06,"hdg":2.527,"batt":100.0,"det":false},{"id":3,"x":261.85,"y":272.83,"hdg":2.679,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":119,"t":119.00,"coverage":0.3991,"drones":[{"id":0,"x":203.24,"y":224.55,"hdg":2.374,"batt":100.0,"det":false},{"id":1,"x":259.24,"y":225.85,"hdg":2.543,"batt":100.0,"det":false},{"id":2,"x":190.54,"y":267.66,"hdg":2.528,"batt":100.0,"det":false},{"id":3,"x":254.69,"y":276.39,"hdg":2.679,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":120,"t":120.00,"coverage":0.4031,"drones":[{"id":0,"x":197.19,"y":229.79,"hdg":2.428,"batt":100.0,"det":false},{"id":1,"x":252.63,"y":230.37,"hdg":2.542,"batt":100.0,"det":false},{"id":2,"x":183.99,"y":272.26,"hdg":2.529,"batt":100.0,"det":false},{"id":3,"x":247.53,"y":279.96,"hdg":2.679,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":121,"t":121.00,"coverage":0.4070,"drones":[{"id":0,"x":191.13,"y":235.01,"hdg":2.430,"batt":100.0,"det":false},{"id":1,"x":246.03,"y":234.89,"hdg":2.541,"batt":100.0,"det":false},{"id":2,"x":177.44,"y":276.86,"hdg":2.530,"batt":100.0,"det":false},{"id":3,"x":240.37,"y":283.53,"hdg":2.680,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":122,"t":122.00,"coverage":0.4102,"drones":[{"id":0,"x":185.06,"y":240.23,"hdg":2.432,"batt":100.0,"det":false},{"id":1,"x":239.44,"y":239.42,"hdg":2.540,"batt":100.0,"det":false},{"id":2,"x":170.89,"y":281.45,"hdg":2.531,"batt":100.0,"det":false},{"id":3,"x":233.21,"y":287.09,"hdg":2.680,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":123,"t":123.00,"coverage":0.4136,"drones":[{"id":0,"x":178.99,"y":245.43,"hdg":2.433,"batt":100.0,"det":false},{"id":1,"x":232.86,"y":243.98,"hdg":2.535,"batt":100.0,"det":false},{"id":2,"x":164.33,"y":286.03,"hdg":2.531,"batt":100.0,"det":false},{"id":3,"x":226.04,"y":290.66,"hdg":2.680,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":124,"t":124.00,"coverage":0.4164,"drones":[{"id":0,"x":172.91,"y":250.64,"hdg":2.434,"batt":100.0,"det":false},{"id":1,"x":226.40,"y":248.69,"hdg":2.512,"batt":100.0,"det":false},{"id":2,"x":157.77,"y":290.61,"hdg":2.532,"batt":100.0,"det":false},{"id":3,"x":218.88,"y":294.22,"hdg":2.680,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":125,"t":125.00,"coverage":0.4188,"drones":[{"id":0,"x":166.83,"y":255.83,"hdg":2.435,"batt":100.0,"det":false},{"id":1,"x":219.94,"y":253.41,"hdg":2.510,"batt":100.0,"det":false},{"id":2,"x":151.21,"y":295.19,"hdg":2.532,"batt":100.0,"det":false},{"id":3,"x":211.71,"y":297.78,"hdg":2.680,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":126,"t":126.00,"coverage":0.4211,"drones":[{"id":0,"x":160.74,"y":261.02,"hdg":2.435,"batt":100.0,"det":false},{"id":1,"x":213.47,"y":258.11,"hdg":2.513,"batt":100.0,"det":false},{"id":2,"x":144.65,"y":299.76,"hdg":2.533,"batt":100.0,"det":false},{"id":3,"x":218.66,"y":301.75,"hdg":0.519,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":127,"t":127.00,"coverage":0.4238,"drones":[{"id":0,"x":167.58,"y":265.17,"hdg":0.545,"batt":100.0,"det":false},{"id":1,"x":219.70,"y":263.13,"hdg":0.678,"batt":100.0,"det":false},{"id":2,"x":152.03,"y":302.84,"hdg":0.395,"batt":100.0,"det":false},{"id":3,"x":225.60,"y":305.73,"hdg":0.522,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":128,"t":128.00,"coverage":0.4269,"drones":[{"id":0,"x":174.45,"y":269.28,"hdg":0.540,"batt":100.0,"det":false},{"id":1,"x":225.99,"y":268.07,"hdg":0.666,"batt":100.0,"det":false},{"id":2,"x":159.41,"y":305.94,"hdg":0.398,"batt":100.0,"det":false},{"id":3,"x":232.57,"y":309.65,"hdg":0.512,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":129,"t":129.00,"coverage":0.4295,"drones":[{"id":0,"x":181.35,"y":273.32,"hdg":0.529,"batt":100.0,"det":false},{"id":1,"x":232.33,"y":272.95,"hdg":0.656,"batt":100.0,"det":false},{"id":2,"x":166.81,"y":308.98,"hdg":0.390,"batt":100.0,"det":false},{"id":3,"x":239.57,"y":313.54,"hdg":0.507,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":130,"t":130.00,"coverage":0.4328,"drones":[{"id":0,"x":188.09,"y":277.64,"hdg":0.571,"batt":100.0,"det":false},{"id":1,"x":238.70,"y":277.79,"hdg":0.649,"batt":100.0,"det":false},{"id":2,"x":174.21,"y":312.00,"hdg":0.387,"batt":100.0,"det":false},{"id":3,"x":246.57,"y":317.40,"hdg":0.504,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":131,"t":131.00,"coverage":0.4347,"drones":[{"id":0,"x":181.55,"y":282.26,"hdg":2.526,"batt":100.0,"det":false},{"id":1,"x":231.57,"y":281.40,"hdg":2.673,"batt":100.0,"det":false},{"id":2,"x":167.15,"y":315.76,"hdg":2.653,"batt":100.0,"det":false},{"id":3,"x":239.05,"y":320.13,"hdg":2.794,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":132,"t":132.00,"coverage":0.4356,"drones":[{"id":0,"x":175.00,"y":286.85,"hdg":2.530,"batt":100.0,"det":false},{"id":1,"x":224.42,"y":285.00,"hdg":2.675,"batt":100.0,"det":false},{"id":2,"x":160.11,"y":319.56,"hdg":2.647,"batt":100.0,"det":false},{"id":3,"x":231.55,"y":322.91,"hdg":2.786,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":133,"t":133.00,"coverage":0.4366,"drones":[{"id":0,"x":168.41,"y":291.38,"hdg":2.540,"batt":100.0,"det":false},{"id":1,"x":217.24,"y":288.53,"hdg":2.685,"batt":100.0,"det":false},{"id":2,"x":153.02,"y":323.26,"hdg":2.660,"batt":100.0,"det":false},{"id":3,"x":238.72,"y":326.45,"hdg":0.458,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":134,"t":134.00,"coverage":0.4384,"drones":[{"id":0,"x":175.55,"y":294.97,"hdg":0.466,"batt":100.0,"det":false},{"id":1,"x":224.05,"y":292.72,"hdg":0.552,"batt":100.0,"det":false},{"id":2,"x":160.59,"y":325.85,"hdg":0.329,"batt":100.0,"det":false},{"id":3,"x":245.89,"y":330.02,"hdg":0.461,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":135,"t":135.00,"coverage":0.4384,"drones":[{"id":0,"x":168.81,"y":299.28,"hdg":2.573,"batt":100.0,"det":false},{"id":1,"x":217.01,"y":296.52,"hdg":2.647,"batt":100.0,"det":false},{"id":2,"x":153.46,"y":329.47,"hdg":2.672,"batt":100.0,"det":false},{"id":3,"x":249.49,"y":322.88,"hdg":-1.103,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":136,"t":136.00,"coverage":0.4394,"drones":[{"id":0,"x":173.75,"y":292.99,"hdg":-0.905,"batt":100.0,"det":false},{"id":1,"x":221.12,"y":289.65,"hdg":-1.031,"batt":100.0,"det":false},{"id":2,"x":158.31,"y":323.11,"hdg":-0.919,"batt":100.0,"det":false},{"id":3,"x":253.17,"y":315.77,"hdg":-1.093,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":137,"t":137.00,"coverage":0.4402,"drones":[{"id":0,"x":178.39,"y":286.47,"hdg":-0.952,"batt":100.0,"det":false},{"id":1,"x":225.15,"y":282.75,"hdg":-1.043,"batt":100.0,"det":false},{"id":2,"x":162.98,"y":316.61,"hdg":-0.947,"batt":100.0,"det":false},{"id":3,"x":256.79,"y":308.63,"hdg":-1.102,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":138,"t":138.00,"coverage":0.4409,"drones":[{"id":0,"x":183.60,"y":280.40,"hdg":-0.861,"batt":100.0,"det":false},{"id":1,"x":229.09,"y":275.78,"hdg":-1.057,"batt":100.0,"det":false},{"id":2,"x":167.71,"y":310.16,"hdg":-0.938,"batt":100.0,"det":false},{"id":3,"x":260.31,"y":301.45,"hdg":-1.114,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":139,"t":139.00,"coverage":0.4414,"drones":[{"id":0,"x":188.72,"y":274.25,"hdg":-0.877,"batt":100.0,"det":false},{"id":1,"x":233.15,"y":268.89,"hdg":-1.038,"batt":100.0,"det":false},{"id":2,"x":173.50,"y":304.64,"hdg":-0.762,"batt":100.0,"det":false},{"id":3,"x":263.82,"y":294.27,"hdg":-1.116,"batt":100.0,"det":false}]} -{"type":"episode","ep":19,"mean_return":790.7200,"policy_loss":-25751.0820,"value_loss":683626.6250,"victims_found":0} diff --git a/v2/crates/ruview-swarm/viz/sample_spiral.jsonl b/v2/crates/ruview-swarm/viz/sample_spiral.jsonl deleted file mode 100644 index cd97569e..00000000 --- a/v2/crates/ruview-swarm/viz/sample_spiral.jsonl +++ /dev/null @@ -1,161 +0,0 @@ -{"type":"meta","profile":"sar · flight=spiral · learn=curiosity","drones":4,"area_w":400.00,"area_h":400.00,"victims":[[80.00,120.00],[240.00,180.00]]} -{"type":"episode","ep":0,"mean_return":132.4876,"policy_loss":-129.5060,"value_loss":218518.5938,"victims_found":0} -{"type":"episode","ep":1,"mean_return":132.4876,"policy_loss":-209.0675,"value_loss":218347.4375,"victims_found":0} -{"type":"episode","ep":2,"mean_return":132.4876,"policy_loss":-295.6345,"value_loss":218168.9531,"victims_found":0} -{"type":"episode","ep":3,"mean_return":132.4876,"policy_loss":-392.3826,"value_loss":217971.0625,"victims_found":0} -{"type":"episode","ep":4,"mean_return":132.4876,"policy_loss":-504.0201,"value_loss":217738.5781,"victims_found":0} -{"type":"episode","ep":5,"mean_return":132.4876,"policy_loss":-628.8607,"value_loss":217474.8281,"victims_found":0} -{"type":"episode","ep":6,"mean_return":132.4876,"policy_loss":-771.4684,"value_loss":217171.8750,"victims_found":0} -{"type":"episode","ep":7,"mean_return":132.4876,"policy_loss":-936.7915,"value_loss":216822.7812,"victims_found":0} -{"type":"episode","ep":8,"mean_return":132.4876,"policy_loss":-1128.8857,"value_loss":216425.1094,"victims_found":0} -{"type":"episode","ep":9,"mean_return":132.4876,"policy_loss":-1352.4432,"value_loss":215961.6875,"victims_found":0} -{"type":"episode","ep":10,"mean_return":132.4876,"policy_loss":-1610.8960,"value_loss":215415.8281,"victims_found":0} -{"type":"episode","ep":11,"mean_return":132.4876,"policy_loss":-1911.4857,"value_loss":214772.7656,"victims_found":0} -{"type":"episode","ep":12,"mean_return":132.4876,"policy_loss":-2260.4644,"value_loss":214029.3906,"victims_found":0} -{"type":"episode","ep":13,"mean_return":132.4876,"policy_loss":-2662.1604,"value_loss":213180.5000,"victims_found":0} -{"type":"episode","ep":14,"mean_return":132.4876,"policy_loss":-3122.8921,"value_loss":212218.7188,"victims_found":0} -{"type":"episode","ep":15,"mean_return":132.4876,"policy_loss":-3644.7505,"value_loss":211141.8594,"victims_found":0} -{"type":"episode","ep":16,"mean_return":132.4876,"policy_loss":-4234.3257,"value_loss":209940.2500,"victims_found":0} -{"type":"episode","ep":17,"mean_return":132.4876,"policy_loss":-4891.8579,"value_loss":208607.4062,"victims_found":0} -{"type":"episode","ep":18,"mean_return":132.4876,"policy_loss":-5623.4009,"value_loss":207148.4219,"victims_found":0} -{"type":"step","ep":19,"step":0,"t":0.00,"coverage":0.0159,"drones":[{"id":0,"x":15.66,"y":15.66,"hdg":0.785,"batt":100.0,"det":false},{"id":1,"x":209.58,"y":17.99,"hdg":1.623,"batt":100.0,"det":false},{"id":2,"x":17.99,"y":209.58,"hdg":-0.053,"batt":100.0,"det":false},{"id":3,"x":204.34,"y":204.34,"hdg":-2.356,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":1,"t":1.00,"coverage":0.0205,"drones":[{"id":0,"x":21.32,"y":21.30,"hdg":0.784,"batt":100.0,"det":false},{"id":1,"x":209.26,"y":25.98,"hdg":1.611,"batt":100.0,"det":false},{"id":2,"x":25.98,"y":209.23,"hdg":-0.044,"batt":100.0,"det":false},{"id":3,"x":202.21,"y":201.51,"hdg":-2.217,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":2,"t":2.00,"coverage":0.0248,"drones":[{"id":0,"x":26.93,"y":27.01,"hdg":0.794,"batt":100.0,"det":false},{"id":1,"x":208.93,"y":33.98,"hdg":1.612,"batt":100.0,"det":false},{"id":2,"x":33.98,"y":209.04,"hdg":-0.024,"batt":100.0,"det":false},{"id":3,"x":201.94,"y":204.98,"hdg":1.648,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":3,"t":3.00,"coverage":0.0295,"drones":[{"id":0,"x":32.43,"y":32.82,"hdg":0.813,"batt":100.0,"det":false},{"id":1,"x":208.44,"y":41.96,"hdg":1.633,"batt":100.0,"det":false},{"id":2,"x":41.98,"y":208.98,"hdg":-0.007,"batt":100.0,"det":false},{"id":3,"x":198.18,"y":207.81,"hdg":2.497,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":4,"t":4.00,"coverage":0.0348,"drones":[{"id":0,"x":37.84,"y":38.72,"hdg":0.829,"batt":100.0,"det":false},{"id":1,"x":207.65,"y":49.92,"hdg":1.669,"batt":100.0,"det":false},{"id":2,"x":49.98,"y":208.88,"hdg":-0.012,"batt":100.0,"det":false},{"id":3,"x":192.11,"y":207.22,"hdg":-3.045,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":5,"t":5.00,"coverage":0.0392,"drones":[{"id":0,"x":43.23,"y":44.63,"hdg":0.831,"batt":100.0,"det":false},{"id":1,"x":206.56,"y":57.85,"hdg":1.707,"batt":100.0,"det":false},{"id":2,"x":57.97,"y":208.47,"hdg":-0.051,"batt":100.0,"det":false},{"id":3,"x":186.76,"y":201.89,"hdg":-2.357,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":6,"t":6.00,"coverage":0.0455,"drones":[{"id":0,"x":48.77,"y":50.40,"hdg":0.806,"batt":100.0,"det":false},{"id":1,"x":205.34,"y":65.75,"hdg":1.725,"batt":100.0,"det":false},{"id":2,"x":65.91,"y":207.51,"hdg":-0.121,"batt":100.0,"det":false},{"id":3,"x":185.75,"y":193.95,"hdg":-1.698,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":7,"t":7.00,"coverage":0.0508,"drones":[{"id":0,"x":54.60,"y":55.87,"hdg":0.754,"batt":100.0,"det":false},{"id":1,"x":204.36,"y":73.69,"hdg":1.693,"batt":100.0,"det":false},{"id":2,"x":73.77,"y":206.01,"hdg":-0.188,"batt":100.0,"det":false},{"id":3,"x":189.29,"y":186.78,"hdg":-1.112,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":8,"t":8.00,"coverage":0.0567,"drones":[{"id":0,"x":60.75,"y":60.99,"hdg":0.695,"batt":100.0,"det":false},{"id":1,"x":204.17,"y":81.69,"hdg":1.594,"batt":100.0,"det":false},{"id":2,"x":81.59,"y":204.34,"hdg":-0.210,"batt":100.0,"det":false},{"id":3,"x":196.02,"y":182.45,"hdg":-0.572,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":9,"t":9.00,"coverage":0.0616,"drones":[{"id":0,"x":67.06,"y":65.91,"hdg":0.662,"batt":100.0,"det":false},{"id":1,"x":205.05,"y":89.64,"hdg":1.460,"batt":100.0,"det":false},{"id":2,"x":89.48,"y":202.99,"hdg":-0.170,"batt":100.0,"det":false},{"id":3,"x":204.01,"y":182.02,"hdg":-0.054,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":10,"t":10.00,"coverage":0.0663,"drones":[{"id":0,"x":73.31,"y":70.90,"hdg":0.674,"batt":100.0,"det":false},{"id":1,"x":206.63,"y":97.49,"hdg":1.373,"batt":100.0,"det":false},{"id":2,"x":97.45,"y":202.37,"hdg":-0.077,"batt":100.0,"det":false},{"id":3,"x":211.21,"y":185.51,"hdg":0.452,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":11,"t":11.00,"coverage":0.0717,"drones":[{"id":0,"x":79.27,"y":76.23,"hdg":0.730,"batt":100.0,"det":false},{"id":1,"x":208.13,"y":105.34,"hdg":1.382,"batt":100.0,"det":false},{"id":2,"x":105.44,"y":202.79,"hdg":0.052,"batt":100.0,"det":false},{"id":3,"x":215.83,"y":192.04,"hdg":0.955,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":12,"t":12.00,"coverage":0.0762,"drones":[{"id":0,"x":84.75,"y":82.06,"hdg":0.816,"batt":100.0,"det":false},{"id":1,"x":208.88,"y":113.31,"hdg":1.476,"batt":100.0,"det":false},{"id":2,"x":113.29,"y":204.35,"hdg":0.196,"batt":100.0,"det":false},{"id":3,"x":216.71,"y":199.99,"hdg":1.461,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":13,"t":13.00,"coverage":0.0806,"drones":[{"id":0,"x":89.62,"y":88.41,"hdg":0.916,"batt":100.0,"det":false},{"id":1,"x":208.42,"y":121.29,"hdg":1.628,"batt":100.0,"det":false},{"id":2,"x":120.86,"y":206.94,"hdg":0.330,"batt":100.0,"det":false},{"id":3,"x":213.56,"y":207.35,"hdg":1.975,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":14,"t":14.00,"coverage":0.0855,"drones":[{"id":0,"x":93.90,"y":95.17,"hdg":1.006,"batt":100.0,"det":false},{"id":1,"x":206.47,"y":129.05,"hdg":1.817,"batt":100.0,"det":false},{"id":2,"x":128.23,"y":210.04,"hdg":0.397,"batt":100.0,"det":false},{"id":3,"x":207.15,"y":212.13,"hdg":2.500,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":15,"t":15.00,"coverage":0.0897,"drones":[{"id":0,"x":97.88,"y":102.11,"hdg":1.050,"batt":100.0,"det":false},{"id":1,"x":202.94,"y":136.23,"hdg":2.028,"batt":100.0,"det":false},{"id":2,"x":136.10,"y":211.49,"hdg":0.182,"batt":100.0,"det":false},{"id":3,"x":199.19,"y":212.94,"hdg":3.041,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":16,"t":16.00,"coverage":0.0942,"drones":[{"id":0,"x":102.30,"y":108.78,"hdg":0.985,"batt":100.0,"det":false},{"id":1,"x":197.94,"y":142.48,"hdg":2.246,"batt":100.0,"det":false},{"id":2,"x":142.14,"y":206.24,"hdg":-0.716,"batt":100.0,"det":false},{"id":3,"x":192.02,"y":209.39,"hdg":-2.683,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":17,"t":17.00,"coverage":0.0984,"drones":[{"id":0,"x":108.22,"y":114.16,"hdg":0.739,"batt":100.0,"det":false},{"id":1,"x":191.83,"y":147.64,"hdg":2.440,"batt":100.0,"det":false},{"id":2,"x":146.58,"y":199.58,"hdg":-0.982,"batt":100.0,"det":false},{"id":3,"x":187.93,"y":202.52,"hdg":-2.107,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":18,"t":18.00,"coverage":0.1023,"drones":[{"id":0,"x":115.46,"y":117.56,"hdg":0.438,"batt":100.0,"det":false},{"id":1,"x":190.65,"y":152.79,"hdg":1.797,"batt":100.0,"det":false},{"id":2,"x":152.06,"y":193.76,"hdg":-0.815,"batt":100.0,"det":false},{"id":3,"x":188.37,"y":194.53,"hdg":-1.516,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":19,"t":19.00,"coverage":0.1058,"drones":[{"id":0,"x":123.03,"y":120.15,"hdg":0.329,"batt":100.0,"det":false},{"id":1,"x":198.65,"y":152.93,"hdg":0.017,"batt":100.0,"det":false},{"id":2,"x":158.94,"y":189.66,"hdg":-0.537,"batt":100.0,"det":false},{"id":3,"x":193.24,"y":188.18,"hdg":-0.917,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":20,"t":20.00,"coverage":0.1091,"drones":[{"id":0,"x":130.41,"y":123.24,"hdg":0.397,"batt":100.0,"det":false},{"id":1,"x":206.09,"y":155.87,"hdg":0.377,"batt":100.0,"det":false},{"id":2,"x":166.76,"y":188.00,"hdg":-0.210,"batt":100.0,"det":false},{"id":3,"x":200.85,"y":185.71,"hdg":-0.314,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":21,"t":21.00,"coverage":0.1116,"drones":[{"id":0,"x":137.19,"y":127.48,"hdg":0.559,"batt":100.0,"det":false},{"id":1,"x":211.97,"y":161.28,"hdg":0.744,"batt":100.0,"det":false},{"id":2,"x":174.66,"y":189.23,"hdg":0.154,"batt":100.0,"det":false},{"id":3,"x":208.52,"y":187.95,"hdg":0.285,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":22,"t":22.00,"coverage":0.1134,"drones":[{"id":0,"x":142.92,"y":133.06,"hdg":0.772,"batt":100.0,"det":false},{"id":1,"x":215.45,"y":168.49,"hdg":1.122,"batt":100.0,"det":false},{"id":2,"x":181.44,"y":193.48,"hdg":0.560,"batt":100.0,"det":false},{"id":3,"x":213.63,"y":194.11,"hdg":0.878,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":23,"t":23.00,"coverage":0.1155,"drones":[{"id":0,"x":147.14,"y":139.86,"hdg":1.016,"batt":100.0,"det":false},{"id":1,"x":215.88,"y":176.48,"hdg":1.516,"batt":100.0,"det":false},{"id":2,"x":185.57,"y":200.33,"hdg":1.028,"batt":100.0,"det":false},{"id":3,"x":214.47,"y":202.07,"hdg":1.466,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":24,"t":24.00,"coverage":0.1172,"drones":[{"id":0,"x":149.41,"y":147.53,"hdg":1.283,"batt":100.0,"det":false},{"id":1,"x":213.04,"y":183.96,"hdg":1.935,"batt":100.0,"det":false},{"id":2,"x":185.28,"y":208.32,"hdg":1.607,"batt":100.0,"det":false},{"id":3,"x":210.78,"y":209.17,"hdg":2.050,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":25,"t":25.00,"coverage":0.1203,"drones":[{"id":0,"x":149.39,"y":155.53,"hdg":1.573,"batt":100.0,"det":false},{"id":1,"x":207.18,"y":189.41,"hdg":2.391,"batt":100.0,"det":false},{"id":2,"x":179.55,"y":213.91,"hdg":2.369,"batt":100.0,"det":false},{"id":3,"x":203.79,"y":213.06,"hdg":2.633,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":26,"t":26.00,"coverage":0.1222,"drones":[{"id":0,"x":146.71,"y":163.07,"hdg":1.913,"batt":100.0,"det":false},{"id":1,"x":199.40,"y":191.26,"hdg":2.909,"batt":100.0,"det":false},{"id":2,"x":171.62,"y":212.86,"hdg":-3.011,"batt":100.0,"det":false},{"id":3,"x":195.81,"y":212.45,"hdg":-3.065,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":27,"t":27.00,"coverage":0.1241,"drones":[{"id":0,"x":138.99,"y":165.18,"hdg":2.875,"batt":100.0,"det":false},{"id":1,"x":191.98,"y":188.27,"hdg":-2.759,"batt":100.0,"det":false},{"id":2,"x":166.82,"y":206.46,"hdg":-2.215,"batt":100.0,"det":false},{"id":3,"x":189.51,"y":207.52,"hdg":-2.477,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":28,"t":28.00,"coverage":0.1247,"drones":[{"id":0,"x":144.13,"y":159.05,"hdg":-0.873,"batt":100.0,"det":false},{"id":1,"x":188.50,"y":181.07,"hdg":-2.021,"batt":100.0,"det":false},{"id":2,"x":166.67,"y":198.46,"hdg":-1.589,"batt":100.0,"det":false},{"id":3,"x":187.04,"y":199.91,"hdg":-1.885,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":29,"t":29.00,"coverage":0.1253,"drones":[{"id":0,"x":151.14,"y":155.18,"hdg":-0.504,"batt":100.0,"det":false},{"id":1,"x":191.20,"y":173.54,"hdg":-1.225,"batt":100.0,"det":false},{"id":2,"x":170.62,"y":191.50,"hdg":-1.056,"batt":100.0,"det":false},{"id":3,"x":189.28,"y":192.23,"hdg":-1.288,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":30,"t":30.00,"coverage":0.1266,"drones":[{"id":0,"x":159.05,"y":153.98,"hdg":-0.150,"batt":100.0,"det":false},{"id":1,"x":198.22,"y":169.70,"hdg":-0.500,"batt":100.0,"det":false},{"id":2,"x":177.39,"y":187.25,"hdg":-0.561,"batt":100.0,"det":false},{"id":3,"x":195.45,"y":187.14,"hdg":-0.689,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":31,"t":31.00,"coverage":0.1277,"drones":[{"id":0,"x":166.87,"y":155.63,"hdg":0.208,"batt":100.0,"det":false},{"id":1,"x":206.17,"y":170.65,"hdg":0.119,"batt":100.0,"det":false},{"id":2,"x":185.37,"y":186.65,"hdg":-0.075,"batt":100.0,"det":false},{"id":3,"x":203.42,"y":186.43,"hdg":-0.089,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":32,"t":32.00,"coverage":0.1281,"drones":[{"id":0,"x":173.58,"y":159.99,"hdg":0.576,"batt":100.0,"det":false},{"id":1,"x":212.44,"y":175.62,"hdg":0.670,"batt":100.0,"det":false},{"id":2,"x":192.66,"y":189.93,"hdg":0.423,"batt":100.0,"det":false},{"id":3,"x":210.40,"y":190.32,"hdg":0.509,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":33,"t":33.00,"coverage":0.1281,"drones":[{"id":0,"x":178.15,"y":166.56,"hdg":0.963,"batt":100.0,"det":false},{"id":1,"x":215.44,"y":183.04,"hdg":1.187,"batt":100.0,"det":false},{"id":2,"x":197.32,"y":196.43,"hdg":0.949,"batt":100.0,"det":false},{"id":3,"x":213.99,"y":197.47,"hdg":1.106,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":34,"t":34.00,"coverage":0.1281,"drones":[{"id":0,"x":179.65,"y":174.42,"hdg":1.382,"batt":100.0,"det":false},{"id":1,"x":214.44,"y":190.97,"hdg":1.696,"batt":100.0,"det":false},{"id":2,"x":197.70,"y":204.42,"hdg":1.523,"batt":100.0,"det":false},{"id":3,"x":212.96,"y":205.41,"hdg":1.700,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":35,"t":35.00,"coverage":0.1281,"drones":[{"id":0,"x":177.37,"y":182.09,"hdg":1.860,"batt":100.0,"det":false},{"id":1,"x":209.63,"y":197.37,"hdg":2.216,"batt":100.0,"det":false},{"id":2,"x":193.28,"y":211.09,"hdg":2.156,"batt":100.0,"det":false},{"id":3,"x":207.67,"y":211.41,"hdg":2.293,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":36,"t":36.00,"coverage":0.1281,"drones":[{"id":0,"x":171.19,"y":187.17,"hdg":2.453,"batt":100.0,"det":false},{"id":1,"x":202.20,"y":200.33,"hdg":2.762,"batt":100.0,"det":false},{"id":2,"x":185.65,"y":213.47,"hdg":2.840,"batt":100.0,"det":false},{"id":3,"x":199.93,"y":213.44,"hdg":2.886,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":37,"t":37.00,"coverage":0.1283,"drones":[{"id":0,"x":163.24,"y":186.27,"hdg":-3.029,"batt":100.0,"det":false},{"id":1,"x":194.37,"y":198.68,"hdg":-2.934,"batt":100.0,"det":false},{"id":2,"x":178.25,"y":210.42,"hdg":-2.751,"batt":100.0,"det":false},{"id":3,"x":192.38,"y":210.79,"hdg":-2.804,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":38,"t":38.00,"coverage":0.1286,"drones":[{"id":0,"x":159.34,"y":179.29,"hdg":-2.080,"batt":100.0,"det":false},{"id":1,"x":189.04,"y":192.72,"hdg":-2.300,"batt":100.0,"det":false},{"id":2,"x":174.25,"y":203.49,"hdg":-2.094,"batt":100.0,"det":false},{"id":3,"x":187.62,"y":204.36,"hdg":-2.209,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":39,"t":39.00,"coverage":0.1286,"drones":[{"id":0,"x":161.57,"y":171.60,"hdg":-1.288,"batt":100.0,"det":false},{"id":1,"x":188.55,"y":184.73,"hdg":-1.632,"batt":100.0,"det":false},{"id":2,"x":174.92,"y":195.52,"hdg":-1.487,"batt":100.0,"det":false},{"id":3,"x":187.29,"y":196.37,"hdg":-1.612,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":40,"t":40.00,"coverage":0.1286,"drones":[{"id":0,"x":167.76,"y":166.54,"hdg":-0.685,"batt":100.0,"det":false},{"id":1,"x":193.12,"y":178.17,"hdg":-0.962,"batt":100.0,"det":false},{"id":2,"x":179.77,"y":189.16,"hdg":-0.919,"batt":100.0,"det":false},{"id":3,"x":191.52,"y":189.58,"hdg":-1.014,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":41,"t":41.00,"coverage":0.1286,"drones":[{"id":0,"x":175.64,"y":165.16,"hdg":-0.174,"batt":100.0,"det":false},{"id":1,"x":200.71,"y":175.63,"hdg":-0.322,"batt":100.0,"det":false},{"id":2,"x":187.23,"y":186.24,"hdg":-0.373,"batt":100.0,"det":false},{"id":3,"x":198.84,"y":186.36,"hdg":-0.414,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":42,"t":42.00,"coverage":0.1286,"drones":[{"id":0,"x":183.28,"y":167.53,"hdg":0.301,"batt":100.0,"det":false},{"id":1,"x":208.40,"y":177.84,"hdg":0.279,"batt":100.0,"det":false},{"id":2,"x":195.11,"y":187.59,"hdg":0.169,"batt":100.0,"det":false},{"id":3,"x":206.71,"y":187.83,"hdg":0.185,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":43,"t":43.00,"coverage":0.1286,"drones":[{"id":0,"x":189.03,"y":173.10,"hdg":0.769,"batt":100.0,"det":false},{"id":1,"x":213.68,"y":183.85,"hdg":0.850,"batt":100.0,"det":false},{"id":2,"x":201.12,"y":192.87,"hdg":0.720,"batt":100.0,"det":false},{"id":3,"x":212.37,"y":193.48,"hdg":0.784,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":44,"t":44.00,"coverage":0.1286,"drones":[{"id":0,"x":191.55,"y":180.69,"hdg":1.251,"batt":100.0,"det":false},{"id":1,"x":215.00,"y":191.74,"hdg":1.405,"batt":100.0,"det":false},{"id":2,"x":203.32,"y":200.56,"hdg":1.293,"batt":100.0,"det":false},{"id":3,"x":213.88,"y":201.33,"hdg":1.381,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":45,"t":45.00,"coverage":0.1286,"drones":[{"id":0,"x":189.99,"y":188.54,"hdg":1.767,"batt":100.0,"det":false},{"id":1,"x":211.98,"y":199.15,"hdg":1.957,"batt":100.0,"det":false},{"id":2,"x":200.77,"y":208.14,"hdg":1.895,"batt":100.0,"det":false},{"id":3,"x":210.71,"y":208.68,"hdg":1.978,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":46,"t":46.00,"coverage":0.1286,"drones":[{"id":0,"x":184.40,"y":194.27,"hdg":2.344,"batt":100.0,"det":false},{"id":1,"x":205.49,"y":203.82,"hdg":2.519,"batt":100.0,"det":false},{"id":2,"x":194.24,"y":212.77,"hdg":2.525,"batt":100.0,"det":false},{"id":3,"x":203.97,"y":212.98,"hdg":2.574,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":47,"t":47.00,"coverage":0.1286,"drones":[{"id":0,"x":176.48,"y":195.36,"hdg":3.005,"batt":100.0,"det":false},{"id":1,"x":197.49,"y":204.15,"hdg":3.099,"batt":100.0,"det":false},{"id":2,"x":186.25,"y":212.54,"hdg":-3.113,"batt":100.0,"det":false},{"id":3,"x":195.97,"y":212.76,"hdg":-3.113,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":48,"t":48.00,"coverage":0.1286,"drones":[{"id":0,"x":169.87,"y":190.84,"hdg":-2.542,"batt":100.0,"det":false},{"id":1,"x":190.73,"y":199.88,"hdg":-2.578,"batt":100.0,"det":false},{"id":2,"x":179.97,"y":207.58,"hdg":-2.472,"batt":100.0,"det":false},{"id":3,"x":189.48,"y":208.08,"hdg":-2.517,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":49,"t":49.00,"coverage":0.1286,"drones":[{"id":0,"x":168.00,"y":183.07,"hdg":-1.807,"batt":100.0,"det":false},{"id":1,"x":187.77,"y":192.45,"hdg":-1.951,"batt":100.0,"det":false},{"id":2,"x":177.75,"y":199.89,"hdg":-1.852,"batt":100.0,"det":false},{"id":3,"x":186.75,"y":200.56,"hdg":-1.919,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":50,"t":50.00,"coverage":0.1286,"drones":[{"id":0,"x":171.32,"y":175.79,"hdg":-1.142,"batt":100.0,"det":false},{"id":1,"x":189.81,"y":184.72,"hdg":-1.313,"batt":100.0,"det":false},{"id":2,"x":180.22,"y":192.28,"hdg":-1.257,"batt":100.0,"det":false},{"id":3,"x":188.73,"y":192.81,"hdg":-1.321,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":51,"t":51.00,"coverage":0.1286,"drones":[{"id":0,"x":178.14,"y":171.60,"hdg":-0.551,"batt":100.0,"det":false},{"id":1,"x":196.02,"y":179.68,"hdg":-0.681,"batt":100.0,"det":false},{"id":2,"x":186.44,"y":187.25,"hdg":-0.680,"batt":100.0,"det":false},{"id":3,"x":194.74,"y":187.52,"hdg":-0.722,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":52,"t":52.00,"coverage":0.1286,"drones":[{"id":0,"x":186.14,"y":171.53,"hdg":-0.009,"batt":100.0,"det":false},{"id":1,"x":204.00,"y":179.14,"hdg":-0.068,"batt":100.0,"det":false},{"id":2,"x":194.39,"y":186.34,"hdg":-0.114,"batt":100.0,"det":false},{"id":3,"x":202.68,"y":186.55,"hdg":-0.122,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":53,"t":53.00,"coverage":0.1286,"drones":[{"id":0,"x":193.11,"y":175.44,"hdg":0.512,"batt":100.0,"det":false},{"id":1,"x":210.92,"y":183.15,"hdg":0.526,"batt":100.0,"det":false},{"id":2,"x":201.58,"y":189.85,"hdg":0.453,"batt":100.0,"det":false},{"id":3,"x":209.78,"y":190.22,"hdg":0.477,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":54,"t":54.00,"coverage":0.1286,"drones":[{"id":0,"x":197.23,"y":182.31,"hdg":1.031,"batt":100.0,"det":false},{"id":1,"x":214.52,"y":190.30,"hdg":1.104,"batt":100.0,"det":false},{"id":2,"x":205.70,"y":196.71,"hdg":1.030,"batt":100.0,"det":false},{"id":3,"x":213.58,"y":197.26,"hdg":1.076,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":55,"t":55.00,"coverage":0.1286,"drones":[{"id":0,"x":197.27,"y":190.31,"hdg":1.566,"batt":100.0,"det":false},{"id":1,"x":213.68,"y":198.25,"hdg":1.675,"batt":100.0,"det":false},{"id":2,"x":205.29,"y":204.70,"hdg":1.622,"batt":100.0,"det":false},{"id":3,"x":212.76,"y":205.22,"hdg":1.674,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":56,"t":56.00,"coverage":0.1286,"drones":[{"id":0,"x":192.99,"y":197.07,"hdg":2.134,"batt":100.0,"det":false},{"id":1,"x":208.67,"y":204.49,"hdg":2.248,"batt":100.0,"det":false},{"id":2,"x":200.39,"y":211.01,"hdg":2.231,"batt":100.0,"det":false},{"id":3,"x":207.60,"y":211.33,"hdg":2.272,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":57,"t":57.00,"coverage":0.1286,"drones":[{"id":0,"x":185.60,"y":200.13,"hdg":2.749,"batt":100.0,"det":false},{"id":1,"x":201.05,"y":206.95,"hdg":2.830,"batt":100.0,"det":false},{"id":2,"x":192.72,"y":213.28,"hdg":2.854,"batt":100.0,"det":false},{"id":3,"x":199.89,"y":213.48,"hdg":2.869,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":58,"t":58.00,"coverage":0.1286,"drones":[{"id":0,"x":177.89,"y":198.02,"hdg":-2.874,"batt":100.0,"det":false},{"id":1,"x":193.37,"y":204.71,"hdg":-2.858,"batt":100.0,"det":false},{"id":2,"x":185.17,"y":210.62,"hdg":-2.803,"batt":100.0,"det":false},{"id":3,"x":192.31,"y":210.93,"hdg":-2.816,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":59,"t":59.00,"coverage":0.1286,"drones":[{"id":0,"x":173.23,"y":191.51,"hdg":-2.192,"batt":100.0,"det":false},{"id":1,"x":188.36,"y":198.47,"hdg":-2.248,"batt":100.0,"det":false},{"id":2,"x":180.57,"y":204.07,"hdg":-2.183,"batt":100.0,"det":false},{"id":3,"x":187.49,"y":204.55,"hdg":-2.218,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":60,"t":60.00,"coverage":0.1286,"drones":[{"id":0,"x":173.56,"y":183.52,"hdg":-1.529,"batt":100.0,"det":false},{"id":1,"x":187.91,"y":190.48,"hdg":-1.627,"batt":100.0,"det":false},{"id":2,"x":180.52,"y":196.07,"hdg":-1.578,"batt":100.0,"det":false},{"id":3,"x":187.09,"y":196.56,"hdg":-1.620,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":61,"t":61.00,"coverage":0.1286,"drones":[{"id":0,"x":178.49,"y":177.21,"hdg":-0.908,"batt":100.0,"det":false},{"id":1,"x":192.20,"y":183.73,"hdg":-1.005,"batt":100.0,"det":false},{"id":2,"x":184.93,"y":189.40,"hdg":-0.986,"batt":100.0,"det":false},{"id":3,"x":191.28,"y":189.74,"hdg":-1.021,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":62,"t":62.00,"coverage":0.1286,"drones":[{"id":0,"x":186.06,"y":174.65,"hdg":-0.326,"batt":100.0,"det":false},{"id":1,"x":199.60,"y":180.69,"hdg":-0.390,"batt":100.0,"det":false},{"id":2,"x":192.29,"y":186.26,"hdg":-0.404,"batt":100.0,"det":false},{"id":3,"x":198.58,"y":186.47,"hdg":-0.421,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":63,"t":63.00,"coverage":0.1286,"drones":[{"id":0,"x":193.85,"y":176.46,"hdg":0.229,"batt":100.0,"det":false},{"id":1,"x":207.42,"y":182.37,"hdg":0.213,"batt":100.0,"det":false},{"id":2,"x":200.17,"y":187.64,"hdg":0.173,"batt":100.0,"det":false},{"id":3,"x":206.45,"y":187.89,"hdg":0.179,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":64,"t":64.00,"coverage":0.1286,"drones":[{"id":0,"x":199.57,"y":182.06,"hdg":0.774,"batt":100.0,"det":false},{"id":1,"x":212.97,"y":188.13,"hdg":0.804,"batt":100.0,"det":false},{"id":2,"x":206.00,"y":193.11,"hdg":0.754,"batt":100.0,"det":false},{"id":3,"x":212.15,"y":193.50,"hdg":0.778,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":65,"t":65.00,"coverage":0.1286,"drones":[{"id":0,"x":201.53,"y":189.81,"hdg":1.324,"batt":100.0,"det":false},{"id":1,"x":214.43,"y":196.00,"hdg":1.387,"batt":100.0,"det":false},{"id":2,"x":207.80,"y":200.91,"hdg":1.343,"batt":100.0,"det":false},{"id":3,"x":213.69,"y":201.35,"hdg":1.377,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":66,"t":66.00,"coverage":0.1286,"drones":[{"id":0,"x":199.01,"y":197.41,"hdg":1.891,"batt":100.0,"det":false},{"id":1,"x":211.34,"y":203.38,"hdg":1.968,"batt":100.0,"det":false},{"id":2,"x":204.89,"y":208.36,"hdg":1.944,"batt":100.0,"det":false},{"id":3,"x":210.54,"y":208.71,"hdg":1.975,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":67,"t":67.00,"coverage":0.1286,"drones":[{"id":0,"x":192.67,"y":202.28,"hdg":2.486,"batt":100.0,"det":false},{"id":1,"x":204.69,"y":207.83,"hdg":2.552,"batt":100.0,"det":false},{"id":2,"x":198.22,"y":212.79,"hdg":2.555,"batt":100.0,"det":false},{"id":3,"x":203.80,"y":213.01,"hdg":2.574,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":68,"t":68.00,"coverage":0.1286,"drones":[{"id":0,"x":184.67,"y":202.52,"hdg":3.112,"batt":100.0,"det":false},{"id":1,"x":196.69,"y":207.81,"hdg":-3.139,"batt":100.0,"det":false},{"id":2,"x":190.23,"y":212.55,"hdg":-3.112,"batt":100.0,"det":false},{"id":3,"x":195.80,"y":212.77,"hdg":-3.111,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":69,"t":69.00,"coverage":0.1286,"drones":[{"id":0,"x":178.16,"y":197.88,"hdg":-2.523,"batt":100.0,"det":false},{"id":1,"x":190.11,"y":203.26,"hdg":-2.537,"batt":100.0,"det":false},{"id":2,"x":183.84,"y":207.73,"hdg":-2.496,"batt":100.0,"det":false},{"id":3,"x":189.33,"y":208.06,"hdg":-2.513,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":70,"t":70.00,"coverage":0.1286,"drones":[{"id":0,"x":175.77,"y":190.24,"hdg":-1.874,"batt":100.0,"det":false},{"id":1,"x":187.32,"y":195.76,"hdg":-1.927,"batt":100.0,"det":false},{"id":2,"x":181.35,"y":200.13,"hdg":-1.887,"batt":100.0,"det":false},{"id":3,"x":186.64,"y":200.53,"hdg":-1.914,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":71,"t":71.00,"coverage":0.1286,"drones":[{"id":0,"x":178.33,"y":182.67,"hdg":-1.244,"batt":100.0,"det":false},{"id":1,"x":189.37,"y":188.03,"hdg":-1.312,"batt":100.0,"det":false},{"id":2,"x":183.58,"y":192.45,"hdg":-1.288,"batt":100.0,"det":false},{"id":3,"x":188.67,"y":192.79,"hdg":-1.315,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":72,"t":72.00,"coverage":0.1286,"drones":[{"id":0,"x":184.74,"y":177.87,"hdg":-0.642,"batt":100.0,"det":false},{"id":1,"x":195.49,"y":182.88,"hdg":-0.699,"batt":100.0,"det":false},{"id":2,"x":189.71,"y":187.31,"hdg":-0.697,"batt":100.0,"det":false},{"id":3,"x":194.71,"y":187.54,"hdg":-0.715,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":73,"t":73.00,"coverage":0.1286,"drones":[{"id":0,"x":192.72,"y":177.36,"hdg":-0.064,"batt":100.0,"det":false},{"id":1,"x":203.46,"y":182.14,"hdg":-0.093,"batt":100.0,"det":false},{"id":2,"x":197.66,"y":186.42,"hdg":-0.112,"batt":100.0,"det":false},{"id":3,"x":202.65,"y":186.62,"hdg":-0.116,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":74,"t":74.00,"coverage":0.1286,"drones":[{"id":0,"x":199.74,"y":181.20,"hdg":0.501,"batt":100.0,"det":false},{"id":1,"x":210.46,"y":186.01,"hdg":0.505,"batt":100.0,"det":false},{"id":2,"x":204.78,"y":190.07,"hdg":0.473,"batt":100.0,"det":false},{"id":3,"x":209.73,"y":190.34,"hdg":0.484,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":75,"t":75.00,"coverage":0.1286,"drones":[{"id":0,"x":203.64,"y":188.19,"hdg":1.062,"batt":100.0,"det":false},{"id":1,"x":214.12,"y":193.13,"hdg":1.096,"batt":100.0,"det":false},{"id":2,"x":208.67,"y":197.06,"hdg":1.063,"batt":100.0,"det":false},{"id":3,"x":213.48,"y":197.41,"hdg":1.083,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":76,"t":76.00,"coverage":0.1286,"drones":[{"id":0,"x":203.14,"y":196.17,"hdg":1.633,"batt":100.0,"det":false},{"id":1,"x":213.21,"y":201.08,"hdg":1.685,"batt":100.0,"det":false},{"id":2,"x":207.96,"y":205.02,"hdg":1.660,"batt":100.0,"det":false},{"id":3,"x":212.58,"y":205.36,"hdg":1.684,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":77,"t":77.00,"coverage":0.1286,"drones":[{"id":0,"x":198.31,"y":202.55,"hdg":2.219,"batt":100.0,"det":false},{"id":1,"x":208.06,"y":207.20,"hdg":2.270,"batt":100.0,"det":false},{"id":2,"x":202.85,"y":211.18,"hdg":2.263,"batt":100.0,"det":false},{"id":3,"x":207.36,"y":211.42,"hdg":2.281,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":78,"t":78.00,"coverage":0.1286,"drones":[{"id":0,"x":190.70,"y":205.03,"hdg":2.827,"batt":100.0,"det":false},{"id":1,"x":200.37,"y":209.41,"hdg":2.862,"batt":100.0,"det":false},{"id":2,"x":195.14,"y":213.31,"hdg":2.873,"batt":100.0,"det":false},{"id":3,"x":199.64,"y":213.50,"hdg":2.880,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":79,"t":79.00,"coverage":0.1286,"drones":[{"id":0,"x":183.10,"y":202.53,"hdg":-2.824,"batt":100.0,"det":false},{"id":1,"x":192.78,"y":206.87,"hdg":-2.819,"batt":100.0,"det":false},{"id":2,"x":187.62,"y":210.57,"hdg":-2.793,"batt":100.0,"det":false},{"id":3,"x":192.10,"y":210.81,"hdg":-2.800,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":80,"t":80.00,"coverage":0.1286,"drones":[{"id":0,"x":178.43,"y":196.04,"hdg":-2.194,"batt":100.0,"det":false},{"id":1,"x":187.95,"y":200.50,"hdg":-2.219,"batt":100.0,"det":false},{"id":2,"x":182.98,"y":204.06,"hdg":-2.190,"batt":100.0,"det":false},{"id":3,"x":187.35,"y":204.37,"hdg":-2.206,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":81,"t":81.00,"coverage":0.1286,"drones":[{"id":0,"x":178.48,"y":188.04,"hdg":-1.565,"batt":100.0,"det":false},{"id":1,"x":187.62,"y":192.50,"hdg":-1.613,"batt":100.0,"det":false},{"id":2,"x":182.85,"y":196.06,"hdg":-1.588,"batt":100.0,"det":false},{"id":3,"x":187.05,"y":196.38,"hdg":-1.609,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":82,"t":82.00,"coverage":0.1286,"drones":[{"id":0,"x":183.11,"y":181.52,"hdg":-0.954,"batt":100.0,"det":false},{"id":1,"x":191.94,"y":185.78,"hdg":-0.999,"batt":100.0,"det":false},{"id":2,"x":187.23,"y":189.37,"hdg":-0.990,"batt":100.0,"det":false},{"id":3,"x":191.32,"y":189.62,"hdg":-1.007,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":83,"t":83.00,"coverage":0.1286,"drones":[{"id":0,"x":190.59,"y":178.69,"hdg":-0.361,"batt":100.0,"det":false},{"id":1,"x":199.33,"y":182.72,"hdg":-0.392,"batt":100.0,"det":false},{"id":2,"x":194.61,"y":186.26,"hdg":-0.399,"batt":100.0,"det":false},{"id":3,"x":198.67,"y":186.45,"hdg":-0.407,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":84,"t":84.00,"coverage":0.1286,"drones":[{"id":0,"x":198.36,"y":180.60,"hdg":0.241,"batt":100.0,"det":false},{"id":1,"x":207.12,"y":184.56,"hdg":0.232,"batt":100.0,"det":false},{"id":2,"x":202.43,"y":187.93,"hdg":0.210,"batt":100.0,"det":false},{"id":3,"x":206.49,"y":188.15,"hdg":0.214,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":85,"t":85.00,"coverage":0.1286,"drones":[{"id":0,"x":203.99,"y":186.28,"hdg":0.790,"batt":100.0,"det":false},{"id":1,"x":212.67,"y":190.32,"hdg":0.804,"batt":100.0,"det":false},{"id":2,"x":208.12,"y":193.56,"hdg":0.780,"batt":100.0,"det":false},{"id":3,"x":212.11,"y":193.84,"hdg":0.792,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":86,"t":86.00,"coverage":0.1286,"drones":[{"id":0,"x":205.81,"y":194.07,"hdg":1.342,"batt":100.0,"det":false},{"id":1,"x":214.21,"y":198.17,"hdg":1.377,"batt":100.0,"det":false},{"id":2,"x":209.85,"y":201.37,"hdg":1.353,"batt":100.0,"det":false},{"id":3,"x":213.70,"y":201.68,"hdg":1.371,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":87,"t":87.00,"coverage":0.1286,"drones":[{"id":0,"x":202.65,"y":201.42,"hdg":1.977,"batt":100.0,"det":false},{"id":1,"x":210.75,"y":205.38,"hdg":2.019,"batt":100.0,"det":false},{"id":2,"x":206.47,"y":208.62,"hdg":2.007,"batt":100.0,"det":false},{"id":3,"x":210.20,"y":208.87,"hdg":2.023,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":88,"t":88.00,"coverage":0.1286,"drones":[{"id":0,"x":196.03,"y":205.91,"hdg":2.546,"batt":100.0,"det":false},{"id":1,"x":203.98,"y":209.65,"hdg":2.578,"batt":100.0,"det":false},{"id":2,"x":199.70,"y":212.88,"hdg":2.580,"batt":100.0,"det":false},{"id":3,"x":203.39,"y":213.07,"hdg":2.589,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":89,"t":89.00,"coverage":0.1286,"drones":[{"id":0,"x":188.03,"y":205.74,"hdg":-3.120,"batt":100.0,"det":false},{"id":1,"x":195.99,"y":209.34,"hdg":-3.103,"batt":100.0,"det":false},{"id":2,"x":191.71,"y":212.43,"hdg":-3.086,"batt":100.0,"det":false},{"id":3,"x":195.40,"y":212.62,"hdg":-3.086,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":90,"t":90.00,"coverage":0.1286,"drones":[{"id":0,"x":181.62,"y":200.95,"hdg":-2.500,"batt":100.0,"det":false},{"id":1,"x":189.54,"y":204.60,"hdg":-2.508,"batt":100.0,"det":false},{"id":2,"x":185.36,"y":207.56,"hdg":-2.487,"batt":100.0,"det":false},{"id":3,"x":189.01,"y":207.80,"hdg":-2.495,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":91,"t":91.00,"coverage":0.1286,"drones":[{"id":0,"x":178.94,"y":193.41,"hdg":-1.912,"batt":100.0,"det":false},{"id":1,"x":186.65,"y":197.14,"hdg":-1.941,"batt":100.0,"det":false},{"id":2,"x":182.64,"y":200.04,"hdg":-1.918,"batt":100.0,"det":false},{"id":3,"x":186.18,"y":200.32,"hdg":-1.933,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":92,"t":92.00,"coverage":0.1286,"drones":[{"id":0,"x":181.84,"y":185.96,"hdg":-1.200,"batt":100.0,"det":false},{"id":1,"x":189.24,"y":189.57,"hdg":-1.241,"batt":100.0,"det":false},{"id":2,"x":185.33,"y":192.50,"hdg":-1.227,"batt":100.0,"det":false},{"id":3,"x":188.75,"y":192.75,"hdg":-1.243,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":93,"t":93.00,"coverage":0.1286,"drones":[{"id":0,"x":188.17,"y":181.06,"hdg":-0.659,"batt":100.0,"det":false},{"id":1,"x":195.42,"y":184.49,"hdg":-0.689,"batt":100.0,"det":false},{"id":2,"x":191.51,"y":187.42,"hdg":-0.688,"batt":100.0,"det":false},{"id":3,"x":194.88,"y":187.61,"hdg":-0.697,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":94,"t":94.00,"coverage":0.1286,"drones":[{"id":0,"x":196.14,"y":180.37,"hdg":-0.086,"batt":100.0,"det":false},{"id":1,"x":203.38,"y":183.64,"hdg":-0.106,"batt":100.0,"det":false},{"id":2,"x":199.46,"y":186.48,"hdg":-0.118,"batt":100.0,"det":false},{"id":3,"x":202.83,"y":186.65,"hdg":-0.121,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":95,"t":95.00,"coverage":0.1286,"drones":[{"id":0,"x":202.88,"y":184.68,"hdg":0.569,"batt":100.0,"det":false},{"id":1,"x":210.09,"y":187.99,"hdg":0.574,"batt":100.0,"det":false},{"id":2,"x":206.26,"y":190.70,"hdg":0.555,"batt":100.0,"det":false},{"id":3,"x":209.60,"y":190.91,"hdg":0.562,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":96,"t":96.00,"coverage":0.1286,"drones":[{"id":0,"x":206.88,"y":191.60,"hdg":1.046,"batt":100.0,"det":false},{"id":1,"x":213.97,"y":194.99,"hdg":1.065,"batt":100.0,"det":false},{"id":2,"x":210.27,"y":197.62,"hdg":1.046,"batt":100.0,"det":false},{"id":3,"x":213.52,"y":197.88,"hdg":1.058,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":97,"t":97.00,"coverage":0.1286,"drones":[{"id":0,"x":205.83,"y":199.53,"hdg":1.703,"batt":100.0,"det":false},{"id":1,"x":212.63,"y":202.87,"hdg":1.739,"batt":100.0,"det":false},{"id":2,"x":209.05,"y":205.53,"hdg":1.723,"batt":100.0,"det":false},{"id":3,"x":212.18,"y":205.77,"hdg":1.739,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":98,"t":98.00,"coverage":0.1286,"drones":[{"id":0,"x":200.64,"y":205.62,"hdg":2.276,"batt":100.0,"det":false},{"id":1,"x":207.27,"y":208.82,"hdg":2.304,"batt":100.0,"det":false},{"id":2,"x":203.72,"y":211.49,"hdg":2.300,"batt":100.0,"det":false},{"id":3,"x":206.79,"y":211.68,"hdg":2.310,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":99,"t":99.00,"coverage":0.1289,"drones":[{"id":0,"x":193.09,"y":208.26,"hdg":2.805,"batt":100.0,"det":false},{"id":1,"x":199.66,"y":211.28,"hdg":2.829,"batt":100.0,"det":false},{"id":2,"x":196.09,"y":213.90,"hdg":2.836,"batt":100.0,"det":false},{"id":3,"x":199.15,"y":214.05,"hdg":2.841,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":100,"t":100.00,"coverage":0.1289,"drones":[{"id":0,"x":185.83,"y":204.89,"hdg":-2.706,"batt":100.0,"det":false},{"id":1,"x":192.41,"y":207.91,"hdg":-2.707,"batt":100.0,"det":false},{"id":2,"x":188.89,"y":210.40,"hdg":-2.689,"batt":100.0,"det":false},{"id":3,"x":191.94,"y":210.59,"hdg":-2.694,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":101,"t":101.00,"coverage":0.1289,"drones":[{"id":0,"x":181.08,"y":198.46,"hdg":-2.208,"batt":100.0,"det":false},{"id":1,"x":187.56,"y":201.54,"hdg":-2.221,"batt":100.0,"det":false},{"id":2,"x":184.16,"y":203.95,"hdg":-2.205,"batt":100.0,"det":false},{"id":3,"x":187.14,"y":204.18,"hdg":-2.214,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":102,"t":102.00,"coverage":0.1289,"drones":[{"id":0,"x":181.17,"y":190.46,"hdg":-1.559,"batt":100.0,"det":false},{"id":1,"x":187.40,"y":193.54,"hdg":-1.592,"batt":100.0,"det":false},{"id":2,"x":184.12,"y":195.95,"hdg":-1.575,"batt":100.0,"det":false},{"id":3,"x":186.99,"y":196.19,"hdg":-1.589,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":103,"t":103.00,"coverage":0.1289,"drones":[{"id":0,"x":186.32,"y":184.34,"hdg":-0.872,"batt":100.0,"det":false},{"id":1,"x":192.38,"y":187.28,"hdg":-0.899,"batt":100.0,"det":false},{"id":2,"x":189.13,"y":189.71,"hdg":-0.895,"batt":100.0,"det":false},{"id":3,"x":191.94,"y":189.90,"hdg":-0.904,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":104,"t":104.00,"coverage":0.1289,"drones":[{"id":0,"x":193.55,"y":180.93,"hdg":-0.441,"batt":100.0,"det":false},{"id":1,"x":199.53,"y":183.71,"hdg":-0.463,"batt":100.0,"det":false},{"id":2,"x":196.28,"y":186.12,"hdg":-0.466,"batt":100.0,"det":false},{"id":3,"x":199.06,"y":186.26,"hdg":-0.472,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":105,"t":105.00,"coverage":0.1289,"drones":[{"id":0,"x":201.17,"y":183.37,"hdg":0.310,"batt":100.0,"det":false},{"id":1,"x":207.16,"y":186.12,"hdg":0.306,"batt":100.0,"det":false},{"id":2,"x":203.94,"y":188.41,"hdg":0.290,"batt":100.0,"det":false},{"id":3,"x":206.72,"y":188.57,"hdg":0.293,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":106,"t":106.00,"coverage":0.1289,"drones":[{"id":0,"x":206.62,"y":189.22,"hdg":0.821,"batt":100.0,"det":false},{"id":1,"x":212.56,"y":192.02,"hdg":0.830,"batt":100.0,"det":false},{"id":2,"x":209.42,"y":194.24,"hdg":0.816,"batt":100.0,"det":false},{"id":3,"x":212.16,"y":194.44,"hdg":0.823,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":107,"t":107.00,"coverage":0.1289,"drones":[{"id":0,"x":208.50,"y":197.00,"hdg":1.334,"batt":100.0,"det":false},{"id":1,"x":214.25,"y":199.84,"hdg":1.358,"batt":100.0,"det":false},{"id":2,"x":211.25,"y":202.03,"hdg":1.341,"batt":100.0,"det":false},{"id":3,"x":213.89,"y":202.25,"hdg":1.353,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":108,"t":108.00,"coverage":0.1289,"drones":[{"id":0,"x":204.43,"y":203.88,"hdg":2.106,"batt":100.0,"det":false},{"id":1,"x":209.99,"y":206.61,"hdg":2.133,"batt":100.0,"det":false},{"id":2,"x":207.02,"y":208.82,"hdg":2.127,"batt":100.0,"det":false},{"id":3,"x":209.60,"y":209.00,"hdg":2.137,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":109,"t":109.00,"coverage":0.1289,"drones":[{"id":0,"x":198.04,"y":208.70,"hdg":2.495,"batt":100.0,"det":false},{"id":1,"x":203.50,"y":211.29,"hdg":2.517,"batt":100.0,"det":false},{"id":2,"x":200.54,"y":213.50,"hdg":2.517,"batt":100.0,"det":false},{"id":3,"x":203.08,"y":213.64,"hdg":2.523,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":110,"t":110.00,"coverage":0.1289,"drones":[{"id":0,"x":190.07,"y":208.03,"hdg":-3.058,"batt":100.0,"det":false},{"id":1,"x":195.54,"y":210.54,"hdg":-3.048,"batt":100.0,"det":false},{"id":2,"x":192.58,"y":212.66,"hdg":-3.036,"batt":100.0,"det":false},{"id":3,"x":195.12,"y":212.80,"hdg":-3.036,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":111,"t":111.00,"coverage":0.1289,"drones":[{"id":0,"x":184.29,"y":202.50,"hdg":-2.378,"batt":100.0,"det":false},{"id":1,"x":189.72,"y":205.05,"hdg":-2.385,"batt":100.0,"det":false},{"id":2,"x":186.84,"y":207.09,"hdg":-2.372,"batt":100.0,"det":false},{"id":3,"x":189.35,"y":207.27,"hdg":-2.378,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":112,"t":112.00,"coverage":0.1289,"drones":[{"id":0,"x":181.18,"y":195.13,"hdg":-1.970,"batt":100.0,"det":false},{"id":1,"x":186.48,"y":197.73,"hdg":-1.988,"batt":100.0,"det":false},{"id":2,"x":183.71,"y":199.72,"hdg":-1.972,"batt":100.0,"det":false},{"id":3,"x":186.15,"y":199.93,"hdg":-1.982,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":113,"t":113.00,"coverage":0.1289,"drones":[{"id":0,"x":184.69,"y":187.94,"hdg":-1.117,"batt":100.0,"det":false},{"id":1,"x":189.80,"y":190.45,"hdg":-1.144,"batt":100.0,"det":false},{"id":2,"x":187.08,"y":192.47,"hdg":-1.136,"batt":100.0,"det":false},{"id":3,"x":189.44,"y":192.64,"hdg":-1.147,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":114,"t":114.00,"coverage":0.1289,"drones":[{"id":0,"x":190.72,"y":182.68,"hdg":-0.717,"batt":100.0,"det":false},{"id":1,"x":195.73,"y":185.08,"hdg":-0.736,"batt":100.0,"det":false},{"id":2,"x":193.02,"y":187.11,"hdg":-0.735,"batt":100.0,"det":false},{"id":3,"x":195.34,"y":187.25,"hdg":-0.741,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":115,"t":115.00,"coverage":0.1289,"drones":[{"id":0,"x":198.69,"y":182.00,"hdg":-0.086,"batt":100.0,"det":false},{"id":1,"x":203.69,"y":184.29,"hdg":-0.099,"batt":100.0,"det":false},{"id":2,"x":200.97,"y":186.24,"hdg":-0.108,"batt":100.0,"det":false},{"id":3,"x":203.30,"y":186.37,"hdg":-0.110,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":116,"t":116.00,"coverage":0.1289,"drones":[{"id":0,"x":204.92,"y":187.02,"hdg":0.679,"batt":100.0,"det":false},{"id":1,"x":209.88,"y":189.35,"hdg":0.685,"batt":100.0,"det":false},{"id":2,"x":207.23,"y":191.22,"hdg":0.672,"batt":100.0,"det":false},{"id":3,"x":209.53,"y":191.38,"hdg":0.677,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":117,"t":117.00,"coverage":0.1289,"drones":[{"id":0,"x":209.34,"y":193.69,"hdg":0.985,"batt":100.0,"det":false},{"id":1,"x":214.23,"y":196.07,"hdg":0.997,"batt":100.0,"det":false},{"id":2,"x":211.66,"y":197.89,"hdg":0.984,"batt":100.0,"det":false},{"id":3,"x":213.91,"y":198.08,"hdg":0.991,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":118,"t":118.00,"coverage":0.1289,"drones":[{"id":0,"x":207.62,"y":201.51,"hdg":1.787,"batt":100.0,"det":false},{"id":1,"x":212.32,"y":203.84,"hdg":1.812,"batt":100.0,"det":false},{"id":2,"x":209.83,"y":205.67,"hdg":1.802,"batt":100.0,"det":false},{"id":3,"x":211.99,"y":205.84,"hdg":1.813,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":119,"t":119.00,"coverage":0.1289,"drones":[{"id":0,"x":201.84,"y":207.03,"hdg":2.379,"batt":100.0,"det":false},{"id":1,"x":206.44,"y":209.26,"hdg":2.396,"batt":100.0,"det":false},{"id":2,"x":203.96,"y":211.11,"hdg":2.395,"batt":100.0,"det":false},{"id":3,"x":206.09,"y":211.25,"hdg":2.400,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":120,"t":120.00,"coverage":0.1289,"drones":[{"id":0,"x":194.33,"y":209.80,"hdg":2.788,"batt":100.0,"det":false},{"id":1,"x":198.89,"y":211.90,"hdg":2.805,"batt":100.0,"det":false},{"id":2,"x":196.39,"y":213.72,"hdg":2.810,"batt":100.0,"det":false},{"id":3,"x":198.52,"y":213.83,"hdg":2.813,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":121,"t":121.00,"coverage":0.1289,"drones":[{"id":0,"x":187.51,"y":205.63,"hdg":-2.593,"batt":100.0,"det":false},{"id":1,"x":192.05,"y":207.75,"hdg":-2.596,"batt":100.0,"det":false},{"id":2,"x":189.61,"y":209.48,"hdg":-2.583,"batt":100.0,"det":false},{"id":3,"x":191.72,"y":209.62,"hdg":-2.588,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":122,"t":122.00,"coverage":0.1289,"drones":[{"id":0,"x":182.25,"y":199.60,"hdg":-2.287,"batt":100.0,"det":false},{"id":1,"x":186.75,"y":201.76,"hdg":-2.294,"batt":100.0,"det":false},{"id":2,"x":184.38,"y":203.43,"hdg":-2.284,"batt":100.0,"det":false},{"id":3,"x":186.45,"y":203.60,"hdg":-2.289,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":123,"t":123.00,"coverage":0.1289,"drones":[{"id":0,"x":182.60,"y":191.60,"hdg":-1.527,"batt":100.0,"det":false},{"id":1,"x":186.92,"y":193.76,"hdg":-1.550,"batt":100.0,"det":false},{"id":2,"x":184.64,"y":195.43,"hdg":-1.538,"batt":100.0,"det":false},{"id":3,"x":186.63,"y":195.60,"hdg":-1.549,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":124,"t":124.00,"coverage":0.1289,"drones":[{"id":0,"x":188.34,"y":186.03,"hdg":-0.771,"batt":100.0,"det":false},{"id":1,"x":192.56,"y":188.09,"hdg":-0.788,"batt":100.0,"det":false},{"id":2,"x":190.29,"y":189.77,"hdg":-0.787,"batt":100.0,"det":false},{"id":3,"x":192.25,"y":189.90,"hdg":-0.792,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":125,"t":125.00,"coverage":0.1289,"drones":[{"id":0,"x":195.36,"y":182.19,"hdg":-0.500,"batt":100.0,"det":false},{"id":1,"x":199.52,"y":184.14,"hdg":-0.516,"batt":100.0,"det":false},{"id":2,"x":197.24,"y":185.81,"hdg":-0.517,"batt":100.0,"det":false},{"id":3,"x":199.18,"y":185.91,"hdg":-0.522,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":126,"t":126.00,"coverage":0.1289,"drones":[{"id":0,"x":202.74,"y":185.27,"hdg":0.395,"batt":100.0,"det":false},{"id":1,"x":206.91,"y":187.21,"hdg":0.394,"batt":100.0,"det":false},{"id":2,"x":204.66,"y":188.80,"hdg":0.383,"batt":100.0,"det":false},{"id":3,"x":206.59,"y":188.93,"hdg":0.386,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":127,"t":127.00,"coverage":0.1289,"drones":[{"id":0,"x":208.15,"y":191.16,"hdg":0.828,"batt":100.0,"det":false},{"id":1,"x":212.28,"y":193.13,"hdg":0.834,"batt":100.0,"det":false},{"id":2,"x":210.09,"y":194.67,"hdg":0.824,"batt":100.0,"det":false},{"id":3,"x":212.00,"y":194.82,"hdg":0.829,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":128,"t":128.00,"coverage":0.1289,"drones":[{"id":0,"x":210.00,"y":198.95,"hdg":1.338,"batt":100.0,"det":false},{"id":1,"x":213.99,"y":200.95,"hdg":1.355,"batt":100.0,"det":false},{"id":2,"x":211.89,"y":202.47,"hdg":1.344,"batt":100.0,"det":false},{"id":3,"x":213.73,"y":202.63,"hdg":1.352,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":129,"t":129.00,"coverage":0.1289,"drones":[{"id":0,"x":205.13,"y":205.30,"hdg":2.225,"batt":100.0,"det":false},{"id":1,"x":209.02,"y":207.21,"hdg":2.242,"batt":100.0,"det":false},{"id":2,"x":206.93,"y":208.75,"hdg":2.239,"batt":100.0,"det":false},{"id":3,"x":208.74,"y":208.88,"hdg":2.245,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":130,"t":130.00,"coverage":0.1289,"drones":[{"id":0,"x":199.02,"y":210.46,"hdg":2.440,"batt":100.0,"det":false},{"id":1,"x":202.83,"y":212.29,"hdg":2.455,"batt":100.0,"det":false},{"id":2,"x":200.75,"y":213.82,"hdg":2.454,"batt":100.0,"det":false},{"id":3,"x":202.53,"y":213.93,"hdg":2.459,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":131,"t":131.00,"coverage":0.1289,"drones":[{"id":0,"x":191.12,"y":209.21,"hdg":-2.984,"batt":100.0,"det":false},{"id":1,"x":194.94,"y":210.99,"hdg":-2.979,"batt":100.0,"det":false},{"id":2,"x":192.87,"y":212.45,"hdg":-2.970,"batt":100.0,"det":false},{"id":3,"x":194.65,"y":212.57,"hdg":-2.970,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":132,"t":132.00,"coverage":0.1289,"drones":[{"id":0,"x":185.72,"y":203.30,"hdg":-2.311,"batt":100.0,"det":false},{"id":1,"x":189.51,"y":205.11,"hdg":-2.317,"batt":100.0,"det":false},{"id":2,"x":187.49,"y":206.53,"hdg":-2.308,"batt":100.0,"det":false},{"id":3,"x":189.25,"y":206.67,"hdg":-2.312,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":133,"t":133.00,"coverage":0.1289,"drones":[{"id":0,"x":182.35,"y":196.05,"hdg":-2.006,"batt":100.0,"det":false},{"id":1,"x":186.06,"y":197.90,"hdg":-2.017,"batt":100.0,"det":false},{"id":2,"x":184.12,"y":199.28,"hdg":-2.007,"batt":100.0,"det":false},{"id":3,"x":185.82,"y":199.44,"hdg":-2.013,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":134,"t":134.00,"coverage":0.1289,"drones":[{"id":0,"x":186.53,"y":189.22,"hdg":-1.022,"batt":100.0,"det":false},{"id":1,"x":190.11,"y":191.00,"hdg":-1.040,"batt":100.0,"det":false},{"id":2,"x":188.19,"y":192.40,"hdg":-1.036,"batt":100.0,"det":false},{"id":3,"x":189.85,"y":192.53,"hdg":-1.042,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":135,"t":135.00,"coverage":0.1289,"drones":[{"id":0,"x":192.51,"y":183.91,"hdg":-0.725,"batt":100.0,"det":false},{"id":1,"x":196.02,"y":185.61,"hdg":-0.738,"batt":100.0,"det":false},{"id":2,"x":194.12,"y":187.02,"hdg":-0.737,"batt":100.0,"det":false},{"id":3,"x":195.75,"y":187.13,"hdg":-0.742,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":136,"t":136.00,"coverage":0.1289,"drones":[{"id":0,"x":200.50,"y":183.40,"hdg":-0.065,"batt":100.0,"det":false},{"id":1,"x":204.00,"y":185.02,"hdg":-0.074,"batt":100.0,"det":false},{"id":2,"x":202.09,"y":186.38,"hdg":-0.080,"batt":100.0,"det":false},{"id":3,"x":203.72,"y":186.47,"hdg":-0.082,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":137,"t":137.00,"coverage":0.1289,"drones":[{"id":0,"x":206.17,"y":189.03,"hdg":0.782,"batt":100.0,"det":false},{"id":1,"x":209.65,"y":190.69,"hdg":0.787,"batt":100.0,"det":false},{"id":2,"x":207.79,"y":191.99,"hdg":0.778,"batt":100.0,"det":false},{"id":3,"x":209.40,"y":192.11,"hdg":0.782,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":138,"t":138.00,"coverage":0.1289,"drones":[{"id":0,"x":210.91,"y":195.48,"hdg":0.937,"batt":100.0,"det":false},{"id":1,"x":214.34,"y":197.16,"hdg":0.944,"batt":100.0,"det":false},{"id":2,"x":212.54,"y":198.43,"hdg":0.935,"batt":100.0,"det":false},{"id":3,"x":214.12,"y":198.57,"hdg":0.940,"batt":100.0,"det":false}]} -{"type":"step","ep":19,"step":139,"t":139.00,"coverage":0.1289,"drones":[{"id":0,"x":208.47,"y":203.10,"hdg":1.881,"batt":100.0,"det":false},{"id":1,"x":211.76,"y":204.74,"hdg":1.899,"batt":100.0,"det":false},{"id":2,"x":210.00,"y":206.02,"hdg":1.893,"batt":100.0,"det":false},{"id":3,"x":211.53,"y":206.14,"hdg":1.900,"batt":100.0,"det":false}]} -{"type":"episode","ep":19,"mean_return":132.4876,"policy_loss":-6445.3413,"value_loss":205555.6875,"victims_found":0} diff --git a/v2/crates/ruview-swarm/viz/sample_telemetry.jsonl b/v2/crates/ruview-swarm/viz/sample_telemetry.jsonl deleted file mode 100644 index 7fd5d239..00000000 --- a/v2/crates/ruview-swarm/viz/sample_telemetry.jsonl +++ /dev/null @@ -1,151 +0,0 @@ -{"type":"meta","profile":"sar · flight=partitioned_lawnmower · learn=curiosity","drones":4,"area_w":400.00,"area_h":400.00,"victims":[[80.00,120.00],[240.00,180.00]]} -{"type":"episode","ep":0,"mean_return":741.0585,"policy_loss":-620.2698,"value_loss":895311.9375,"victims_found":0} -{"type":"episode","ep":1,"mean_return":741.0585,"policy_loss":-990.6716,"value_loss":894566.8750,"victims_found":0} -{"type":"episode","ep":2,"mean_return":741.0585,"policy_loss":-1413.1008,"value_loss":893805.3125,"victims_found":0} -{"type":"episode","ep":3,"mean_return":741.0585,"policy_loss":-1880.1860,"value_loss":892984.3125,"victims_found":0} -{"type":"episode","ep":4,"mean_return":741.0585,"policy_loss":-2413.7896,"value_loss":892056.8750,"victims_found":0} -{"type":"episode","ep":5,"mean_return":741.0585,"policy_loss":-3023.4106,"value_loss":891006.7500,"victims_found":0} -{"type":"episode","ep":6,"mean_return":741.0585,"policy_loss":-3718.3889,"value_loss":889813.3750,"victims_found":0} -{"type":"episode","ep":7,"mean_return":741.0585,"policy_loss":-4531.2881,"value_loss":888444.9375,"victims_found":0} -{"type":"episode","ep":8,"mean_return":741.0585,"policy_loss":-5481.8413,"value_loss":886880.6250,"victims_found":0} -{"type":"episode","ep":9,"mean_return":741.0585,"policy_loss":-6585.8242,"value_loss":885090.9375,"victims_found":0} -{"type":"episode","ep":10,"mean_return":741.0585,"policy_loss":-7877.0918,"value_loss":883025.6875,"victims_found":0} -{"type":"episode","ep":11,"mean_return":741.0585,"policy_loss":-9397.7676,"value_loss":880637.3125,"victims_found":0} -{"type":"episode","ep":12,"mean_return":741.0585,"policy_loss":-11170.0850,"value_loss":877859.1875,"victims_found":0} -{"type":"episode","ep":13,"mean_return":741.0585,"policy_loss":-13207.6719,"value_loss":874662.1875,"victims_found":0} -{"type":"episode","ep":14,"mean_return":741.0585,"policy_loss":-15539.2266,"value_loss":871001.6250,"victims_found":0} -{"type":"episode","ep":15,"mean_return":741.0585,"policy_loss":-18196.9355,"value_loss":866829.7500,"victims_found":0} -{"type":"episode","ep":16,"mean_return":741.0585,"policy_loss":-21217.7344,"value_loss":862094.5000,"victims_found":0} -{"type":"episode","ep":17,"mean_return":741.0585,"policy_loss":-24640.4941,"value_loss":856742.5625,"victims_found":0} -{"type":"episode","ep":18,"mean_return":741.0585,"policy_loss":-28501.7402,"value_loss":850726.5625,"victims_found":0} -{"type":"episode","ep":19,"mean_return":741.0585,"policy_loss":-32825.4297,"value_loss":844003.0000,"victims_found":0} -{"type":"episode","ep":20,"mean_return":741.0585,"policy_loss":-37638.2344,"value_loss":836530.1250,"victims_found":0} -{"type":"episode","ep":21,"mean_return":741.0585,"policy_loss":-42972.3633,"value_loss":828270.1875,"victims_found":0} -{"type":"episode","ep":22,"mean_return":741.0585,"policy_loss":-48866.8125,"value_loss":819184.3750,"victims_found":0} -{"type":"episode","ep":23,"mean_return":741.0585,"policy_loss":-55348.8242,"value_loss":809248.5000,"victims_found":0} -{"type":"episode","ep":24,"mean_return":741.0585,"policy_loss":-62441.0039,"value_loss":798454.4375,"victims_found":0} -{"type":"episode","ep":25,"mean_return":741.0585,"policy_loss":-70163.4062,"value_loss":786799.1875,"victims_found":0} -{"type":"episode","ep":26,"mean_return":741.0585,"policy_loss":-78538.6641,"value_loss":774283.5625,"victims_found":0} -{"type":"episode","ep":27,"mean_return":741.0585,"policy_loss":-87601.0078,"value_loss":760896.3750,"victims_found":0} -{"type":"episode","ep":28,"mean_return":741.0585,"policy_loss":-97379.8828,"value_loss":746647.8750,"victims_found":0} -{"type":"step","ep":29,"step":0,"t":0.00,"coverage":0.0155,"drones":[{"id":0,"x":14.00,"y":14.00,"hdg":0.785,"batt":100.0,"det":false},{"id":1,"x":202.01,"y":10.33,"hdg":3.100,"batt":100.0,"det":false},{"id":2,"x":15.77,"y":204.46,"hdg":-0.765,"batt":100.0,"det":false},{"id":3,"x":213.75,"y":202.93,"hdg":-1.083,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":1,"t":1.00,"coverage":0.0208,"drones":[{"id":0,"x":22.00,"y":14.00,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":194.02,"y":10.82,"hdg":3.081,"batt":100.0,"det":false},{"id":2,"x":21.89,"y":199.31,"hdg":-0.700,"batt":100.0,"det":false},{"id":3,"x":218.24,"y":196.31,"hdg":-0.974,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":2,"t":2.00,"coverage":0.0264,"drones":[{"id":0,"x":30.00,"y":14.00,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":186.09,"y":11.87,"hdg":3.010,"batt":100.0,"det":false},{"id":2,"x":28.30,"y":194.52,"hdg":-0.641,"batt":100.0,"det":false},{"id":3,"x":223.36,"y":190.17,"hdg":-0.877,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":3,"t":3.00,"coverage":0.0306,"drones":[{"id":0,"x":38.00,"y":14.00,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":193.97,"y":13.28,"hdg":0.177,"batt":100.0,"det":false},{"id":2,"x":34.95,"y":190.07,"hdg":-0.590,"batt":100.0,"det":false},{"id":3,"x":228.99,"y":184.48,"hdg":-0.790,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":4,"t":4.00,"coverage":0.0362,"drones":[{"id":0,"x":45.25,"y":17.38,"hdg":0.437,"batt":100.0,"det":false},{"id":1,"x":195.08,"y":21.20,"hdg":1.431,"batt":100.0,"det":false},{"id":2,"x":41.92,"y":186.14,"hdg":-0.513,"batt":100.0,"det":false},{"id":3,"x":235.11,"y":179.33,"hdg":-0.700,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":5,"t":5.00,"coverage":0.0413,"drones":[{"id":0,"x":50.92,"y":23.02,"hdg":0.783,"batt":100.0,"det":false},{"id":1,"x":188.92,"y":26.31,"hdg":2.449,"batt":100.0,"det":false},{"id":2,"x":48.68,"y":181.87,"hdg":-0.564,"batt":100.0,"det":false},{"id":3,"x":240.72,"y":173.62,"hdg":-0.794,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":6,"t":6.00,"coverage":0.0466,"drones":[{"id":0,"x":47.52,"y":30.26,"hdg":2.010,"batt":100.0,"det":false},{"id":1,"x":181.33,"y":28.85,"hdg":2.819,"batt":100.0,"det":false},{"id":2,"x":55.16,"y":177.18,"hdg":-0.626,"batt":100.0,"det":false},{"id":3,"x":245.59,"y":167.28,"hdg":-0.915,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":7,"t":7.00,"coverage":0.0519,"drones":[{"id":0,"x":39.97,"y":32.91,"hdg":2.805,"batt":100.0,"det":false},{"id":1,"x":173.48,"y":30.38,"hdg":2.949,"batt":100.0,"det":false},{"id":2,"x":61.25,"y":172.00,"hdg":-0.705,"batt":100.0,"det":false},{"id":3,"x":249.43,"y":160.26,"hdg":-1.071,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":8,"t":8.00,"coverage":0.0573,"drones":[{"id":0,"x":35.38,"y":39.46,"hdg":2.182,"batt":100.0,"det":false},{"id":1,"x":166.82,"y":34.81,"hdg":2.554,"batt":100.0,"det":false},{"id":2,"x":67.91,"y":167.55,"hdg":-0.589,"batt":100.0,"det":false},{"id":3,"x":254.08,"y":153.75,"hdg":-0.950,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":9,"t":9.00,"coverage":0.0628,"drones":[{"id":0,"x":37.07,"y":47.28,"hdg":1.357,"batt":100.0,"det":false},{"id":1,"x":162.21,"y":41.35,"hdg":2.185,"batt":100.0,"det":false},{"id":2,"x":74.89,"y":163.64,"hdg":-0.511,"batt":100.0,"det":false},{"id":3,"x":259.88,"y":148.23,"hdg":-0.761,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":10,"t":10.00,"coverage":0.0684,"drones":[{"id":0,"x":43.66,"y":51.82,"hdg":0.604,"batt":100.0,"det":false},{"id":1,"x":164.31,"y":49.07,"hdg":1.305,"batt":100.0,"det":false},{"id":2,"x":82.10,"y":160.18,"hdg":-0.447,"batt":100.0,"det":false},{"id":3,"x":266.40,"y":143.60,"hdg":-0.618,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":11,"t":11.00,"coverage":0.0736,"drones":[{"id":0,"x":51.25,"y":54.36,"hdg":0.323,"batt":100.0,"det":false},{"id":1,"x":171.11,"y":53.29,"hdg":0.556,"batt":100.0,"det":false},{"id":2,"x":89.48,"y":157.10,"hdg":-0.396,"batt":100.0,"det":false},{"id":3,"x":273.38,"y":139.70,"hdg":-0.510,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":12,"t":12.00,"coverage":0.0794,"drones":[{"id":0,"x":57.09,"y":59.82,"hdg":0.751,"batt":100.0,"det":false},{"id":1,"x":175.23,"y":60.15,"hdg":1.029,"batt":100.0,"det":false},{"id":2,"x":97.18,"y":154.92,"hdg":-0.276,"batt":100.0,"det":false},{"id":3,"x":280.97,"y":137.16,"hdg":-0.323,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":13,"t":13.00,"coverage":0.0848,"drones":[{"id":0,"x":59.66,"y":67.40,"hdg":1.245,"batt":100.0,"det":false},{"id":1,"x":174.14,"y":68.07,"hdg":1.708,"batt":100.0,"det":false},{"id":2,"x":104.78,"y":152.41,"hdg":-0.318,"batt":100.0,"det":false},{"id":3,"x":288.29,"y":133.94,"hdg":-0.414,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":14,"t":14.00,"coverage":0.0903,"drones":[{"id":0,"x":55.66,"y":74.33,"hdg":2.094,"batt":100.0,"det":false},{"id":1,"x":168.28,"y":73.52,"hdg":2.392,"batt":100.0,"det":false},{"id":2,"x":112.21,"y":149.46,"hdg":-0.378,"batt":100.0,"det":false},{"id":3,"x":294.94,"y":129.49,"hdg":-0.590,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":15,"t":15.00,"coverage":0.0956,"drones":[{"id":0,"x":48.70,"y":78.28,"hdg":2.625,"batt":100.0,"det":false},{"id":1,"x":160.99,"y":76.81,"hdg":2.718,"batt":100.0,"det":false},{"id":2,"x":119.35,"y":145.86,"hdg":-0.468,"batt":100.0,"det":false},{"id":3,"x":299.08,"y":122.64,"hdg":-1.026,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":16,"t":16.00,"coverage":0.1017,"drones":[{"id":0,"x":44.00,"y":84.75,"hdg":2.200,"batt":100.0,"det":false},{"id":1,"x":155.46,"y":82.60,"hdg":2.333,"batt":100.0,"det":false},{"id":2,"x":127.18,"y":144.21,"hdg":-0.207,"batt":100.0,"det":false},{"id":3,"x":306.89,"y":124.40,"hdg":0.221,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":17,"t":17.00,"coverage":0.1072,"drones":[{"id":0,"x":43.61,"y":92.74,"hdg":1.619,"batt":100.0,"det":false},{"id":1,"x":153.09,"y":90.24,"hdg":1.872,"batt":100.0,"det":false},{"id":2,"x":135.08,"y":142.96,"hdg":-0.157,"batt":100.0,"det":false},{"id":3,"x":314.88,"y":124.76,"hdg":0.046,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":18,"t":18.00,"coverage":0.1123,"drones":[{"id":0,"x":48.58,"y":99.01,"hdg":0.900,"batt":100.0,"det":false},{"id":1,"x":156.51,"y":97.47,"hdg":1.129,"batt":100.0,"det":false},{"id":2,"x":143.02,"y":141.96,"hdg":-0.125,"batt":100.0,"det":false},{"id":3,"x":322.88,"y":124.94,"hdg":0.022,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":19,"t":19.00,"coverage":0.1181,"drones":[{"id":0,"x":55.60,"y":102.84,"hdg":0.500,"batt":100.0,"det":false},{"id":1,"x":163.10,"y":102.00,"hdg":0.602,"batt":100.0,"det":false},{"id":2,"x":150.98,"y":141.14,"hdg":-0.103,"batt":100.0,"det":false},{"id":3,"x":330.87,"y":125.06,"hdg":0.014,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":20,"t":20.00,"coverage":0.1234,"drones":[{"id":0,"x":60.71,"y":109.00,"hdg":0.879,"batt":100.0,"det":false},{"id":1,"x":167.56,"y":108.65,"hdg":0.980,"batt":100.0,"det":false},{"id":2,"x":158.95,"y":141.84,"hdg":0.087,"batt":100.0,"det":false},{"id":3,"x":338.22,"y":128.22,"hdg":0.407,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":21,"t":21.00,"coverage":0.1283,"drones":[{"id":0,"x":62.33,"y":116.84,"hdg":1.367,"batt":100.0,"det":false},{"id":1,"x":167.99,"y":116.63,"hdg":1.517,"batt":100.0,"det":false},{"id":2,"x":166.90,"y":142.71,"hdg":0.109,"batt":100.0,"det":false},{"id":3,"x":344.43,"y":133.26,"hdg":0.681,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":22,"t":22.00,"coverage":0.1334,"drones":[{"id":0,"x":58.49,"y":123.86,"hdg":2.071,"batt":100.0,"det":false},{"id":1,"x":163.42,"y":123.20,"hdg":2.179,"batt":100.0,"det":false},{"id":2,"x":174.81,"y":143.90,"hdg":0.149,"batt":100.0,"det":false},{"id":3,"x":343.50,"y":141.21,"hdg":1.688,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":23,"t":23.00,"coverage":0.1372,"drones":[{"id":0,"x":51.86,"y":128.34,"hdg":2.546,"batt":100.0,"det":false},{"id":1,"x":156.63,"y":127.43,"hdg":2.584,"batt":100.0,"det":false},{"id":2,"x":182.56,"y":145.90,"hdg":0.252,"batt":100.0,"det":false},{"id":3,"x":336.16,"y":144.39,"hdg":2.732,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":24,"t":24.00,"coverage":0.1416,"drones":[{"id":0,"x":47.25,"y":134.88,"hdg":2.185,"batt":100.0,"det":false},{"id":1,"x":151.71,"y":133.74,"hdg":2.234,"batt":100.0,"det":false},{"id":2,"x":187.81,"y":151.93,"hdg":0.854,"batt":100.0,"det":false},{"id":3,"x":332.10,"y":151.28,"hdg":2.103,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":25,"t":25.00,"coverage":0.1459,"drones":[{"id":0,"x":46.37,"y":142.83,"hdg":1.682,"batt":100.0,"det":false},{"id":1,"x":150.13,"y":141.58,"hdg":1.769,"batt":100.0,"det":false},{"id":2,"x":194.81,"y":155.81,"hdg":0.507,"batt":100.0,"det":false},{"id":3,"x":334.55,"y":158.90,"hdg":1.259,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":26,"t":26.00,"coverage":0.1502,"drones":[{"id":0,"x":50.50,"y":149.68,"hdg":1.028,"batt":100.0,"det":false},{"id":1,"x":153.66,"y":148.76,"hdg":1.114,"batt":100.0,"det":false},{"id":2,"x":202.36,"y":158.44,"hdg":0.335,"batt":100.0,"det":false},{"id":3,"x":341.26,"y":163.27,"hdg":0.578,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":27,"t":27.00,"coverage":0.1539,"drones":[{"id":0,"x":57.11,"y":154.18,"hdg":0.597,"batt":100.0,"det":false},{"id":1,"x":160.06,"y":153.56,"hdg":0.643,"batt":100.0,"det":false},{"id":2,"x":210.13,"y":160.36,"hdg":0.242,"batt":100.0,"det":false},{"id":3,"x":348.85,"y":165.77,"hdg":0.319,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":28,"t":28.00,"coverage":0.1578,"drones":[{"id":0,"x":61.84,"y":160.63,"hdg":0.939,"batt":100.0,"det":false},{"id":1,"x":164.52,"y":160.20,"hdg":0.979,"batt":100.0,"det":false},{"id":2,"x":217.10,"y":164.29,"hdg":0.514,"batt":100.0,"det":false},{"id":3,"x":354.80,"y":171.13,"hdg":0.733,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":29,"t":29.00,"coverage":0.1606,"drones":[{"id":0,"x":63.14,"y":168.53,"hdg":1.407,"batt":100.0,"det":false},{"id":1,"x":165.40,"y":168.15,"hdg":1.461,"batt":100.0,"det":false},{"id":2,"x":223.15,"y":169.52,"hdg":0.713,"batt":100.0,"det":false},{"id":3,"x":357.71,"y":178.58,"hdg":1.198,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":30,"t":30.00,"coverage":0.1634,"drones":[{"id":0,"x":59.51,"y":175.65,"hdg":2.042,"batt":100.0,"det":false},{"id":1,"x":161.49,"y":175.13,"hdg":2.081,"batt":100.0,"det":false},{"id":2,"x":226.53,"y":176.77,"hdg":1.135,"batt":100.0,"det":false},{"id":3,"x":354.14,"y":185.73,"hdg":2.034,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":31,"t":31.00,"coverage":0.1661,"drones":[{"id":0,"x":53.13,"y":180.47,"hdg":2.495,"batt":100.0,"det":false},{"id":1,"x":155.05,"y":179.87,"hdg":2.508,"batt":100.0,"det":false},{"id":2,"x":223.70,"y":184.26,"hdg":1.931,"batt":100.0,"det":false},{"id":3,"x":347.29,"y":189.87,"hdg":2.598,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":32,"t":32.00,"coverage":0.1692,"drones":[{"id":0,"x":48.63,"y":187.09,"hdg":2.168,"batt":100.0,"det":false},{"id":1,"x":150.43,"y":186.40,"hdg":2.186,"batt":100.0,"det":false},{"id":2,"x":222.28,"y":192.13,"hdg":1.749,"batt":100.0,"det":false},{"id":3,"x":342.74,"y":196.45,"hdg":2.176,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":33,"t":33.00,"coverage":0.1741,"drones":[{"id":0,"x":47.59,"y":195.02,"hdg":1.700,"batt":100.0,"det":false},{"id":1,"x":149.14,"y":194.30,"hdg":1.733,"batt":100.0,"det":false},{"id":2,"x":225.44,"y":199.48,"hdg":1.165,"batt":100.0,"det":false},{"id":3,"x":342.60,"y":204.45,"hdg":1.589,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":34,"t":34.00,"coverage":0.1792,"drones":[{"id":0,"x":51.29,"y":202.12,"hdg":1.090,"batt":100.0,"det":false},{"id":1,"x":152.59,"y":201.52,"hdg":1.125,"batt":100.0,"det":false},{"id":2,"x":231.49,"y":204.71,"hdg":0.713,"batt":100.0,"det":false},{"id":3,"x":347.66,"y":210.64,"hdg":0.886,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":35,"t":35.00,"coverage":0.1847,"drones":[{"id":0,"x":57.64,"y":206.99,"hdg":0.655,"batt":100.0,"det":false},{"id":1,"x":158.82,"y":206.53,"hdg":0.677,"batt":100.0,"det":false},{"id":2,"x":238.65,"y":208.29,"hdg":0.464,"batt":100.0,"det":false},{"id":3,"x":354.69,"y":214.46,"hdg":0.498,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":36,"t":36.00,"coverage":0.1902,"drones":[{"id":0,"x":62.15,"y":213.59,"hdg":0.971,"batt":100.0,"det":false},{"id":1,"x":163.22,"y":213.21,"hdg":0.988,"batt":100.0,"det":false},{"id":2,"x":244.38,"y":213.87,"hdg":0.771,"batt":100.0,"det":false},{"id":3,"x":359.83,"y":220.59,"hdg":0.872,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":37,"t":37.00,"coverage":0.1952,"drones":[{"id":0,"x":63.34,"y":221.50,"hdg":1.422,"batt":100.0,"det":false},{"id":1,"x":164.24,"y":221.14,"hdg":1.443,"batt":100.0,"det":false},{"id":2,"x":247.91,"y":221.05,"hdg":1.114,"batt":100.0,"det":false},{"id":3,"x":361.58,"y":228.40,"hdg":1.351,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":38,"t":38.00,"coverage":0.2009,"drones":[{"id":0,"x":59.88,"y":228.72,"hdg":2.018,"batt":100.0,"det":false},{"id":1,"x":160.69,"y":228.31,"hdg":2.031,"batt":100.0,"det":false},{"id":2,"x":246.87,"y":228.98,"hdg":1.702,"batt":100.0,"det":false},{"id":3,"x":357.89,"y":235.49,"hdg":2.051,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":39,"t":39.00,"coverage":0.2064,"drones":[{"id":0,"x":53.67,"y":233.76,"hdg":2.459,"batt":100.0,"det":false},{"id":1,"x":154.46,"y":233.34,"hdg":2.462,"batt":100.0,"det":false},{"id":2,"x":241.56,"y":234.96,"hdg":2.297,"batt":100.0,"det":false},{"id":3,"x":351.32,"y":240.06,"hdg":2.534,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":40,"t":40.00,"coverage":0.2119,"drones":[{"id":0,"x":49.27,"y":240.44,"hdg":2.153,"batt":100.0,"det":false},{"id":1,"x":150.02,"y":239.99,"hdg":2.159,"batt":100.0,"det":false},{"id":2,"x":238.17,"y":242.21,"hdg":2.008,"batt":100.0,"det":false},{"id":3,"x":346.77,"y":246.64,"hdg":2.176,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":41,"t":41.00,"coverage":0.2177,"drones":[{"id":0,"x":48.19,"y":248.37,"hdg":1.706,"batt":100.0,"det":false},{"id":1,"x":148.85,"y":247.90,"hdg":1.718,"batt":100.0,"det":false},{"id":2,"x":238.76,"y":250.19,"hdg":1.497,"batt":100.0,"det":false},{"id":3,"x":345.97,"y":254.60,"hdg":1.671,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":42,"t":42.00,"coverage":0.2233,"drones":[{"id":0,"x":51.64,"y":255.59,"hdg":1.125,"batt":100.0,"det":false},{"id":1,"x":152.19,"y":255.17,"hdg":1.141,"batt":100.0,"det":false},{"id":2,"x":243.41,"y":256.71,"hdg":0.951,"batt":100.0,"det":false},{"id":3,"x":350.13,"y":261.43,"hdg":1.023,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":43,"t":43.00,"coverage":0.2289,"drones":[{"id":0,"x":57.80,"y":260.69,"hdg":0.692,"batt":100.0,"det":false},{"id":1,"x":158.29,"y":260.35,"hdg":0.703,"batt":100.0,"det":false},{"id":2,"x":250.01,"y":261.22,"hdg":0.599,"batt":100.0,"det":false},{"id":3,"x":356.75,"y":265.93,"hdg":0.598,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":44,"t":44.00,"coverage":0.2338,"drones":[{"id":0,"x":62.19,"y":267.38,"hdg":0.990,"batt":100.0,"det":false},{"id":1,"x":162.62,"y":267.07,"hdg":0.999,"batt":100.0,"det":false},{"id":2,"x":254.97,"y":267.50,"hdg":0.902,"batt":100.0,"det":false},{"id":3,"x":361.49,"y":272.37,"hdg":0.936,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":45,"t":45.00,"coverage":0.2397,"drones":[{"id":0,"x":63.32,"y":275.30,"hdg":1.429,"batt":100.0,"det":false},{"id":1,"x":163.69,"y":275.00,"hdg":1.437,"batt":100.0,"det":false},{"id":2,"x":257.10,"y":275.21,"hdg":1.302,"batt":100.0,"det":false},{"id":3,"x":362.84,"y":280.26,"hdg":1.401,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":46,"t":46.00,"coverage":0.2452,"drones":[{"id":0,"x":60.00,"y":282.58,"hdg":1.999,"batt":100.0,"det":false},{"id":1,"x":160.33,"y":282.27,"hdg":2.003,"batt":100.0,"det":false},{"id":2,"x":254.64,"y":282.82,"hdg":1.883,"batt":100.0,"det":false},{"id":3,"x":359.27,"y":287.41,"hdg":2.034,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":47,"t":47.00,"coverage":0.2500,"drones":[{"id":0,"x":53.92,"y":287.79,"hdg":2.433,"batt":100.0,"det":false},{"id":1,"x":154.26,"y":287.47,"hdg":2.433,"batt":100.0,"det":false},{"id":2,"x":248.88,"y":288.37,"hdg":2.375,"batt":100.0,"det":false},{"id":3,"x":352.91,"y":292.27,"hdg":2.489,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":48,"t":48.00,"coverage":0.2559,"drones":[{"id":0,"x":49.60,"y":294.52,"hdg":2.141,"batt":100.0,"det":false},{"id":1,"x":149.93,"y":294.20,"hdg":2.143,"batt":100.0,"det":false},{"id":2,"x":244.94,"y":295.34,"hdg":2.086,"batt":100.0,"det":false},{"id":3,"x":348.44,"y":298.90,"hdg":2.164,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":49,"t":49.00,"coverage":0.2614,"drones":[{"id":0,"x":48.52,"y":302.45,"hdg":1.707,"batt":100.0,"det":false},{"id":1,"x":148.80,"y":302.12,"hdg":1.712,"batt":100.0,"det":false},{"id":2,"x":244.51,"y":303.33,"hdg":1.625,"batt":100.0,"det":false},{"id":3,"x":347.44,"y":306.84,"hdg":1.696,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":50,"t":50.00,"coverage":0.2672,"drones":[{"id":0,"x":51.81,"y":309.74,"hdg":1.147,"batt":100.0,"det":false},{"id":1,"x":152.04,"y":309.44,"hdg":1.154,"batt":100.0,"det":false},{"id":2,"x":248.34,"y":310.35,"hdg":1.071,"batt":100.0,"det":false},{"id":3,"x":351.14,"y":313.93,"hdg":1.089,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":51,"t":51.00,"coverage":0.2727,"drones":[{"id":0,"x":57.84,"y":314.99,"hdg":0.717,"batt":100.0,"det":false},{"id":1,"x":158.04,"y":314.73,"hdg":0.723,"batt":100.0,"det":false},{"id":2,"x":254.60,"y":315.34,"hdg":0.674,"batt":100.0,"det":false},{"id":3,"x":357.48,"y":318.81,"hdg":0.656,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":52,"t":52.00,"coverage":0.2781,"drones":[{"id":0,"x":62.14,"y":321.74,"hdg":1.003,"batt":100.0,"det":false},{"id":1,"x":162.31,"y":321.49,"hdg":1.007,"batt":100.0,"det":false},{"id":2,"x":259.15,"y":321.92,"hdg":0.965,"batt":100.0,"det":false},{"id":3,"x":362.00,"y":325.41,"hdg":0.971,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":53,"t":53.00,"coverage":0.2833,"drones":[{"id":0,"x":63.25,"y":329.66,"hdg":1.432,"batt":100.0,"det":false},{"id":1,"x":163.39,"y":329.42,"hdg":1.436,"batt":100.0,"det":false},{"id":2,"x":260.67,"y":329.77,"hdg":1.380,"batt":100.0,"det":false},{"id":3,"x":363.21,"y":333.32,"hdg":1.420,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":54,"t":54.00,"coverage":0.2891,"drones":[{"id":0,"x":60.03,"y":336.99,"hdg":1.985,"batt":100.0,"det":false},{"id":1,"x":160.17,"y":336.74,"hdg":1.986,"batt":100.0,"det":false},{"id":2,"x":257.78,"y":337.23,"hdg":1.940,"batt":100.0,"det":false},{"id":3,"x":359.77,"y":340.55,"hdg":2.014,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":55,"t":55.00,"coverage":0.2944,"drones":[{"id":0,"x":54.06,"y":342.31,"hdg":2.414,"batt":100.0,"det":false},{"id":1,"x":154.20,"y":342.07,"hdg":2.412,"batt":100.0,"det":false},{"id":2,"x":251.93,"y":342.68,"hdg":2.392,"batt":100.0,"det":false},{"id":3,"x":353.58,"y":345.61,"hdg":2.456,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":56,"t":56.00,"coverage":0.2998,"drones":[{"id":0,"x":49.49,"y":348.88,"hdg":2.178,"batt":100.0,"det":false},{"id":1,"x":149.64,"y":348.64,"hdg":2.177,"batt":100.0,"det":false},{"id":2,"x":247.51,"y":349.35,"hdg":2.155,"batt":100.0,"det":false},{"id":3,"x":348.88,"y":352.08,"hdg":2.200,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":57,"t":57.00,"coverage":0.3050,"drones":[{"id":0,"x":48.33,"y":356.79,"hdg":1.716,"batt":100.0,"det":false},{"id":1,"x":148.46,"y":356.56,"hdg":1.718,"batt":100.0,"det":false},{"id":2,"x":246.65,"y":357.31,"hdg":1.679,"batt":100.0,"det":false},{"id":3,"x":347.74,"y":360.00,"hdg":1.713,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":58,"t":58.00,"coverage":0.3109,"drones":[{"id":0,"x":51.92,"y":363.95,"hdg":1.106,"batt":100.0,"det":false},{"id":1,"x":152.02,"y":363.73,"hdg":1.111,"batt":100.0,"det":false},{"id":2,"x":250.49,"y":364.33,"hdg":1.070,"batt":100.0,"det":false},{"id":3,"x":351.63,"y":366.99,"hdg":1.063,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":59,"t":59.00,"coverage":0.3159,"drones":[{"id":0,"x":58.22,"y":368.88,"hdg":0.664,"batt":100.0,"det":false},{"id":1,"x":158.30,"y":368.68,"hdg":0.668,"batt":100.0,"det":false},{"id":2,"x":256.88,"y":369.13,"hdg":0.644,"batt":100.0,"det":false},{"id":3,"x":358.15,"y":371.63,"hdg":0.619,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":60,"t":60.00,"coverage":0.3172,"drones":[{"id":0,"x":57.23,"y":360.94,"hdg":-1.695,"batt":100.0,"det":false},{"id":1,"x":157.31,"y":360.74,"hdg":-1.695,"batt":100.0,"det":false},{"id":2,"x":255.92,"y":361.19,"hdg":-1.691,"batt":100.0,"det":false},{"id":3,"x":357.17,"y":363.69,"hdg":-1.694,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":61,"t":61.00,"coverage":0.3177,"drones":[{"id":0,"x":56.88,"y":352.94,"hdg":-1.615,"batt":100.0,"det":false},{"id":1,"x":156.95,"y":352.75,"hdg":-1.615,"batt":100.0,"det":false},{"id":2,"x":255.60,"y":353.19,"hdg":-1.611,"batt":100.0,"det":false},{"id":3,"x":356.82,"y":355.70,"hdg":-1.614,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":62,"t":62.00,"coverage":0.3177,"drones":[{"id":0,"x":57.19,"y":344.95,"hdg":-1.532,"batt":100.0,"det":false},{"id":1,"x":157.26,"y":344.76,"hdg":-1.532,"batt":100.0,"det":false},{"id":2,"x":255.94,"y":345.20,"hdg":-1.528,"batt":100.0,"det":false},{"id":3,"x":357.13,"y":347.71,"hdg":-1.532,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":63,"t":63.00,"coverage":0.3178,"drones":[{"id":0,"x":58.17,"y":337.01,"hdg":-1.448,"batt":100.0,"det":false},{"id":1,"x":158.24,"y":336.82,"hdg":-1.448,"batt":100.0,"det":false},{"id":2,"x":256.95,"y":337.26,"hdg":-1.444,"batt":100.0,"det":false},{"id":3,"x":358.10,"y":339.76,"hdg":-1.449,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":64,"t":64.00,"coverage":0.3181,"drones":[{"id":0,"x":59.24,"y":329.08,"hdg":-1.437,"batt":100.0,"det":false},{"id":1,"x":159.31,"y":328.89,"hdg":-1.437,"batt":100.0,"det":false},{"id":2,"x":258.05,"y":329.34,"hdg":-1.433,"batt":100.0,"det":false},{"id":3,"x":359.16,"y":331.84,"hdg":-1.438,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":65,"t":65.00,"coverage":0.3181,"drones":[{"id":0,"x":59.54,"y":321.09,"hdg":-1.533,"batt":100.0,"det":false},{"id":1,"x":159.61,"y":320.89,"hdg":-1.534,"batt":100.0,"det":false},{"id":2,"x":258.39,"y":321.35,"hdg":-1.529,"batt":100.0,"det":false},{"id":3,"x":359.46,"y":323.84,"hdg":-1.533,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":66,"t":66.00,"coverage":0.3192,"drones":[{"id":0,"x":59.04,"y":313.10,"hdg":-1.634,"batt":100.0,"det":false},{"id":1,"x":159.10,"y":312.91,"hdg":-1.634,"batt":100.0,"det":false},{"id":2,"x":257.92,"y":313.36,"hdg":-1.629,"batt":100.0,"det":false},{"id":3,"x":358.97,"y":315.86,"hdg":-1.633,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":67,"t":67.00,"coverage":0.3202,"drones":[{"id":0,"x":57.73,"y":305.21,"hdg":-1.735,"batt":100.0,"det":false},{"id":1,"x":157.79,"y":305.02,"hdg":-1.736,"batt":100.0,"det":false},{"id":2,"x":256.64,"y":305.46,"hdg":-1.731,"batt":100.0,"det":false},{"id":3,"x":357.67,"y":307.96,"hdg":-1.734,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":68,"t":68.00,"coverage":0.3203,"drones":[{"id":0,"x":56.26,"y":297.35,"hdg":-1.755,"batt":100.0,"det":false},{"id":1,"x":156.32,"y":297.15,"hdg":-1.755,"batt":100.0,"det":false},{"id":2,"x":255.21,"y":297.59,"hdg":-1.750,"batt":100.0,"det":false},{"id":3,"x":356.23,"y":300.09,"hdg":-1.752,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":69,"t":69.00,"coverage":0.3203,"drones":[{"id":0,"x":55.76,"y":289.36,"hdg":-1.633,"batt":100.0,"det":false},{"id":1,"x":155.82,"y":289.17,"hdg":-1.634,"batt":100.0,"det":false},{"id":2,"x":254.75,"y":289.60,"hdg":-1.629,"batt":100.0,"det":false},{"id":3,"x":355.73,"y":292.11,"hdg":-1.633,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":70,"t":70.00,"coverage":0.3209,"drones":[{"id":0,"x":56.28,"y":281.38,"hdg":-1.506,"batt":100.0,"det":false},{"id":1,"x":156.34,"y":281.19,"hdg":-1.506,"batt":100.0,"det":false},{"id":2,"x":255.30,"y":281.62,"hdg":-1.501,"batt":100.0,"det":false},{"id":3,"x":356.25,"y":284.13,"hdg":-1.507,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":71,"t":71.00,"coverage":0.3209,"drones":[{"id":0,"x":57.83,"y":273.53,"hdg":-1.376,"batt":100.0,"det":false},{"id":1,"x":157.88,"y":273.34,"hdg":-1.376,"batt":100.0,"det":false},{"id":2,"x":256.89,"y":273.78,"hdg":-1.372,"batt":100.0,"det":false},{"id":3,"x":357.78,"y":276.27,"hdg":-1.378,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":72,"t":72.00,"coverage":0.3212,"drones":[{"id":0,"x":59.61,"y":265.73,"hdg":-1.346,"batt":100.0,"det":false},{"id":1,"x":159.67,"y":265.54,"hdg":-1.346,"batt":100.0,"det":false},{"id":2,"x":258.71,"y":265.99,"hdg":-1.341,"batt":100.0,"det":false},{"id":3,"x":359.54,"y":268.47,"hdg":-1.349,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":73,"t":73.00,"coverage":0.3237,"drones":[{"id":0,"x":60.11,"y":257.75,"hdg":-1.509,"batt":100.0,"det":false},{"id":1,"x":160.16,"y":257.55,"hdg":-1.509,"batt":100.0,"det":false},{"id":2,"x":259.24,"y":258.01,"hdg":-1.504,"batt":100.0,"det":false},{"id":3,"x":360.03,"y":260.48,"hdg":-1.510,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":74,"t":74.00,"coverage":0.3253,"drones":[{"id":0,"x":59.21,"y":249.80,"hdg":-1.684,"batt":100.0,"det":false},{"id":1,"x":159.26,"y":249.60,"hdg":-1.684,"batt":100.0,"det":false},{"id":2,"x":258.39,"y":250.06,"hdg":-1.678,"batt":100.0,"det":false},{"id":3,"x":359.15,"y":252.53,"hdg":-1.681,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":75,"t":75.00,"coverage":0.3256,"drones":[{"id":0,"x":56.92,"y":242.13,"hdg":-1.860,"batt":100.0,"det":false},{"id":1,"x":156.97,"y":241.94,"hdg":-1.861,"batt":100.0,"det":false},{"id":2,"x":256.15,"y":242.38,"hdg":-1.855,"batt":100.0,"det":false},{"id":3,"x":356.90,"y":244.85,"hdg":-1.855,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":76,"t":76.00,"coverage":0.3258,"drones":[{"id":0,"x":54.15,"y":234.63,"hdg":-1.925,"batt":100.0,"det":false},{"id":1,"x":154.19,"y":234.44,"hdg":-1.926,"batt":100.0,"det":false},{"id":2,"x":253.42,"y":234.85,"hdg":-1.918,"batt":100.0,"det":false},{"id":3,"x":354.19,"y":237.33,"hdg":-1.917,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":77,"t":77.00,"coverage":0.3269,"drones":[{"id":0,"x":53.26,"y":226.68,"hdg":-1.682,"batt":100.0,"det":false},{"id":1,"x":153.29,"y":226.49,"hdg":-1.683,"batt":100.0,"det":false},{"id":2,"x":252.59,"y":226.90,"hdg":-1.675,"batt":100.0,"det":false},{"id":3,"x":353.32,"y":229.38,"hdg":-1.680,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":78,"t":78.00,"coverage":0.3280,"drones":[{"id":0,"x":54.57,"y":218.79,"hdg":-1.406,"batt":100.0,"det":false},{"id":1,"x":154.61,"y":218.60,"hdg":-1.406,"batt":100.0,"det":false},{"id":2,"x":253.95,"y":219.02,"hdg":-1.400,"batt":100.0,"det":false},{"id":3,"x":354.59,"y":221.48,"hdg":-1.411,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":79,"t":79.00,"coverage":0.3292,"drones":[{"id":0,"x":57.96,"y":211.54,"hdg":-1.133,"batt":100.0,"det":false},{"id":1,"x":158.00,"y":211.35,"hdg":-1.133,"batt":100.0,"det":false},{"id":2,"x":257.37,"y":211.78,"hdg":-1.128,"batt":100.0,"det":false},{"id":3,"x":357.90,"y":214.20,"hdg":-1.144,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":80,"t":80.00,"coverage":0.3330,"drones":[{"id":0,"x":62.53,"y":204.97,"hdg":-0.963,"batt":100.0,"det":false},{"id":1,"x":162.58,"y":204.79,"hdg":-0.962,"batt":100.0,"det":false},{"id":2,"x":261.97,"y":205.24,"hdg":-0.958,"batt":100.0,"det":false},{"id":3,"x":362.34,"y":207.54,"hdg":-0.983,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":81,"t":81.00,"coverage":0.3355,"drones":[{"id":0,"x":63.69,"y":197.06,"hdg":-1.425,"batt":100.0,"det":false},{"id":1,"x":163.73,"y":196.87,"hdg":-1.426,"batt":100.0,"det":false},{"id":2,"x":263.21,"y":197.34,"hdg":-1.415,"batt":100.0,"det":false},{"id":3,"x":363.47,"y":199.62,"hdg":-1.429,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":82,"t":82.00,"coverage":0.3370,"drones":[{"id":0,"x":60.09,"y":189.91,"hdg":-2.037,"batt":100.0,"det":false},{"id":1,"x":160.12,"y":189.74,"hdg":-2.040,"batt":100.0,"det":false},{"id":2,"x":259.69,"y":190.15,"hdg":-2.026,"batt":100.0,"det":false},{"id":3,"x":360.06,"y":192.38,"hdg":-2.011,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":83,"t":83.00,"coverage":0.3372,"drones":[{"id":0,"x":53.78,"y":185.00,"hdg":-2.480,"batt":100.0,"det":false},{"id":1,"x":153.79,"y":184.84,"hdg":-2.482,"batt":100.0,"det":false},{"id":2,"x":253.42,"y":185.19,"hdg":-2.472,"batt":100.0,"det":false},{"id":3,"x":353.92,"y":187.26,"hdg":-2.447,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":84,"t":84.00,"coverage":0.3381,"drones":[{"id":0,"x":45.81,"y":184.40,"hdg":-3.066,"batt":100.0,"det":false},{"id":1,"x":145.81,"y":184.27,"hdg":-3.070,"batt":100.0,"det":false},{"id":2,"x":245.45,"y":184.54,"hdg":-3.061,"batt":100.0,"det":false},{"id":3,"x":345.99,"y":186.21,"hdg":-3.011,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":85,"t":85.00,"coverage":0.3391,"drones":[{"id":0,"x":42.00,"y":182.00,"hdg":-2.580,"batt":100.0,"det":false},{"id":1,"x":142.00,"y":182.00,"hdg":-2.605,"batt":100.0,"det":false},{"id":2,"x":242.00,"y":182.00,"hdg":-2.506,"batt":100.0,"det":false},{"id":3,"x":342.00,"y":182.00,"hdg":-2.328,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":86,"t":86.00,"coverage":0.3391,"drones":[{"id":0,"x":50.00,"y":182.00,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":150.00,"y":182.00,"hdg":0.000,"batt":100.0,"det":false},{"id":2,"x":250.00,"y":182.00,"hdg":0.000,"batt":100.0,"det":false},{"id":3,"x":350.00,"y":182.00,"hdg":0.000,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":87,"t":87.00,"coverage":0.3395,"drones":[{"id":0,"x":58.00,"y":182.00,"hdg":0.000,"batt":100.0,"det":false},{"id":1,"x":158.00,"y":182.00,"hdg":0.000,"batt":100.0,"det":false},{"id":2,"x":258.00,"y":182.00,"hdg":0.000,"batt":100.0,"det":false},{"id":3,"x":358.00,"y":182.00,"hdg":0.000,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":88,"t":88.00,"coverage":0.3416,"drones":[{"id":0,"x":64.55,"y":186.59,"hdg":0.611,"batt":100.0,"det":false},{"id":1,"x":164.55,"y":186.59,"hdg":0.611,"batt":100.0,"det":false},{"id":2,"x":264.55,"y":186.59,"hdg":0.611,"batt":100.0,"det":false},{"id":3,"x":364.55,"y":186.59,"hdg":0.611,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":89,"t":89.00,"coverage":0.3431,"drones":[{"id":0,"x":66.37,"y":194.38,"hdg":1.342,"batt":100.0,"det":false},{"id":1,"x":166.37,"y":194.38,"hdg":1.342,"batt":100.0,"det":false},{"id":2,"x":266.37,"y":194.38,"hdg":1.342,"batt":100.0,"det":false},{"id":3,"x":366.37,"y":194.38,"hdg":1.342,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":90,"t":90.00,"coverage":0.3431,"drones":[{"id":0,"x":59.63,"y":198.70,"hdg":2.572,"batt":100.0,"det":false},{"id":1,"x":159.63,"y":198.70,"hdg":2.572,"batt":100.0,"det":false},{"id":2,"x":259.63,"y":198.70,"hdg":2.572,"batt":100.0,"det":false},{"id":3,"x":359.63,"y":198.70,"hdg":2.572,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":91,"t":91.00,"coverage":0.3431,"drones":[{"id":0,"x":51.87,"y":200.62,"hdg":2.899,"batt":100.0,"det":false},{"id":1,"x":151.87,"y":200.62,"hdg":2.899,"batt":100.0,"det":false},{"id":2,"x":251.87,"y":200.62,"hdg":2.899,"batt":100.0,"det":false},{"id":3,"x":351.87,"y":200.62,"hdg":2.899,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":92,"t":92.00,"coverage":0.3441,"drones":[{"id":0,"x":46.17,"y":206.24,"hdg":2.363,"batt":100.0,"det":false},{"id":1,"x":146.17,"y":206.24,"hdg":2.363,"batt":100.0,"det":false},{"id":2,"x":246.17,"y":206.24,"hdg":2.363,"batt":100.0,"det":false},{"id":3,"x":346.17,"y":206.24,"hdg":2.363,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":93,"t":93.00,"coverage":0.3456,"drones":[{"id":0,"x":45.13,"y":214.17,"hdg":1.701,"batt":100.0,"det":false},{"id":1,"x":145.13,"y":214.17,"hdg":1.701,"batt":100.0,"det":false},{"id":2,"x":245.13,"y":214.17,"hdg":1.701,"batt":100.0,"det":false},{"id":3,"x":345.13,"y":214.17,"hdg":1.701,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":94,"t":94.00,"coverage":0.3456,"drones":[{"id":0,"x":50.91,"y":219.71,"hdg":0.764,"batt":100.0,"det":false},{"id":1,"x":150.91,"y":219.71,"hdg":0.764,"batt":100.0,"det":false},{"id":2,"x":250.91,"y":219.71,"hdg":0.764,"batt":100.0,"det":false},{"id":3,"x":350.91,"y":219.71,"hdg":0.764,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":95,"t":95.00,"coverage":0.3459,"drones":[{"id":0,"x":58.36,"y":222.60,"hdg":0.371,"batt":100.0,"det":false},{"id":1,"x":158.36,"y":222.60,"hdg":0.371,"batt":100.0,"det":false},{"id":2,"x":258.36,"y":222.60,"hdg":0.371,"batt":100.0,"det":false},{"id":3,"x":358.36,"y":222.60,"hdg":0.371,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":96,"t":96.00,"coverage":0.3477,"drones":[{"id":0,"x":63.76,"y":228.51,"hdg":0.831,"batt":100.0,"det":false},{"id":1,"x":163.76,"y":228.51,"hdg":0.831,"batt":100.0,"det":false},{"id":2,"x":263.76,"y":228.51,"hdg":0.831,"batt":100.0,"det":false},{"id":3,"x":363.76,"y":228.51,"hdg":0.831,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":97,"t":97.00,"coverage":0.3505,"drones":[{"id":0,"x":65.07,"y":236.40,"hdg":1.406,"batt":100.0,"det":false},{"id":1,"x":165.07,"y":236.40,"hdg":1.406,"batt":100.0,"det":false},{"id":2,"x":265.07,"y":236.40,"hdg":1.406,"batt":100.0,"det":false},{"id":3,"x":365.07,"y":236.40,"hdg":1.406,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":98,"t":98.00,"coverage":0.3505,"drones":[{"id":0,"x":60.15,"y":242.71,"hdg":2.233,"batt":100.0,"det":false},{"id":1,"x":160.15,"y":242.71,"hdg":2.233,"batt":100.0,"det":false},{"id":2,"x":260.15,"y":242.71,"hdg":2.233,"batt":100.0,"det":false},{"id":3,"x":360.15,"y":242.71,"hdg":2.233,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":99,"t":99.00,"coverage":0.3505,"drones":[{"id":0,"x":53.01,"y":246.32,"hdg":2.674,"batt":100.0,"det":false},{"id":1,"x":153.01,"y":246.32,"hdg":2.674,"batt":100.0,"det":false},{"id":2,"x":253.01,"y":246.32,"hdg":2.674,"batt":100.0,"det":false},{"id":3,"x":353.01,"y":246.32,"hdg":2.674,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":100,"t":100.00,"coverage":0.3508,"drones":[{"id":0,"x":47.95,"y":252.51,"hdg":2.256,"batt":100.0,"det":false},{"id":1,"x":147.95,"y":252.51,"hdg":2.256,"batt":100.0,"det":false},{"id":2,"x":247.95,"y":252.51,"hdg":2.256,"batt":100.0,"det":false},{"id":3,"x":347.95,"y":252.51,"hdg":2.256,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":101,"t":101.00,"coverage":0.3522,"drones":[{"id":0,"x":46.81,"y":260.43,"hdg":1.713,"batt":100.0,"det":false},{"id":1,"x":146.81,"y":260.43,"hdg":1.713,"batt":100.0,"det":false},{"id":2,"x":246.81,"y":260.43,"hdg":1.713,"batt":100.0,"det":false},{"id":3,"x":346.81,"y":260.43,"hdg":1.713,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":102,"t":102.00,"coverage":0.3527,"drones":[{"id":0,"x":51.36,"y":267.01,"hdg":0.966,"batt":100.0,"det":false},{"id":1,"x":151.36,"y":267.01,"hdg":0.966,"batt":100.0,"det":false},{"id":2,"x":251.36,"y":267.01,"hdg":0.966,"batt":100.0,"det":false},{"id":3,"x":351.36,"y":267.01,"hdg":0.966,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":103,"t":103.00,"coverage":0.3527,"drones":[{"id":0,"x":58.28,"y":271.02,"hdg":0.525,"batt":100.0,"det":false},{"id":1,"x":158.28,"y":271.02,"hdg":0.525,"batt":100.0,"det":false},{"id":2,"x":258.28,"y":271.02,"hdg":0.525,"batt":100.0,"det":false},{"id":3,"x":358.28,"y":271.02,"hdg":0.525,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":104,"t":104.00,"coverage":0.3533,"drones":[{"id":0,"x":63.20,"y":277.33,"hdg":0.909,"batt":100.0,"det":false},{"id":1,"x":163.20,"y":277.33,"hdg":0.909,"batt":100.0,"det":false},{"id":2,"x":263.20,"y":277.33,"hdg":0.909,"batt":100.0,"det":false},{"id":3,"x":363.20,"y":277.33,"hdg":0.909,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":105,"t":105.00,"coverage":0.3552,"drones":[{"id":0,"x":64.40,"y":285.24,"hdg":1.420,"batt":100.0,"det":false},{"id":1,"x":164.40,"y":285.24,"hdg":1.420,"batt":100.0,"det":false},{"id":2,"x":264.40,"y":285.24,"hdg":1.420,"batt":100.0,"det":false},{"id":3,"x":364.40,"y":285.24,"hdg":1.420,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":106,"t":106.00,"coverage":0.3558,"drones":[{"id":0,"x":60.24,"y":292.07,"hdg":2.118,"batt":100.0,"det":false},{"id":1,"x":160.24,"y":292.07,"hdg":2.118,"batt":100.0,"det":false},{"id":2,"x":260.24,"y":292.07,"hdg":2.118,"batt":100.0,"det":false},{"id":3,"x":360.24,"y":292.07,"hdg":2.118,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":107,"t":107.00,"coverage":0.3558,"drones":[{"id":0,"x":53.52,"y":296.41,"hdg":2.567,"batt":100.0,"det":false},{"id":1,"x":153.52,"y":296.41,"hdg":2.567,"batt":100.0,"det":false},{"id":2,"x":253.52,"y":296.41,"hdg":2.567,"batt":100.0,"det":false},{"id":3,"x":353.52,"y":296.41,"hdg":2.567,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":108,"t":108.00,"coverage":0.3558,"drones":[{"id":0,"x":48.78,"y":302.85,"hdg":2.206,"batt":100.0,"det":false},{"id":1,"x":148.78,"y":302.85,"hdg":2.206,"batt":100.0,"det":false},{"id":2,"x":248.78,"y":302.85,"hdg":2.206,"batt":100.0,"det":false},{"id":3,"x":348.78,"y":302.85,"hdg":2.206,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":109,"t":109.00,"coverage":0.3569,"drones":[{"id":0,"x":47.64,"y":310.77,"hdg":1.714,"batt":100.0,"det":false},{"id":1,"x":147.64,"y":310.77,"hdg":1.714,"batt":100.0,"det":false},{"id":2,"x":247.64,"y":310.77,"hdg":1.714,"batt":100.0,"det":false},{"id":3,"x":347.64,"y":310.77,"hdg":1.714,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":110,"t":110.00,"coverage":0.3575,"drones":[{"id":0,"x":51.60,"y":317.72,"hdg":1.053,"batt":100.0,"det":false},{"id":1,"x":151.60,"y":317.72,"hdg":1.053,"batt":100.0,"det":false},{"id":2,"x":251.60,"y":317.72,"hdg":1.053,"batt":100.0,"det":false},{"id":3,"x":351.60,"y":317.72,"hdg":1.053,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":111,"t":111.00,"coverage":0.3575,"drones":[{"id":0,"x":58.17,"y":322.29,"hdg":0.608,"batt":100.0,"det":false},{"id":1,"x":158.17,"y":322.29,"hdg":0.608,"batt":100.0,"det":false},{"id":2,"x":258.17,"y":322.29,"hdg":0.608,"batt":100.0,"det":false},{"id":3,"x":358.17,"y":322.29,"hdg":0.608,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":112,"t":112.00,"coverage":0.3577,"drones":[{"id":0,"x":62.82,"y":328.80,"hdg":0.950,"batt":100.0,"det":false},{"id":1,"x":162.82,"y":328.80,"hdg":0.950,"batt":100.0,"det":false},{"id":2,"x":262.82,"y":328.80,"hdg":0.950,"batt":100.0,"det":false},{"id":3,"x":362.82,"y":328.80,"hdg":0.950,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":113,"t":113.00,"coverage":0.3591,"drones":[{"id":0,"x":63.97,"y":336.71,"hdg":1.426,"batt":100.0,"det":false},{"id":1,"x":163.97,"y":336.71,"hdg":1.426,"batt":100.0,"det":false},{"id":2,"x":263.97,"y":336.71,"hdg":1.426,"batt":100.0,"det":false},{"id":3,"x":363.97,"y":336.71,"hdg":1.426,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":114,"t":114.00,"coverage":0.3591,"drones":[{"id":0,"x":60.22,"y":343.78,"hdg":2.060,"batt":100.0,"det":false},{"id":1,"x":160.22,"y":343.78,"hdg":2.060,"batt":100.0,"det":false},{"id":2,"x":260.22,"y":343.78,"hdg":2.060,"batt":100.0,"det":false},{"id":3,"x":360.22,"y":343.78,"hdg":2.060,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":115,"t":115.00,"coverage":0.3591,"drones":[{"id":0,"x":53.79,"y":348.54,"hdg":2.504,"batt":100.0,"det":false},{"id":1,"x":153.79,"y":348.54,"hdg":2.504,"batt":100.0,"det":false},{"id":2,"x":253.79,"y":348.54,"hdg":2.504,"batt":100.0,"det":false},{"id":3,"x":353.79,"y":348.54,"hdg":2.504,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":116,"t":116.00,"coverage":0.3591,"drones":[{"id":0,"x":48.89,"y":354.87,"hdg":2.229,"batt":100.0,"det":false},{"id":1,"x":148.89,"y":354.87,"hdg":2.229,"batt":100.0,"det":false},{"id":2,"x":248.89,"y":354.87,"hdg":2.229,"batt":100.0,"det":false},{"id":3,"x":348.89,"y":354.87,"hdg":2.229,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":117,"t":117.00,"coverage":0.3594,"drones":[{"id":0,"x":47.69,"y":362.77,"hdg":1.722,"batt":100.0,"det":false},{"id":1,"x":147.69,"y":362.77,"hdg":1.722,"batt":100.0,"det":false},{"id":2,"x":247.69,"y":362.77,"hdg":1.722,"batt":100.0,"det":false},{"id":3,"x":347.69,"y":362.77,"hdg":1.722,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":118,"t":118.00,"coverage":0.3609,"drones":[{"id":0,"x":51.80,"y":369.64,"hdg":1.031,"batt":100.0,"det":false},{"id":1,"x":151.80,"y":369.64,"hdg":1.031,"batt":100.0,"det":false},{"id":2,"x":251.80,"y":369.64,"hdg":1.031,"batt":100.0,"det":false},{"id":3,"x":351.80,"y":369.64,"hdg":1.031,"batt":100.0,"det":false}]} -{"type":"step","ep":29,"step":119,"t":119.00,"coverage":0.3627,"drones":[{"id":0,"x":58.48,"y":374.03,"hdg":0.581,"batt":100.0,"det":false},{"id":1,"x":158.48,"y":374.03,"hdg":0.581,"batt":100.0,"det":false},{"id":2,"x":258.48,"y":374.03,"hdg":0.581,"batt":100.0,"det":false},{"id":3,"x":358.48,"y":374.03,"hdg":0.581,"batt":100.0,"det":false}]} -{"type":"episode","ep":29,"mean_return":741.0585,"policy_loss":-107902.2578,"value_loss":731556.4375,"victims_found":0} diff --git a/v2/crates/ruview-swarm/viz/swarm_viz.html b/v2/crates/ruview-swarm/viz/swarm_viz.html deleted file mode 100644 index c4503467..00000000 --- a/v2/crates/ruview-swarm/viz/swarm_viz.html +++ /dev/null @@ -1,725 +0,0 @@ - - - - - - -ruview-swarm — training visualizer (ADR-148) - - - -
-

ruview-swarm — training visualizer (ADR-148)

-
no telemetry loaded — drop a .jsonl file or use the picker below
-
- -
- - - -
- -
-
-

spatial swarm replay

- -
- - - -
-
-
- -
-

training metrics

- -
-
-
- - - -