Skip to content

Add: 3D Virtual Robotics Playground#11

Open
Lakshya-2440 wants to merge 2 commits intoalphaonelabs:mainfrom
Lakshya-2440:main
Open

Add: 3D Virtual Robotics Playground#11
Lakshya-2440 wants to merge 2 commits intoalphaonelabs:mainfrom
Lakshya-2440:main

Conversation

@Lakshya-2440
Copy link
Copy Markdown
Contributor

@Lakshya-2440 Lakshya-2440 commented Mar 25, 2026

Introduces an interactive 3D robot experience with gesture and manual controls, modular robot parts, and live sensor-style views for a more immersive robotics demo.

2026-03-25.16-00-14.mp4

Summary

This pull request introduces a new 3D Virtual Robotics Playground feature, providing an interactive browser-based robot simulation experience with gesture and manual control capabilities.

Key Changes

New 3D Application Module (3D/ directory):

  • app.js (1,699 lines): Core simulation engine featuring:

    • Gesture-based control via MediaPipe Hand Landmarker for real-time hand tracking
    • Keyboard-driven manual control mode (for fallback or direct file access)
    • Modular robot assembly system allowing users to equip different parts (chassis, sensors, etc.) via pinch/click interactions
    • 2D rendering pipeline with multiple canvas overlays: main simulation view, camera preview, LiDAR/HUD status panel, toolbox UI, and robot camera viewport
    • Static scene generation with random obstacles and wandering NPCs for realistic interaction
    • LiDAR scanning simulation synthesizing nearby contacts for sensor visualization
    • Multi-frame gesture classification for stable control state recognition
    • Deterministic scene setup with fixed camera/world parameters
  • index.html (28 lines): Application entrypoint with no-cache configuration, full-viewport canvas (1920×1080), camera video input element, and dynamic asset injection with cache-busting parameters

  • style.css (26 lines): Responsive full-viewport layout styling with CSS grid centering and aspect ratio constraints

Navigation Updates:

  • home.html: Added "Switch to 3D" button link in the Toolbox sidebar
  • index.html: Added "Assemble a robot in 3D" navigation button on the homepage with page transition overlay effect

Functional Impact

  • Users can now interact with a 3D-style robot assembly experience using hand gestures or keyboard input
  • The app auto-detects camera availability and gracefully falls back to manual keyboard mode
  • Includes MediaPipe CDN loader with error handling and multiple fallback sources
  • Gesture controls enable intuitive robot manipulation without physical devices
  • Sensor visualization (LiDAR) provides real-time environmental awareness within the simulation

User Experience Enhancement

The 3D Playground enriches the robotics demo experience by offering an immersive, interactive way to understand robot assembly and sensor-based decision making through either gesture recognition or traditional keyboard controls.

Copilot AI review requested due to automatic review settings March 25, 2026 10:57
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 25, 2026

Walkthrough

This pull request introduces a complete browser-based 3D gesture-controlled robot assembly simulator. New files in the 3D/ directory include a canvas-based animation system with gesture tracking via MediaPipe, robot simulation logic, and UI components. Navigation links are added to the homepage and sidebar to route users to the new 3D interface.

Changes

Cohort / File(s) Summary
New 3D Application
3D/app.js, 3D/index.html, 3D/style.css
Comprehensive 3D robot simulator with gesture-driven control (MediaPipe Hand Landmarker), multi-canvas rendering (simulation, camera, lidar/HUD, toolbox), deterministic scene generation with static objects and wandering humans, robot state management (movement/turning/pickup-drop), toolbox part assembly with UI locking rules, and MediaPipe loader with multi-CDN fallback and error handling.
Navigation Integration
home.html, index.html
Added "Switch to 3D" sidebar link in home.html and "Assemble a robot in 3D" homepage button with page transition overlay in index.html, both routing to /3D/index.html.

Sequence Diagram

sequenceDiagram
    participant User
    participant MediaPipe as MediaPipe<br/>Hand Landmarker
    participant GestureDetect as Gesture<br/>Classifier
    participant RobotSim as Robot<br/>Simulator
    participant Renderer as Canvas<br/>Renderer

    loop Animation Frame
        alt Gesture Mode
            User->>MediaPipe: Capture hand landmarks
            MediaPipe-->>GestureDetect: Hand positions
            GestureDetect->>GestureDetect: Multi-frame classification<br/>(stable gesture detection)
            GestureDetect-->>RobotSim: Gesture action<br/>(move, turn, pinch)
        else Manual Mode
            User->>RobotSim: Keyboard input
        end
        
        RobotSim->>RobotSim: Update robot state<br/>(position, rotation, arm)
        RobotSim->>RobotSim: Check object pickup/drop<br/>(range & arm state)
        RobotSim->>RobotSim: Scan lidar contacts<br/>(static scene & humans)
        RobotSim-->>Renderer: Simulation state +<br/>lidar data
        
        Renderer->>Renderer: Render main canvas<br/>(robot, objects, scene)
        Renderer->>Renderer: Render camera preview<br/>& lidar panel
        Renderer->>Renderer: Render toolbox UI<br/>(part selection)
        Renderer-->>User: Visual feedback
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main addition: a new 3D interactive robotics experience with gesture controls and modular robot assembly.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “3D Virtual Robotics Playground” experience and links it into the existing landing page + 2D playground, providing a browser-based robot assembly/demo with gesture (MediaPipe) and manual controls.

Changes:

  • Added a new /3D page (HTML/CSS/JS) implementing a canvas-based robot “assembler” with gesture tracking and a manual fallback mode.
  • Added navigation entries in index.html and home.html to reach the new 3D experience.
  • Introduced new static assets under 3D/ (plus an unintended .DS_Store).

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
index.html Adds a CTA button to open the 3D playground from the main landing experience.
home.html Adds a “Switch to 3D” link from the existing 2D playground UI.
3D/index.html New entry page for the 3D playground; loads versioned CSS/JS.
3D/style.css New CSS to full-screen/center the 3D canvas and hide the camera video element.
3D/app.js New implementation of the 3D/gesture + manual robot playground (canvas rendering + MediaPipe integration).
.DS_Store macOS metadata file added to the repo (should not be committed).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@3D/app.js`:
- Around line 1606-1631: The setupCamera function can hang indefinitely if the
user leaves the permission prompt open or metadata never fires; modify
setupCamera to enforce a timeout (e.g., 8–15s) around the async operations: wrap
the navigator.mediaDevices.getUserMedia call and the Promise waiting on
video.onloadedmetadata in a race with a timeout Promise that rejects, and on
timeout clean up any partially created mediaStream (stop tracks) and throw a
clear timeout error; reference setupCamera, navigator.mediaDevices.getUserMedia,
mediaStream, and video.onloadedmetadata when implementing the race and cleanup.
- Around line 937-943: The hover handler currently flips selectedParts[category]
when lastHoveredCat !== category (using symbols lastHoveredCat, selectedParts,
TOOLBOX_PARTS, category), which causes parts to toggle on mere hover; to make
activation explicit remove that auto-toggle: stop mutating selectedParts inside
the hover branch and instead only update lastHoveredCat (or add a no-op
visual-only hover state), and move any part-selection logic to the explicit
click/pinch handler (the function that currently changes selectedParts on
click). If you want to keep hover feedback, implement a transient visual cue
(e.g., hoverState or isHovered flag) separate from selectedParts so hovering
shows UI feedback without changing actual selection.

In `@3D/index.html`:
- Around line 7-9: The three http-equiv meta tags (Cache-Control, Pragma,
Expires) provide limited real-world cache control and can be removed or replaced
with an inline comment clarifying they are informational only; rely on the
existing cache-busting query string (?v=${window.__assetVersion}) for asset
invalidation in this project and add a note to configure proper server-side
cache headers (nginx/.htaccess/CDN) for production environments.
- Line 19: The canvas element with id "simCanvas" is missing accessibility
attributes; update the <canvas id="simCanvas"> element to include role="img" and
a descriptive aria-label (matching the pattern used in home.html) so screen
readers can interpret the main interactive area—ensure the aria-label text
clearly describes the simulation or visual content presented by simCanvas.

In `@home.html`:
- Around line 92-96: The "Switch to 3D" anchor (href="/3D/index.html", contains
<span>Switch to 3D</span> and the large button classes) is inconsistent with the
"Assemble a robot in 3D" button on index.html which uses a .page-transition
overlay and a 1200ms delayed navigation; pick one approach and make both
consistent: either add the same page-transition overlay/CSS/JS to this file and
intercept clicks on the "Switch to 3D" link to show the .page-transition and
delay navigation by 1200ms, or remove the overlay/delay logic from the "Assemble
a robot in 3D" handler in index.html so both links navigate immediately. Ensure
you update the click handler targeting the button text ("Assemble a robot in
3D") or the anchor href="/3D/index.html" accordingly and keep ARIA/semantics
intact.

In `@index.html`:
- Around line 593-609: The anchor element with href "/3D/index.html" (className
"tech-btn" and onClick handler using document.getElementById('page-transition')
and setTimeout to set window.location.href) should use a relative path for
consistency—replace both href="/3D/index.html" and the string passed to
window.location.href in the setTimeout with a relative path like
"./3D/index.html" (or "3D/index.html"), keeping the existing overlay activation
and timing logic intact.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: alphaonelabs/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 71707aa5-b12b-4432-9f66-035bc265b79f

📥 Commits

Reviewing files that changed from the base of the PR and between 022f952 and 61dbd8f.

⛔ Files ignored due to path filters (1)
  • .DS_Store is excluded by !**/.DS_Store
📒 Files selected for processing (5)
  • 3D/app.js
  • 3D/index.html
  • 3D/style.css
  • home.html
  • index.html

@Lakshya-2440
Copy link
Copy Markdown
Contributor Author

@A1L13N done

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.

3 participants