Skip to content

Commit eb3fda9

Browse files
committed
Update to camera limits
1 parent c03d899 commit eb3fda9

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

axis-ptz-controller.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,5 @@ LOG_LEVEL=INFO
4848
CONTINUE_ON_EXCEPTION=False
4949

5050
IS_DOME = True
51+
MIN_CAMERA_ANGLE=0
52+
MAX_CAMERA_ANGLE=90

axis-ptz-controller/axis_ptz_controller.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ def __init__(
9191
log_level: str = "INFO",
9292
continue_on_exception: bool = False,
9393
is_dome: bool = True,
94+
min_camera_tilt = 0,
95+
max_camera_tilt = 90,
9496
**kwargs: Any,
9597
):
9698
"""Instantiate the PTZ controller by connecting to the camera
@@ -189,6 +191,10 @@ def __init__(
189191
if False (the default)
190192
is_dome: bool
191193
flag for if this is a Dome type PTZ camera or a fully articulating camera
194+
min_camera_tilt: float
195+
minimum physical tilt level of camera
196+
max_camera_tilt: float
197+
maximum physical tilt level of camera
192198
193199
Returns
194200
-------
@@ -228,6 +234,8 @@ def __init__(
228234
self.log_level = log_level
229235
self.continue_on_exception = continue_on_exception
230236
self.is_dome = is_dome
237+
self.min_camera_tilt = min_camera_tilt
238+
self.max_camera_tilt = max_camera_tilt
231239

232240
# Always construct camera configuration and control since
233241
# instantiation only assigns arguments
@@ -936,7 +944,7 @@ def _object_callback(
936944
self.object.update_from_msg(data)
937945
#self.object.recompute_location()
938946

939-
if self.use_camera and self.is_dome and self.object.tau < 0:
947+
if self.use_camera and ( (self.object.tau < self.min_camera_tilt) or (self.object.tau > self.max_camera_tilt) ):
940948
logging.info(f"Stopping image capture of object: {self.object.object_id}")
941949
self.object = None
942950
self.do_capture = False
@@ -1331,6 +1339,8 @@ def make_controller() -> AxisPtzController:
13311339
os.environ.get("CONTINUE_ON_EXCEPTION", "False")
13321340
),
13331341
is_dome=ast.literal_eval(os.environ.get("IS_DOME", "True")),
1342+
min_camera_tilt=float(os.environ.get("MIN_CAMERA_ANGLE", 0.0)),
1343+
max_camera_tilt=float(os.environ.get("MAX_CAMERA_ANGLE", 90.0)),
13341344
)
13351345

13361346

0 commit comments

Comments
 (0)