Skip to content

chore: annotate the camera blocks and correct their docstrings - #253

Merged
petercorke merged 7 commits into
mainfrom
chore/types-blocks-camera-2
Nov 23, 2026
Merged

petercorke merged 7 commits into
mainfrom
chore/types-blocks-camera-2

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Annotates blocks/camera.py, the first file in the type-hint work of Issue 60 (it had no annotations at all: 32 of 32 parameters and 9 of 9 returns). Annotation and docstring changes only, no behaviour change.

  • Every parameter and return has a type, in modern syntax (X | None, dict[str, Any]). The camera arguments are typed as CameraBase, or CentralCamera where the block needs visjac_p or estpose. The output, step and start signatures match bdsim's.
  • Docstrings: the :type: lines that the annotations replace are gone, and the ones where shape adds information stay. The ImagePlane examples were SCOPE examples and are now IMAGEPLANE examples. Visjac_p said depthest defaults to True (it is False) and ended in an unfinished sentence, EstPose_p gave P as ndarray(2,N) (it is 3xN), and the CAMERA port list named an input pose that is ξ. The module docstring sat after the imports, so it was not a docstring. ImagePlane's style was documented as accepting a list, which raises ValueError.
  • Annotating the body found no new errors, mypy reports no issues, and the full suite passes (2143 passed, 33 skipped). Parameter annotations across the package go from 86.8% to 88.4%, and this file now has none missing.

Stacked on PR 251 (ImagePlane for bdsim 1.5) and the VISJAC_P depthest fix (PR below), which have to merge first, because they change the ImagePlane and Visjac_p code annotated here. The Visjac_p docstring keeps the text of that fix.

AI-assisted: written with Claude Code (Claude Sonnet 5.5) and reviewed by the maintainer.

🤖 Generated with Claude Code

petercorke and others added 4 commits November 23, 2026 16:09
IMAGEPLANE(watch=True) failed with AttributeError ('StartPlug' object has no
attribute 'start'), because ImagePlane added its input signals to the
watchlist itself and bdsim 1.5 now does that in GraphicsBlock.start. It also
made a second figure, leaving the one the base class makes empty, and
opened a figure when graphics were turned off. watch goes to the base class,
start() uses the figure and axes it makes, data is collected in record(),
which runs for every accepted sample, and step() only redraws.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Part of Issue 60. Adds annotations to every parameter and return in
blocks/camera.py, removes :type: lines the annotations replace, and
corrects docstrings: the ImagePlane examples were SCOPE examples, the
Visjac_p default for depthest and the EstPose_p shape of P were wrong, the
Visjac_p text was an unfinished sentence, and the module docstring sat after
the imports.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Visjac_p stored depthest and never used it, so depthest=True silently gave
the Jacobian for the fixed depth. Depth estimation needs the camera motion,
which the block does not have as an input, so it raises instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 high

Alerts:
⚠ 1 issue (≤ 0 issues of at least minor severity)

Results:
1 new issue

Category Results
ErrorProne 1 high

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

petercorke and others added 3 commits November 23, 2026 17:02
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@petercorke
petercorke merged commit 570bee6 into main Nov 23, 2026
33 of 34 checks passed
@petercorke
petercorke deleted the chore/types-blocks-camera-2 branch November 23, 2026 08:27
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