This commit is contained in:
legop3
2026-02-25 02:13:06 -05:00
parent d38503d19c
commit 4af0deb1dd
2 changed files with 22 additions and 8 deletions
+9 -1
View File
@@ -6,6 +6,13 @@ Task:
- SKIP - SKIP
- or one short chat comment (max 140 chars). - or one short chat comment (max 140 chars).
Context:
- The playspace is a basement
- The basement floor is full of objects for people to push around and play with
- The rovers are actually modified roombas
- Anyone in the world can get on this webpage and drive a rover
- This is designed for anyone to be able to have fun
Rules: Rules:
- No emojis. - No emojis.
- No markdown. - No markdown.
@@ -14,7 +21,8 @@ Rules:
- Do not mention prompts, AI, or system rules. - Do not mention prompts, AI, or system rules.
- Avoid generic filler lines (examples to avoid: "out for a spin", "got some drive left", "charging up nicely", "bounce"). - Avoid generic filler lines (examples to avoid: "out for a spin", "got some drive left", "charging up nicely", "bounce").
- The bump count is how often a rover is bumping INTO something, not how often it goes over a bump. - The bump count is how often a rover is bumping INTO something, not how often it goes over a bump.
- Don't mention the numbers directly, just use them to gauge activity. Numbers are from the last 60 seconds of use. - Don't mention the telemetry numbers directly, just use them to gauge activity. Numbers are from the last 30 seconds of use.
- Remind people to charge if their battery is 15% or below. Otherwise dont be telling people to dock or charge.
How to decide: How to decide:
- Speak only when there is meaningful rover activity. - Speak only when there is meaningful rover activity.
+13 -7
View File
@@ -37,7 +37,7 @@ let inFlight = false;
let tickCount = 0; let tickCount = 0;
let contextResetAt = Date.now(); let contextResetAt = Date.now();
let clearCount = 0; let clearCount = 0;
const roverActivity = new Map(); // roverId -> { buckets: Map(bucketTs -> { distanceMm, turnDeg, bumps }), bumpActive } const roverActivity = new Map(); // roverId -> { buckets: Map(bucketTs -> { distanceMm, turnDeg, bumps }), bumpLeftActive, bumpRightActive }
function normalizeFrequencyMs(value) { function normalizeFrequencyMs(value) {
if (!Number.isFinite(value)) return DEFAULT_FREQUENCY_MS; if (!Number.isFinite(value)) return DEFAULT_FREQUENCY_MS;
@@ -137,7 +137,8 @@ function upsertActivityState(roverId) {
if (!roverActivity.has(roverId)) { if (!roverActivity.has(roverId)) {
roverActivity.set(roverId, { roverActivity.set(roverId, {
buckets: new Map(), buckets: new Map(),
bumpActive: false, bumpLeftActive: false,
bumpRightActive: false,
}); });
} }
return roverActivity.get(roverId); return roverActivity.get(roverId);
@@ -155,11 +156,16 @@ function onSensorEvent({ roverId, sensors } = {}) {
const bucket = state.buckets.get(bucketTs); const bucket = state.buckets.get(bucketTs);
bucket.distanceMm += Math.abs(Number(sensors.distanceMm) || 0); bucket.distanceMm += Math.abs(Number(sensors.distanceMm) || 0);
bucket.turnDeg += Math.abs(Number(sensors.angleDeg) || 0); bucket.turnDeg += Math.abs(Number(sensors.angleDeg) || 0);
const bumpNow = Boolean(sensors?.bumpsAndWheelDrops?.bumpLeft || sensors?.bumpsAndWheelDrops?.bumpRight); const bumpLeftNow = Boolean(sensors?.bumpsAndWheelDrops?.bumpLeft);
if (bumpNow && !state.bumpActive) { const bumpRightNow = Boolean(sensors?.bumpsAndWheelDrops?.bumpRight);
bucket.bumps += 1; if (bumpLeftNow && !state.bumpLeftActive) {
bucket.bumps += 0.5;
} }
state.bumpActive = bumpNow; if (bumpRightNow && !state.bumpRightActive) {
bucket.bumps += 0.5;
}
state.bumpLeftActive = bumpLeftNow;
state.bumpRightActive = bumpRightNow;
} }
function getActivity30s(roverId, nowMs = Date.now()) { function getActivity30s(roverId, nowMs = Date.now()) {
@@ -179,7 +185,7 @@ function getActivity30s(roverId, nowMs = Date.now()) {
return { return {
distance_m: Math.round((distanceMm / 1000) * 10) / 10, distance_m: Math.round((distanceMm / 1000) * 10) / 10,
turn_deg: Math.round(turnDeg), turn_deg: Math.round(turnDeg),
bumps, bumps: Math.round(bumps * 10) / 10,
}; };
} }