mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-15 17:12:59 -04:00
be webel
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -11,8 +11,8 @@
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="apple-mobile-web-app-title" content="Multi Roomba Rover" />
|
||||
<title>Multi Roomba Rover</title>
|
||||
<script type="module" crossorigin src="/assets/index-BQtp08e2.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-CGvUXLso.css">
|
||||
<script type="module" crossorigin src="/assets/index-FrukTaHm.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-DYarsG-0.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -275,6 +275,13 @@ function broadcastLidarScan(payload) {
|
||||
}
|
||||
}
|
||||
|
||||
function broadcastLidarLine(payload) {
|
||||
for (const socket of io.sockets.sockets.values()) {
|
||||
if (!isVerified(socket)) continue;
|
||||
socket.volatile.emit('neato:lidarLine', payload);
|
||||
}
|
||||
}
|
||||
|
||||
lidarRuntime =
|
||||
brainslugHost && brainslugKey
|
||||
? createLidarRuntime({
|
||||
@@ -292,6 +299,9 @@ if (lidarRuntime) {
|
||||
lidarRuntime.on('scan', (payload) => {
|
||||
broadcastLidarScan(payload);
|
||||
});
|
||||
lidarRuntime.on('line', (payload) => {
|
||||
broadcastLidarLine(payload);
|
||||
});
|
||||
lidarRuntime.on('status', () => {
|
||||
emitUpdate();
|
||||
});
|
||||
|
||||
@@ -212,6 +212,10 @@ function createLidarRuntime({ logger, host, port = 6053, key, logFile = '', shou
|
||||
const lines = state[bufferKey].split(/\r?\n/);
|
||||
state[bufferKey] = lines.pop() || '';
|
||||
for (const line of lines) {
|
||||
events.emit('line', {
|
||||
source: sourceLabel || 'unknown',
|
||||
line: sanitizeLogText(line),
|
||||
});
|
||||
const payload = parsePayloadFromLine(line);
|
||||
handlePayload(payload);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ export default function VipPanel() {
|
||||
const {
|
||||
session,
|
||||
neatoLidar,
|
||||
neatoLidarLines,
|
||||
identifySession,
|
||||
requestVerification,
|
||||
requestPrivateRoverAccess,
|
||||
@@ -80,6 +81,7 @@ export default function VipPanel() {
|
||||
<VipNeatoCard
|
||||
neato={session?.neato || null}
|
||||
lidar={neatoLidar}
|
||||
lidarLines={neatoLidarLines}
|
||||
onStart={neatoStart}
|
||||
onSendHome={neatoSendHome}
|
||||
onLocate={neatoLocate}
|
||||
|
||||
@@ -58,6 +58,7 @@ function buildLidarDots(points = []) {
|
||||
export default function VipNeatoCard({
|
||||
neato,
|
||||
lidar,
|
||||
lidarLines,
|
||||
onStart,
|
||||
onSendHome,
|
||||
onLocate,
|
||||
@@ -84,6 +85,7 @@ export default function VipNeatoCard({
|
||||
const robotError = normalizeState(neato?.telemetry?.robotError) || '--';
|
||||
const robotAlert = normalizeState(neato?.telemetry?.robotAlert) || '--';
|
||||
const lidarPoints = Array.isArray(lidar?.points) ? lidar.points : [];
|
||||
const recentLidarLines = Array.isArray(lidarLines) ? lidarLines : [];
|
||||
const lidarDots = buildLidarDots(lidarPoints);
|
||||
const lidarStatus = normalizeState(lidar?.status) || '--';
|
||||
const lidarDebug = lidar?.debug && typeof lidar.debug === 'object' ? lidar.debug : null;
|
||||
@@ -288,6 +290,18 @@ export default function VipNeatoCard({
|
||||
<div>Rotation no scan: {lidarStats?.rotationsWithoutScan ?? '--'}</div>
|
||||
<div>Parseable payloads: {lidarStats?.parseablePayloads ?? '--'}</div>
|
||||
<div>Point payloads: {lidarStats?.pointPayloads ?? '--'}</div>
|
||||
<div className="mt-0.5 border-t border-slate-700 pt-0.5 text-slate-400">Raw ESP lines</div>
|
||||
<div className="mt-0.25 max-h-40 overflow-y-auto rounded bg-black/30 px-0.5 py-0.5 text-[0.62rem] leading-tight text-slate-300">
|
||||
{recentLidarLines.length ? (
|
||||
recentLidarLines.map((entry, index) => (
|
||||
<div key={`${index}-${entry.source || 'line'}`} className="break-all">
|
||||
<span className="text-slate-500">[{entry.source || 'line'}]</span> {entry.line}
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div className="text-slate-500">No raw lines yet</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
@@ -9,6 +9,7 @@ const INITIAL_STATE = {
|
||||
connected: false,
|
||||
session: null,
|
||||
neatoLidar: null,
|
||||
neatoLidarLines: [],
|
||||
logs: [],
|
||||
adminLogs: [],
|
||||
llmCommentaryState: null,
|
||||
@@ -132,9 +133,18 @@ export function SessionProvider({ children }) {
|
||||
const next = payload && typeof payload === 'object' ? payload : null;
|
||||
setState((prev) => ({ ...prev, neatoLidar: next }));
|
||||
}
|
||||
function handleNeatoLidarLine(payload = null) {
|
||||
const next = payload && typeof payload === 'object' ? payload : null;
|
||||
if (!next?.line) return;
|
||||
setState((prev) => ({
|
||||
...prev,
|
||||
neatoLidarLines: [...prev.neatoLidarLines.slice(-199), next],
|
||||
}));
|
||||
}
|
||||
|
||||
socket.on('session:sync', handleSession);
|
||||
socket.on('neato:lidar', handleNeatoLidar);
|
||||
socket.on('neato:lidarLine', handleNeatoLidarLine);
|
||||
socket.on('log:init', handleLogInit);
|
||||
socket.on('log:entry', handleLogEntry);
|
||||
socket.on('adminlog:init', handleAdminLogInit);
|
||||
@@ -144,6 +154,7 @@ export function SessionProvider({ children }) {
|
||||
return () => {
|
||||
socket.off('session:sync', handleSession);
|
||||
socket.off('neato:lidar', handleNeatoLidar);
|
||||
socket.off('neato:lidarLine', handleNeatoLidarLine);
|
||||
socket.off('log:init', handleLogInit);
|
||||
socket.off('log:entry', handleLogEntry);
|
||||
socket.off('adminlog:init', handleAdminLogInit);
|
||||
|
||||
Reference in New Issue
Block a user