maiermic / robot-cameraman

Robot cameraman similar to Soloshot or Pixio
MIT License
13 stars 5 forks source link

allow to limit the movement of the camera #14

Closed maiermic closed 1 year ago

maiermic commented 2 years ago

For example, if I know/assume that the tracked object will never move sideways and only in the direction the camera is pointing to, the camera may not pan at all or it can be limited to a small/certain angle/range.

In most cases, it doesn't make sense to point the camera to the ground or in the sky, i.e. tilting may be limited, too.

maiermic commented 2 years ago

My gimbal (Ikan Beholder DS2-A) is drifting significantly over time. The gimbal does not recognize this (see comment). Thereby, the angles are not reliable over time.

For example, if you define the minimum angle to be 10 degree and the gimbal drifts 1 degree clockwise in 5 minutes, the actual limit would be 15 degrees after 25 minutes and 20 degrees after 50 minutes. This would make the limit unreliable or even useless.

maiermic commented 2 years ago

This feature is developed on branch feature/14-allow-to-limit-the-movement-of-the-camera. At the moment, pan and tilt angle can be limited, as well as the zoom ratio (see menu limits in Web UI).

However, the limit of the zoom ratio is exceeded most of the times right now. The cameraman robot receives the zoom ratio via the UDP stream of the live view image. The command to stop zooming in or out is not sent before the limit is reached. There is a delay between when the camera actually reaches the zoom ratio (limit) and when the camera receives the stop command. In this time the camera continues to zoom and exceeds the limit. The camera robot would have to estimate, when the zoom ratio will be reached to send the command in advance, such that the camera receives it, when the zoom ratio is reached.

This estimation depends on the camera model, zoom speed, zoom direction (in or out) and the zoom step (not every zoom step is reached in the same time). For example, the Panasonic DMC LF1 takes ca. 2.95s to zoom (slowly) from zoom ratio 1.0 to 2.0, but only ca. 0.7s to zoom (slowly) from 2.0 to 1.0. Further, it takes only 1.09s to zoom (slowly) from zoom ratio 2.0 to 3.0. The script robot_cameraman/analyze_zoom_of_camera.py analyzes the camera by measuring the time it takes to reach the zoom limit. The results may be used to develop a more reliable solution to satisfy the zoom ratio limit.

maiermic commented 1 year ago

Scripts to analyze the zoom can be found in robot_cameraman/tools

Zoom indices are more fine grained steps. A range of indices covers a zoom ratio (e.g. zoom ratio 1.0 is convered by 0-5, zoom ratio 2.0 is convered by 6-11, etc.). The limit might still be exceeded, since the zoom can not be stopped at an exact zoom index (or ratio) using the API. However, the index changes more frequently and allow better control. The controllers might be improved in the future.

The result of the scripts are configuration files that can be passed using the CLI arguments --camera-zoom-steps and --camera-zoom-ratio-index-ranges. See help for more information. The Web UI changes depending on the passed configuration (select zoom index vs. ratio).