Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def newest_remote_log(user: str, host: str, directory: str) -> str:
def main() -> None:
"""Main."""
parser = argparse.ArgumentParser()
parser.add_argument("--host", default="10.80.44.2", help="Robot IP")
parser.add_argument("--host", default="10.38.47.2", help="Robot IP")
parser.add_argument("--user", default="admin", help="Robot SSH user")
parser.add_argument("--remote-dir", default="/U", help="Robot log directory")
parser.add_argument("--out", default="RobotLogs", help="Local output directory")
Expand Down
18 changes: 9 additions & 9 deletions .agents/skills/advantagekit/references/common-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ Replay works by re-running identical code with identical logged inputs. Any data

### Problem Sources

| Source | Problem | Fix |
| ------ | ------- | --- |
| `Timer.getFPGATimestamp()` | Raw FPGA time — not deterministic | Use `Timer.getTimestamp()` |
| NetworkTables / dashboard inputs | Values change outside the logging cycle | Log as inputs through IO layer |
| YAGSL, Phoenix 6 swerve libraries | Bypass IO abstraction, call hardware directly | Use AKit's swerve template instead |
| `Math.random()` / random number generators | Non-deterministic by nature | Log seed or generated values as inputs |
| Iterating over `HashMap` / unordered collections | Iteration order varies across JVM runs | Use `LinkedHashMap` or sorted collections |
| Filesystem reads | File contents may change | Log file data as inputs |
| Driver Station data accessed before `Logger.start()` | Not yet deterministic | Defer all DS access until after `Logger.start()` |
| Source | Problem | Fix |
|------------------------------------------------------|-----------------------------------------------|--------------------------------------------------|
| `Timer.getFPGATimestamp()` | Raw FPGA time — not deterministic | Use `Timer.getTimestamp()` |
| NetworkTables / dashboard inputs | Values change outside the logging cycle | Log as inputs through IO layer |
| YAGSL, Phoenix 6 swerve libraries | Bypass IO abstraction, call hardware directly | Use AKit's swerve template instead |
| `Math.random()` / random number generators | Non-deterministic by nature | Log seed or generated values as inputs |
| Iterating over `HashMap` / unordered collections | Iteration order varies across JVM runs | Use `LinkedHashMap` or sorted collections |
| Filesystem reads | File contents may change | Log file data as inputs |
| Driver Station data accessed before `Logger.start()` | Not yet deterministic | Defer all DS access until after `Logger.start()` |

---

Expand Down
20 changes: 10 additions & 10 deletions .agents/skills/advantagekit/references/output-logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ This guarantees the same logic that ran on the robot is used for replay, so odom

All types support single values, 1D arrays, and 2D arrays unless noted.

| Category | Types | Notes |
| ---------- | ------- | ------- |
| Primitives | `boolean`, `int`, `long`, `float`, `double`, `String` | — |
| WPILib structs | `Translation2d/3d`, `Pose2d/3d`, `Rotation2d/3d`, `SwerveModuleState`, etc. | Preferred over protobuf — no delay |
| Protobuf | Any WPILib protobuf type | **⚠️ First log can take >100ms** — log once while disabled |
| Records | Custom `record` classes (fields: primitives, enums, structs, nested records) | **⚠️ Same first-log delay as protobuf** — log while disabled; no array fields |
| Enums | Any enum | Logged as `name()` string |
| Colors | WPILib `Color` | Logged as hex triplet string |
| Mechanisms | `LoggedMechanism2d` | Output only |
| Suppliers | `BooleanSupplier`, `IntSupplier`, `LongSupplier`, `DoubleSupplier` | Output only |
| Category | Types | Notes |
|----------------|------------------------------------------------------------------------------|-------------------------------------------------------------------------------|
| Primitives | `boolean`, `int`, `long`, `float`, `double`, `String` | — |
| WPILib structs | `Translation2d/3d`, `Pose2d/3d`, `Rotation2d/3d`, `SwerveModuleState`, etc. | Preferred over protobuf — no delay |
| Protobuf | Any WPILib protobuf type | **⚠️ First log can take >100ms** — log once while disabled |
| Records | Custom `record` classes (fields: primitives, enums, structs, nested records) | **⚠️ Same first-log delay as protobuf** — log while disabled; no array fields |
| Enums | Any enum | Logged as `name()` string |
| Colors | WPILib `Color` | Logged as hex triplet string |
| Mechanisms | `LoggedMechanism2d` | Output only |
| Suppliers | `BooleanSupplier`, `IntSupplier`, `LongSupplier`, `DoubleSupplier` | Output only |

**Protobuf / Record first-use pattern** — call once during `disabledInit()` to absorb the delay:

Expand Down
14 changes: 8 additions & 6 deletions .agents/skills/advantagekit/references/recording-inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ All [supported types](https://docs.advantagekit.org/data-flow/supported-types) a
Two approaches — pick one consistently:

**Naming convention** (simpler):

```java
public double velocityRadPerSec = 0.0;
public double positionMeters = 0.0;
```

**Measure objects** (type-safe):

```java
public Distance position = Meters.of(0.0);
public LinearVelocity velocity = MetersPerSecond.of(0.0);
Expand Down Expand Up @@ -88,12 +90,12 @@ Direct NetworkTables access (`SmartDashboard.getNumber()`, `SmartDashboard.getSt

### Logged Replacements

| Instead of | Use |
|-----------|-----|
| `SendableChooser<T>` | `LoggedDashboardChooser<T>` |
| `SmartDashboard.getNumber()` | `LoggedNetworkNumber` |
| `SmartDashboard.getString()` | `LoggedNetworkString` |
| `SmartDashboard.getBoolean()` | `LoggedNetworkBoolean` |
| Instead of | Use |
|-------------------------------|-----------------------------|
| `SendableChooser<T>` | `LoggedDashboardChooser<T>` |
| `SmartDashboard.getNumber()` | `LoggedNetworkNumber` |
| `SmartDashboard.getString()` | `LoggedNetworkString` |
| `SmartDashboard.getBoolean()` | `LoggedNetworkBoolean` |

### Auto Chooser Example

Expand Down
51 changes: 27 additions & 24 deletions .agents/skills/advantagescope/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
---

name: advantagescope
description: "Use for AdvantageScope visualization automation: building/running the Team 8044 AdvantageScope fork, opening WPILOGs with layouts, using opt-in agent control/export hooks, capturing 2D/3D field screenshots or frame sequences, and falling back to vanilla AdvantageScope/manual inspection when hooks are unavailable."
description: "Use for AdvantageScope visualization automation: building/running our AdvantageScope fork (Spectrum 3847) or vanilla AdvantageScope, opening WPILOGs/DataLogs with layouts, using opt-in agent control/export hooks, capturing 2D/3D field screenshots or frame sequences, and falling back to vanilla AdvantageScope/manual inspection when hooks are unavailable."
metadata:
short-description: Automate AdvantageScope visualization
---
short-description: Automate AdvantageScope visualization
--------------------------------------------------------

# AdvantageScope

## Core Rules

- This skill is the robot-repo consumer workflow for AdvantageScope visualization. It should help agents discover robot logs/assets, generate layouts, locate the Team 8044 fork, and export previews.
- Keep fork maintenance details in the Team 8044 AdvantageScope repo's `$advantagescope-fork` skill. Use that skill when modifying, rebasing, packaging, or debugging fork internals.
- This skill is the robot-repo consumer workflow for AdvantageScope visualization. It should help agents discover robot logs/assets, generate layouts, locate our AdvantageScope fork or vanilla AdvantageScope, and export previews.
- Keep fork maintenance details in the AdvantageScope repo's `$advantagescope-fork` skill (we maintain our own fork). Use that skill when modifying, rebasing, packaging, or debugging fork internals.
- Do not hard-code season-specific field ids, robot model names, autos, or layouts. Discover custom assets from `AScope_Assets` and use explicit task arguments.
- Do not automate by screen clicks or fixed coordinates. Use local agent control/export hooks when available.
- If only vanilla AdvantageScope is available, open the log/layout manually and use WPILOG parsing for objective results.
- When a new repeatable AdvantageScope workflow is discovered, treat updating this skill as part of the work. Add the durable instructions and, when the workflow is more than a couple commands, add or improve a generic helper script so future agents can use the app immediately without rediscovering the path.

## Build And Runtime

- Use the Team 8044 fork for agent exports:
```sh
https://github.com/Team8044/AdvantageScope
```
- When changing the fork itself, switch to the fork checkout and use its repo-local `$advantagescope-fork` skill.
- Prefer an explicit `--fork <checkout>` argument or `ADVANTAGESCOPE_FORK=<checkout>` when a checkout is already known.
- If no checkout is known, discover local git repos whose remotes include `Team8044/AdvantageScope`; common search roots include the current repo's parents and `~/Documents/GitHub`.
- If the fork is not available locally, ask the user before cloning/building it because that requires network, disk, and dependency changes.
- Prefer our AdvantageScope fork for agent exports. If the fork is not checked out locally, ask the user before cloning/building it because that requires network, disk, and dependency changes; otherwise fall back to vanilla AdvantageScope plus WPILOG summaries.
- `export_preview.py` can also use `ADVANTAGESCOPE_EXECUTABLE` or `--advantagescope <executable>` when a packaged/built fork executable is already available.
- Do not copy robot assets into the fork. Custom robot assets should stay in this robot repo's `AScope_Assets` folder and be loaded through AdvantageScope's user assets feature.

## Agent Hooks

- Before exporting an auto preview, get the WPILOG from `$wpilib-sim`'s permanent workflow:

```sh
python3 .agents/skills/wpilib-sim/scripts/run_auto_sim.py \
--repo . \
Expand All @@ -40,7 +35,9 @@ metadata:
--duration <auto-duration> \
--buffer 1
```

Then compute the auto window from logged DriverStation state:

```sh
python3 .agents/skills/wpilib-sim/scripts/find_wpilog_window.py \
--repo . \
Expand All @@ -50,6 +47,7 @@ metadata:
--duration <auto-duration>
```
- Preferred export command from a built fork:

```sh
./node_modules/.bin/electron bundles/main.js \
--agent-export \
Expand All @@ -64,9 +62,10 @@ metadata:
--agent-headless
```
- For auto previews, use a real-time export window anchored to the logged auto start instead of the start of the file. Prefer the first timestamp where `/DriverStation/Autonomous` and `/DriverStation/Enabled` are both true, then export `--start <auto-start> --end <auto-start + auto-duration> --fps 30`.
- Realtime export records the active 2D/3D field canvas while AdvantageScope playback runs at 1x. A current Team 8044 fork waits for selected-renderer readiness before recording, so 3D field assets should be loaded in frame 0 without a fixed delay. A preview should take roughly the requested video duration plus small startup/transcode overhead.
- Realtime export records the active 2D/3D field canvas while AdvantageScope playback runs at 1x. A current fork waits for selected-renderer readiness before recording, so 3D field assets should be loaded in frame 0 without a fixed delay. A preview should take roughly the requested video duration plus small startup/transcode overhead.
- For agent exports, prefer `--agent-headless` instead of Chromium `--headless`. It keeps AdvantageScope windows hidden while preserving the normal renderer/WebGL lifecycle needed for 3D recording.
- The skill includes helper scripts:

```sh
python3 .agents/skills/advantagescope/scripts/discover_ascope_assets.py \
--repo .
Expand All @@ -93,10 +92,11 @@ metadata:
--fps 30
```
- Agent realtime export should produce `preview.webm` directly from the renderer. It should also produce `preview.mp4` when bundled FFmpeg conversion succeeds.
- Use `--agent-export-mode multiview` for synced hub + satellite realtime videos. The Team 8044 fork records the selected hub canvas and the first satellite canvas at the same time, then composes a side-by-side `preview.mp4` with bundled FFmpeg.
- Use `--agent-export-mode multiview` for synced hub + satellite realtime videos. The fork records the selected hub canvas and the first satellite canvas at the same time, then composes a side-by-side `preview.mp4` with bundled FFmpeg.
- Use `--agent-export-mode frames` only for debugging deterministic frame stepping; normal auto previews must not use the frame-by-frame path.
- Use `--agent-allow-frame-only` only with frame export debugging when no encoder is available.
- Optional control mode:

```sh
./node_modules/.bin/electron bundles/main.js --agent-control --agent-port 0
```
Expand All @@ -112,9 +112,10 @@ metadata:

- Use Line Graph tab type `1` for static plotted data from WPILOGs.
- A Line Graph controller state uses `leftSources`, `rightSources`, and `discreteSources`. Numeric source entries should use `type: "smooth"`, `logType: "Number"`, `visible: true`, and `options` with `color` and `size`. Discrete boolean overlays can use `type: "graph"` with `logType: "Boolean"`.
- Prefer `capture_layout.py` for graph screenshots. It launches the Team 8044 fork in `--agent-control --agent-headless`, waits for `liveStatus.ready=true`, optionally sends `setTime`, sends `capture`, and closes cleanly.
- Prefer `capture_layout.py` for graph screenshots. It launches the fork in `--agent-control --agent-headless`, waits for `liveStatus.ready=true`, optionally sends `setTime`, sends `capture`, and closes cleanly.
- Pair graph screenshots with `$wpilib-sim` topic summaries from `read_wpilog_values.py` so users get both the visual trend and concrete min/max values.
- Fast path for current-style graph requests:

```sh
python3 .agents/skills/wpilib-sim/scripts/list_wpilog_topics.py \
--repo . \
Expand Down Expand Up @@ -148,22 +149,23 @@ metadata:
- hub tab 1: Line Graph controller tab,
- satellite window: attached to the Line Graph controller UUID.
- Use `scripts/generate_multiview_3d_joysticks_layout.py` for 3D Field + Joysticks layouts. The helper can select the field tab or joystick tab with `--selected-tab field|joysticks` and can select a specific joystick layout for a port, for example `--joystick-port 0 --joystick-layout "Xbox Controller (White)"`.
- For game pieces, add `--game-piece-topic <Pose3d[] topic>` and `--game-piece-variant <variant>`. For MapleSim 2026 fuel, use `/RealOutputs/FieldSimulation/Fuel` and variant `Fuel`.
- For projectile or path overlays, add `--trajectory-topic <Pose3d[] topic>`. For MapleSim fuel shots, use `/RealOutputs/FieldSimulation/FuelShotTrajectory`; the helper adds it as a 3D Field `trajectory` source with a bold orange line by default.
- For robot sources that include Z/pitch/roll, pass `--topic-type Pose3d` to `scripts/generate_field3d_layout.py`. For MapleSim bump traversal, use `/RealOutputs/FieldSimulation/RobotPose3d` with `--topic-type Pose3d`.
- For game pieces, add `--game-piece-topic <Translation3d[] topic>` and `--game-piece-variant <variant>`. For fuel, use `/Robot/Sim/Fuel/Positions` (all pieces) or `/Robot/Sim/Fuel/InFlight` (airborne only) and variant `Fuel`.
- For projectile or path overlays, add `--trajectory-topic <Translation3d[] topic>`. For our fuel shots, use `/Robot/Sim/Fuel/LastShotArc`; the helper adds it as a 3D Field `trajectory` source with a bold orange line by default.
- For robot sources that include Z/pitch/roll, pass `--topic-type Pose3d` to `scripts/generate_field3d_layout.py`. For MapleSim bump traversal, use `Sim/RobotPose3d` (logged under `/Robot/` by DogLog) with `--topic-type Pose3d`.
- Use explicit field and robot model arguments from the task or asset discovery. Do not bake season-specific asset ids into the skill or helper defaults.
- Export with `export_preview.py --mode multiview --headless`. Expected outputs are `view-0-hub.webm`, `view-1-satellite.webm`, `preview.mp4`, and `manifest.json`.
- Joysticks multiview is supported by the Team 8044 fork's renderer-owned canvas capture path. Validate manifests report the joystick view with `sourceMode: "renderer-canvas"` and `sourceName: "JoysticksRenderer"`.
- Joystick multiview is supported by the fork's renderer-owned canvas capture path. Validate manifests report the joystick view with `sourceMode: "renderer-canvas"` and `sourceName: "JoysticksRenderer"`.
- Fast path for a 3D teleop preview plus live Xbox joystick pane:

```sh
python3 .agents/skills/advantagescope/scripts/generate_multiview_3d_joysticks_layout.py \
--out artifacts/auto-previews/layouts/teleop-3d-joysticks.json \
--field "<field-id>" \
--robot "<robot-model>" \
--pose-topic /RealOutputs/FieldSimulation/RobotPosition \
--game-piece-topic /RealOutputs/FieldSimulation/Fuel \
--pose-topic /Robot/Sim/RobotPose3d \
--game-piece-topic /Robot/Sim/Fuel/Positions \
--game-piece-variant Fuel \
--trajectory-topic /RealOutputs/FieldSimulation/FuelShotTrajectory \
--trajectory-topic /Robot/Sim/Fuel/LastShotArc \
--joystick-port 0 \
--joystick-layout "Xbox Controller (White)" \
--selected-tab field
Expand All @@ -180,6 +182,7 @@ metadata:
--mode multiview
```
- Fast path for a 3D auto preview synced with a four-topic current graph:

```sh
python3 .agents/skills/advantagescope/scripts/generate_multiview_layout.py \
--out artifacts/auto-previews/layouts/multiview-3d-drive-current.json \
Expand Down Expand Up @@ -231,4 +234,4 @@ metadata:
2. Discover custom assets with `discover_ascope_assets.py`, generate a layout with explicit field/model arguments, and export with `export_preview.py`.
3. Check `manifest.json` for the requested mode, selected renderer readiness, no missing sources/assets, valid video output, and no main/renderer error. Multiview exports should include per-view webm files plus composed `preview.mp4`.
4. Confirm wall-clock export time is close to the requested video duration, then inspect frame 0 and a mid-run frame for nonblank output, expected field asset, and visible robot pose. If using an older fork without renderer readiness, use visual inspection fallback and only add a short explicit delay as a last resort.
5. If the fork code itself must change, move to the Team 8044 AdvantageScope checkout and use `$advantagescope-fork`.
5. If the fork code itself must change, move to the AdvantageScope checkout and use `$advantagescope-fork`.
Loading
Loading