Skip to content

Commit

Permalink
Configure famerate
Browse files Browse the repository at this point in the history
  • Loading branch information
xeonqq committed Mar 17, 2024
1 parent baf0f48 commit b03e043
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/camera_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, camera, led, recording_folder, daemon=True):
self._thread = threading.Thread(target=self.run, daemon=True)
self._thread.start()

@property #fixme
@property
def fps(self):
return self._camera.video_configuration.controls.FrameRate

Expand Down
4 changes: 4 additions & 0 deletions src/copilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ def stop(self):

def run(self):
prev_cycle_time = time.perf_counter()
while(True):

logging.debug("run")
pass
for image, image_time in iter(self._pubsub.get, None):
current_cycle_time = time.perf_counter()
# logging.debug("image time diff: %.2f ms" % ((current_cycle_time-image_time)*1000))
Expand Down
9 changes: 4 additions & 5 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,17 @@ def main():

blackbox = BlackBox(image_saver)

logging.debug("before camera")
camera = Picamera2()


main_stream = {"size": camera_info.resolution}
lores_stream = {"size": inference_config.inference_resolution}
video_config = camera.create_video_configuration(main_stream, lores_stream, encode="main")
camera.configure(video_config)
camera.video_configuration.controls.FrameRate = 20.0

logging.debug("configure camera done, fps: {}".format(camera.video_configuration.controls.FrameRate))

camera.set_controls({"FrameRate": 20})
metadata = camera.capture_metadata()
logging.info("metadata")
logging.info(metadata)

#camera.framerate = 20
#camera.exposure_mode = "sports"
Expand Down

0 comments on commit b03e043

Please sign in to comment.