Skip to content

CodeAIR simulator: its camera, and a live camera view toggled from the bar - #171

Merged
david-firia merged 3 commits into
mainfrom
codeair-camera
Dec 3, 2026
Merged

david-firia merged 3 commits into
mainfrom
codeair-camera

Conversation

@david-firia

Copy link
Copy Markdown
Contributor

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.mjs and sim-ui.mjs (with CodeAIR flight), plus i18n, pseudo, a11y and smoke, all pass.

Screenshots (desktop, Chromebook and phone widths) are on the botblocks page "CodeAIR camera view: screenshots".

🤖 Generated with Claude Code

david-firia and others added 2 commits December 3, 2026 09:14
…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
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

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

@david-firia
david-firia merged commit 132bc47 into main Dec 3, 2026
8 of 9 checks passed
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