Add PTZ calibration app and calibrated move parameters#335
Open
MateoLostanlen wants to merge 29 commits intodevelopfrom
Open
Add PTZ calibration app and calibrated move parameters#335MateoLostanlen wants to merge 29 commits intodevelopfrom
MateoLostanlen wants to merge 29 commits intodevelopfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #335 +/- ##
========================================
Coverage 73.44% 73.44%
========================================
Files 7 7
Lines 610 610
========================================
Hits 448 448
Misses 162 162
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
When the target angle is below the calibrated bias at speed 1, fire a 50ms impulse instead of skipping the move. Applies to both /click_to_move and /move endpoints. Add micro-pulse calibration section to the calibration app (zoom 41 default for precision).
Add duration parameter to /move endpoint so move+sleep+stop happens on the Pi. Update calibration app to use single API calls for all movements.
- update 823A16 and 823S2 pan/tilt speed and bias tables (zoom 0) - add zoom-aware speed selection: speed 1 only when zoom > 0 - micro-pulse zooms to 41 for consistent small displacement - add auto keypoint matching (ORB) for hands-free calibration - add zoom sweep mode to measure speed vs zoom relationship - add /control/speed_tables endpoint, calibration app fetches from API - add calibration report and tools README
- fetch speed tables from /control/speed_tables endpoint (single source of truth) - click-to-move: zoom-aware speed selection, micro-pulse support - skip threshold based on bias/2 instead of hardcoded 0.5 deg - zoom settle time scales with zoom delta - update reference tables to match routes_control.py
- move route: add zoom param, force speed=1 when zoom>0 with warning - click_to_move route: remove zoom manipulation in micro-impulse, add warning when zoom>0 - client: add click_to_move, get_speed_tables methods; add duration/zoom params to move_camera; log warnings when zoom>0
- click_to_move accepts only camera_ip + normalized click_x/click_y in [0,1] - server reads current zoom via get_focus_level and resolves FOV from table - response includes zoom, h_fov, v_fov for easier debugging - add tools/pyproject.toml for uv-managed calibration app deps
…duration, move_by_degrees)
…e, full lock coverage
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
be removed once platform integration is done)
Key changes
routes_control.py
keep working instead of silently hitting the uncalibrated path
Concurrency (new)
/stop and /stop_move stay unlocked so aborts always win.
within milliseconds. Operators can immediately issue a corrective command instead of waiting for the original sleep to expire.
Responses include "interrupted": true on short-circuited moves.
endpoints (goto_preset, start_move, legacy /move) hold it briefly to gate against preemption.
Focused PTZ routes (new) — move_camera replacements
The existing /control/move is an overloaded endpoint that multiplexes four modes (preset, duration, degrees, bare direction)
through the same signature. It stays in place so the platform keeps working, and will be removed once platform integration
migrates to the focused routes below.
explicit speeds (e.g. speed=10 on Reolink, or any speed != 1 at zoom > 0) return 400 with a helpful message instead of silently
downgrading.
pyro_camera_api_client (library)
tools/ptz_calibration_app.py
tools/livestream_app.py (new)
Docs
Context
Previous speed tables were calibrated through VPN with separate move/stop API calls, adding 50–200 ms uncontrolled latency per
measurement. Server-side timing eliminates this. A zoom sweep revealed Reolink cameras cap motor speed at zoom > 0 (all speeds
→ ~1.5 °/s), so higher speed levels are only useful at zoom 0. The concurrency and focused-route work came out of a code
review: unlocked PTZ endpoints could interrupt mid-move click_to_move, /stop could only halt the motor without freeing the
lock, and the overloaded /control/move made it too easy to pick the wrong mode or an out-of-range speed — all fixed here.