Skip to content

Fun little camera pose viewer #1936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Juniormunk
Copy link
Contributor

Description

Still very much a draft.

Meta

Merge checklist:

  • Pull Request title is short, imperative summary of proposed changes
  • The description documents the what and why
  • If this PR changes behavior or adds a feature, user documentation is updated
  • If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly
  • If this PR touches configuration, this is backwards compatible with settings back to v2024.3.1
  • If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated
  • If this PR addresses a bug, a regression test for it is added

</table>
<button id="add-camera" style="margin-top: 10px;">Add Camera</button>

<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
Copy link
Contributor

Choose a reason for hiding this comment

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

This will not work offline. We should figure out how to make this work offline lol

camera.lookAt(0, 0, 0); // Look at the origin
}

setCameraView('isometric');
Copy link
Contributor

Choose a reason for hiding this comment

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

should we allow users to rotate the camera view around the robot? I briefly tried to get OrbitControls working, but orbit controls seemed to behave weirdly. They seemed to assume Y was up?

diff --git a/docs/source/docs/quick-start/camera-calibration.md b/docs/source/docs/quick-start/camera-calibration.md
index d795d8ed..e69d8b1c 100644
--- a/docs/source/docs/quick-start/camera-calibration.md
+++ b/docs/source/docs/quick-start/camera-calibration.md
@@ -55,8 +55,16 @@ Below is an interactive demo to visualize multiple cameras' positions and orient
 </table>
 <button id="add-camera" style="margin-top: 10px;">Add Camera</button>
 
-<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
-<script>
+<script type="module">
+  // import * as THREE from 'https://cdn.jsdelivr.net/npm/three@0.152/build/three.module.js';
+  // import { OrbitControls } from 'https://unpkg.com/three@0.152.0/examples/jsm/controls/OrbitControls.js?module';
+
+  import * as THREE from "https://unpkg.com/three@0.152.0/build/three.module.js";
+  import { OrbitControls } from "https://unpkg.com/three@0.152.0/examples/jsm/controls/OrbitControls.js?module";
+
+
+  // const THREE = three;
+
   const scene = new THREE.Scene();
   const aspect = 800 / 400; // Aspect ratio based on the renderer size
   const orthoSize = 1.5; // Size of the orthographic view
@@ -310,6 +318,9 @@ Below is an interactive demo to visualize multiple cameras' positions and orient
     camera.lookAt(0, 0, 0); // Look at the origin
   }
 
+  const controls = new OrbitControls(camera, renderer.domElement);
+  controls.update();
+
   setCameraView('isometric');
 
   // Draw the fixed bumpers once
@@ -317,6 +328,7 @@ Below is an interactive demo to visualize multiple cameras' positions and orient
 
   function animate() {
     requestAnimationFrame(animate);
+    controls.update();
     renderer.render(scene, camera);
   }
   animate();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't get it to work at all 💀let me try some more.

@samfreund samfreund added documentation Anything relating to https://docs.photonvision.org enhancement New feature or request labels May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Anything relating to https://docs.photonvision.org enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants