File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 1515# along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
1717import argparse
18+ import datetime
1819import logging
1920import sys
2021import time
@@ -50,7 +51,7 @@ def update_agents(agents: list[Agent]):
5051 time .sleep (update_frequency )
5152
5253
53- def control_camera (camera : Camera ):
54+ def control_camera (camera : Camera , reset_hour = 3 ):
5455 '''Control loop to trigger updating the camera position based on currently
5556 active events.
5657 '''
@@ -59,6 +60,14 @@ def control_camera(camera: Camera):
5960 f'Failed to communicate with camera { camera } ' )
6061 while True :
6162 with error_handler :
63+ # Reset camera to automatic control at the hour
64+ # specified in reset_hour
65+ now = datetime .datetime .now ()
66+ if now .hour == reset_hour and now .minute < 1 :
67+ logger .info (f'It\' s { reset_hour } o\' clock ==> Reset camera'
68+ f' control to \' automatic\' ' )
69+ camera .control = "automatic"
70+ camera .position = - 1
6271 if camera .control == "automatic" :
6372 camera .update_position ()
6473 else :
You can’t perform that action at this time.
0 commit comments