Skip to content

Add Record & Replay feature for mission sessions#10

Open
Customize5773 wants to merge 7 commits into
DockSysfrom
main
Open

Add Record & Replay feature for mission sessions#10
Customize5773 wants to merge 7 commits into
DockSysfrom
main

Conversation

@Customize5773

Copy link
Copy Markdown
Owner

Summary

Implements a complete Record & Replay system for mission sessions, allowing operators to record ROV telemetry, video streams, and commands during missions, then replay them with synchronized video and 3D trajectory visualization. This is an optional value-add feature (§4.7) for KKI 2026.

Key Changes

Frontend (Browser)

  • New Replay page (public/js/pages/replay.js):

    • Record control: Start/Stop buttons send record_start/record_stop via WebSocket
    • Session management: Lists saved recordings with metadata (duration, cameras, sample count)
    • Playback controls: Play/pause and timeline scrubber synchronized across video feeds and 3D trajectory
    • Dead-reckoning reconstruction: Rebuilds ROV x,y position from logged heading/depth and surge/sway commands using same algorithm as live mission page
    • Isolated state: Completely separate from live control—no command routing to ROV
  • New 3D trajectory scene (public/js/pages/replay-scene.js):

    • Renders historical trajectory path and ROV pose markers
    • Synchronized with video playback via timeline scrubber
    • Adapted from mission.js scene design but receives pre-computed poses (no live integration)
  • Camera switching (public/js/app.js):

    • Multi-camera support in Control page with camera selector button
    • Visible only in fullscreen mode when multiple cameras available
  • WebSocket integration (public/js/app.js, public/js/core.js):

    • Receives record_status messages from server
    • Exposes raw wsSend function for record control messages

Backend (Node.js Server)

  • Recording manager (server/recording.js):

    • Manages one active recording session at a time
    • Records trajectory: telemetry samples (heading, depth, roll, pitch) + movement commands (surge/sway/yaw/heave/control_mode)
    • Records video: taps MJPEG streams frame-by-frame, stores raw JPEG data with index for seeking
    • Auto-stop at configurable duration limit (default 15 minutes, via MAX_RECORD_MIN env var)
    • Session storage: server/recordings/<session_id>/ with meta.json, trajectory.jsonl, commands.jsonl, and per-camera video files
  • HTTP endpoints (server/server.js):

    • GET /api/recordings: List all saved sessions with metadata
    • GET /recordings/<id>/<file>: Serve session data files (meta.json, trajectory.jsonl, commands.jsonl, index files)
    • GET /replay/frame: Retrieve individual JPEG frames by session/camera/index
  • Telemetry/command tapping (server/server.js):

    • Hooks into existing telemetry and command flows
    • Records only trajectory-relevant commands (surge/sway/yaw/heave/control_mode/set_surface)
    • Timestamps all data with server clock for synchronization

Raspberry Pi (Python)

  • Manual control support (rov_agent.py, manual_control.py):
    • New manual_control.py module: Pure mapping from axis percentages (-100..100) to MAVLink MANUAL_CONTROL message
    • Axis mapping: surge→x, sway→y, yaw→r, heave→z (throttle)
    • Throttle range: 0..1000 with neutral at 500
    • Fail-safe: Sends neutral command after 0.5s idle, prevents axis commands from "sticking"
    • Uses MANUAL_CONTROL message (not RC_CHANNELS_OVERRIDE) to avoid interfering with physical RC configuration

Testing

  • Unit tests (server/test/recording.test.js):

    • Session lifecycle (start/stop)
    • Trajectory and command logging
    • Metadata finalization
    • File I/O validation
  • Manual control tests (test_manual_control.py):

    • Axis range mapping
    • Thrott

https://claude.ai/code/session_01FBeZKmoVCYY5uBPiMHVwCx

Customize5773 and others added 7 commits July 13, 2026 20:35
…g-eaz5bn

feat(autonomy): deteksi hook + docking closed-loop misi 3b (HANG) & m…
- Implemented recording.js to manage mission session recordings, including trajectory and video streams.
- Added functionality to record telemetry and commands, store them in structured files, and manage session metadata.
- Introduced a .gitignore file to prevent committing session data.
- Created unit tests for the recording manager, covering session start/stop logic, telemetry logging, command tapping, and session listing/access.
Merge pull request #6 from Customize5773/claude/hook-detection-dockin…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant