mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	Small autotracking changes (#9571)
* ignore web-new * remove web-new * catch exceptions for unsupported cameras * don't split up large ptz movements * fix ruff
This commit is contained in:
		
							parent
							
								
									2d0864c723
								
							
						
					
					
						commit
						3df8b5829c
					
				
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -14,9 +14,6 @@ frigate/version.py
 | 
				
			|||||||
web/build
 | 
					web/build
 | 
				
			||||||
web/node_modules
 | 
					web/node_modules
 | 
				
			||||||
web/coverage
 | 
					web/coverage
 | 
				
			||||||
web-new/build
 | 
					 | 
				
			||||||
web-new/node_modules
 | 
					 | 
				
			||||||
web-new/coverage
 | 
					 | 
				
			||||||
core
 | 
					core
 | 
				
			||||||
!/web/**/*.ts
 | 
					!/web/**/*.ts
 | 
				
			||||||
.idea/*
 | 
					.idea/*
 | 
				
			||||||
@ -734,11 +734,12 @@ class PtzAutoTracker:
 | 
				
			|||||||
            and frame_time > self.ptz_metrics[camera]["ptz_stop_time"].value
 | 
					            and frame_time > self.ptz_metrics[camera]["ptz_stop_time"].value
 | 
				
			||||||
            and not self.move_queue_locks[camera].locked()
 | 
					            and not self.move_queue_locks[camera].locked()
 | 
				
			||||||
        ):
 | 
					        ):
 | 
				
			||||||
            # split up any large moves caused by velocity estimated movements
 | 
					            # we can split up any large moves caused by velocity estimated movements if necessary
 | 
				
			||||||
 | 
					            # get an excess amount and assign it instead of 0 below
 | 
				
			||||||
            while pan != 0 or tilt != 0 or zoom != 0:
 | 
					            while pan != 0 or tilt != 0 or zoom != 0:
 | 
				
			||||||
                pan, pan_excess = split_value(pan)
 | 
					                pan, _ = split_value(pan)
 | 
				
			||||||
                tilt, tilt_excess = split_value(tilt)
 | 
					                tilt, _ = split_value(tilt)
 | 
				
			||||||
                zoom, zoom_excess = split_value(zoom, False)
 | 
					                zoom, _ = split_value(zoom, False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                logger.debug(
 | 
					                logger.debug(
 | 
				
			||||||
                    f"{camera}: Enqueue movement for frame time: {frame_time} pan: {pan}, tilt: {tilt}, zoom: {zoom}"
 | 
					                    f"{camera}: Enqueue movement for frame time: {frame_time} pan: {pan}, tilt: {tilt}, zoom: {zoom}"
 | 
				
			||||||
@ -746,9 +747,10 @@ class PtzAutoTracker:
 | 
				
			|||||||
                move_data = (frame_time, pan, tilt, zoom)
 | 
					                move_data = (frame_time, pan, tilt, zoom)
 | 
				
			||||||
                self.move_queues[camera].put(move_data)
 | 
					                self.move_queues[camera].put(move_data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                pan = pan_excess
 | 
					                # reset values to not split up large movements
 | 
				
			||||||
                tilt = tilt_excess
 | 
					                pan = 0
 | 
				
			||||||
                zoom = zoom_excess
 | 
					                tilt = 0
 | 
				
			||||||
 | 
					                zoom = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _touching_frame_edges(self, camera, box):
 | 
					    def _touching_frame_edges(self, camera, box):
 | 
				
			||||||
        camera_config = self.config.cameras[camera]
 | 
					        camera_config = self.config.cameras[camera]
 | 
				
			||||||
 | 
				
			|||||||
@ -528,24 +528,25 @@ class OnvifController:
 | 
				
			|||||||
        except Exception:
 | 
					        except Exception:
 | 
				
			||||||
            pass  # We're unsupported, that'll be reported in the next check.
 | 
					            pass  # We're unsupported, that'll be reported in the next check.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # there doesn't seem to be an onvif standard with this optional parameter
 | 
					        try:
 | 
				
			||||||
        # some cameras can report MoveStatus with or without PanTilt or Zoom attributes
 | 
					            pan_tilt_status = getattr(status.MoveStatus, "PanTilt", None)
 | 
				
			||||||
        pan_tilt_status = getattr(status.MoveStatus, "PanTilt", None)
 | 
					            zoom_status = getattr(status.MoveStatus, "Zoom", None)
 | 
				
			||||||
        zoom_status = getattr(status.MoveStatus, "Zoom", None)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # if it's not an attribute, see if MoveStatus even exists in the status result
 | 
					            # if it's not an attribute, see if MoveStatus even exists in the status result
 | 
				
			||||||
        if pan_tilt_status is None:
 | 
					            if pan_tilt_status is None:
 | 
				
			||||||
            pan_tilt_status = getattr(status, "MoveStatus", None)
 | 
					                pan_tilt_status = getattr(status, "MoveStatus", None)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # we're unsupported
 | 
					                # we're unsupported
 | 
				
			||||||
            if pan_tilt_status is None or pan_tilt_status not in [
 | 
					                if pan_tilt_status is None or pan_tilt_status not in [
 | 
				
			||||||
                "IDLE",
 | 
					                    "IDLE",
 | 
				
			||||||
                "MOVING",
 | 
					                    "MOVING",
 | 
				
			||||||
            ]:
 | 
					                ]:
 | 
				
			||||||
                logger.error(
 | 
					                    raise Exception
 | 
				
			||||||
                    f"Camera {camera_name} does not support the ONVIF GetStatus method. Autotracking will not function correctly and must be disabled in your config."
 | 
					        except Exception:
 | 
				
			||||||
                )
 | 
					            logger.warning(
 | 
				
			||||||
                return
 | 
					                f"Camera {camera_name} does not support the ONVIF GetStatus method. Autotracking will not function correctly and must be disabled in your config."
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					            return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if pan_tilt_status == "IDLE" and (zoom_status is None or zoom_status == "IDLE"):
 | 
					        if pan_tilt_status == "IDLE" and (zoom_status is None or zoom_status == "IDLE"):
 | 
				
			||||||
            self.cams[camera_name]["active"] = False
 | 
					            self.cams[camera_name]["active"] = False
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user