mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 17:40:46 -04:00
prompt
This commit is contained in:
@@ -6,6 +6,13 @@ Task:
|
||||
- SKIP
|
||||
- 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:
|
||||
- No emojis.
|
||||
- No markdown.
|
||||
@@ -14,7 +21,8 @@ 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").
|
||||
- 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:
|
||||
- Speak only when there is meaningful rover activity.
|
||||
|
||||
@@ -37,7 +37,7 @@ let inFlight = false;
|
||||
let tickCount = 0;
|
||||
let contextResetAt = Date.now();
|
||||
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) {
|
||||
if (!Number.isFinite(value)) return DEFAULT_FREQUENCY_MS;
|
||||
@@ -137,7 +137,8 @@ function upsertActivityState(roverId) {
|
||||
if (!roverActivity.has(roverId)) {
|
||||
roverActivity.set(roverId, {
|
||||
buckets: new Map(),
|
||||
bumpActive: false,
|
||||
bumpLeftActive: false,
|
||||
bumpRightActive: false,
|
||||
});
|
||||
}
|
||||
return roverActivity.get(roverId);
|
||||
@@ -155,11 +156,16 @@ function onSensorEvent({ roverId, sensors } = {}) {
|
||||
const bucket = state.buckets.get(bucketTs);
|
||||
bucket.distanceMm += Math.abs(Number(sensors.distanceMm) || 0);
|
||||
bucket.turnDeg += Math.abs(Number(sensors.angleDeg) || 0);
|
||||
const bumpNow = Boolean(sensors?.bumpsAndWheelDrops?.bumpLeft || sensors?.bumpsAndWheelDrops?.bumpRight);
|
||||
if (bumpNow && !state.bumpActive) {
|
||||
bucket.bumps += 1;
|
||||
const bumpLeftNow = Boolean(sensors?.bumpsAndWheelDrops?.bumpLeft);
|
||||
const bumpRightNow = Boolean(sensors?.bumpsAndWheelDrops?.bumpRight);
|
||||
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()) {
|
||||
@@ -179,7 +185,7 @@ function getActivity30s(roverId, nowMs = Date.now()) {
|
||||
return {
|
||||
distance_m: Math.round((distanceMm / 1000) * 10) / 10,
|
||||
turn_deg: Math.round(turnDeg),
|
||||
bumps,
|
||||
bumps: Math.round(bumps * 10) / 10,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user