Repository navigation
CodeAIR simulator: its camera, and a live camera view toggled from the bar - #171
Merged
Merged
Conversation
…lator The camera as it is on the drone (world/camera.js): an OV2640 under the board, 23 mm ahead of the centre as the CAD model has it, looking straight down, 160 x 120, 66 degrees across the diagonal; its picture's top is the nose, unmirrored, as CodeSpace's lessons and the helipad demo use it. The figure carries it, so it moves and leans with the drone as drawn. A camera button in the bar, for CodeAIR, shows what it sees in the view's lower left corner; hidden, nothing extra is drawn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SS5gJ3Ss35qTL2qEztbDud
…ide the board's buttons Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SS5gJ3Ss35qTL2qEztbDud
|
Visit the preview URL for this PR (updated for commit b2e0273): https://firialabs-open-editor--pr171-codeair-camera-gixsf8rr.web.app (expires Thu, 10 Dec 2026 16:00:21 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 81259a1fec315ca1af3747d225d9c7424890be3e |
# Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The simulated CodeAIR now has its camera, and a button in the simulator's bar shows what it sees, live, in the lower left corner of the view.
The camera, as on the drone (
src/sim/world/camera.js). An OV2640 under the board, 160 x 120, looking straight down, 66 degrees across the diagonal (about 54.9 across and 42.6 front to back; confirmed by David). Its place is the CAD model's camera module: 23 mm ahead of the drone's centre, on the centre line. The top of the picture is the drone's nose and the picture is not mirrored. CodeSpace's camera lessons and the helipad tracking demo both steer that way.The live view (
src/sim/view/codeair-camera.js). The drone's figure carries the camera, so the picture moves and leans with the drone as drawn. The view's own renderer draws it into a 4:3 box after the scene, framed and labelled "CodeAIR's camera". It is about 160 x 120 CSS pixels, the camera's own size. Hidden, it draws nothing extra: no render, no render target. Shown, it draws only when the view does, and the view rests when nothing moves.The button. A camera icon in the bar, for CodeAIR only, pressed while the view shows. It follows the toggle pattern of PR 167, with its own class so it does not meet CodeX's overlay toggles. On a phone it sits on the bar's first line, beside BTN 0 and BTN 1. The choice carries to the next drone.
Captures (
camera.take()with real frames into the data pipe) are the next PR.Tests.
tests/sim.mjs: the field of view, the size, and the mount against the model's camera part.tests/sim-ui.mjs: the button shows and hides the view; nothing is drawn while it is hidden; the view looks down with the nose up the picture; what it draws varies (a floor, not a blank box).Run locally:
sim.mjsandsim-ui.mjs(with CodeAIR flight), plusi18n,pseudo,a11yandsmoke, all pass.Screenshots (desktop, Chromebook and phone widths) are on the botblocks page "CodeAIR camera view: screenshots".
🤖 Generated with Claude Code