Skip to content

Commit

Permalink
Fix interpolation for autotracking cameras (#16211)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye217 authored Jan 29, 2025
1 parent 335b756 commit 7b65bcf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frigate/ptz/onvif.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,19 +411,19 @@ def _move_relative(self, camera_name: str, pan, tilt, zoom, speed) -> None:
# The onvif spec says this can report as +INF and -INF, so this may need to be modified
pan = numpy.interp(
pan,
[-1, 1],
[
self.cams[camera_name]["relative_fov_range"]["XRange"]["Min"],
self.cams[camera_name]["relative_fov_range"]["XRange"]["Max"],
],
[-1, 1],
)
tilt = numpy.interp(
tilt,
[-1, 1],
[
self.cams[camera_name]["relative_fov_range"]["YRange"]["Min"],
self.cams[camera_name]["relative_fov_range"]["YRange"]["Max"],
],
[-1, 1],
)

move_request.Speed = {
Expand Down Expand Up @@ -536,11 +536,11 @@ def _zoom_absolute(self, camera_name: str, zoom, speed) -> None:
# function takes in 0 to 1 for zoom, interpolate to the values of the camera.
zoom = numpy.interp(
zoom,
[0, 1],
[
self.cams[camera_name]["absolute_zoom_range"]["XRange"]["Min"],
self.cams[camera_name]["absolute_zoom_range"]["XRange"]["Max"],
],
[0, 1],
)

move_request.Speed = {"Zoom": speed}
Expand Down

0 comments on commit 7b65bcf

Please sign in to comment.