Repository navigation
fix: CameraBase.plot() unbound call (self=None) crashed instead of working - #90
Merged
Merged
Conversation
…rking CentralCamera.plot(pose=..., scale=...) -- called on the class itself, with no instance -- is a real, book-used pattern for plotting camera icons at a set of poses that don't belong to any single camera instance (eg. calibration frames from images2C()). The self=None default made this look supported, but self._plot_frustum()/self._plot_camera_icon() required a bound self, and frame=True used self.pose instead of the passed-in pose, so the unbound form always raised AttributeError. _plot_frustum() and _plot_camera_icon() never actually used self, so made them staticmethods and call them via CameraBase directly; the frame block now uses pose instead of self.pose. Unbound calls with no pose now raise a clear ValueError instead of an AttributeError. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
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.
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.
Summary
CentralCamera.plot(pose=..., scale=...)-- called unbound on the class, no instance -- is a real usage pattern (e.g. RVC3-python's chap13 notebook plots calibration frames fromimages2C()this way), signalled byplot()'s ownself=Nonedefault, but never actually worked:self._plot_frustum()/self._plot_camera_icon()require a boundself, so it always raisedAttributeError: 'NoneType' object has no attribute '_plot_camera_icon'._plot_frustum()/_plot_camera_icon()never usedselfat all, so made them@staticmethodand call them viaCameraBasedirectly.frame=True/frame=<dict>block usedself.poseinstead of the passed-inpose, so a bound call with an explicitposedifferent from the instance's own pose silently drew the frame overlay in the wrong place.posenow raise a clearValueErrorinstead of the confusingAttributeError.Test plan
tests/test_camera.py::TestCameraPlot-- addedtest_plot_unbound_with_pose(asserts icon collections actually get added) andtest_plot_unbound_without_pose_raises; all 5TestCameraPlottests passfor frame in frames: CentralCamera.plot(pose=frame.pose, scale=0.05))🤖 Generated with Claude Code