Skip to content

Commit

Permalink
Make image history length configurable (#202)
Browse files Browse the repository at this point in the history
* feat: reduce default number of images stored in `Camera` to 4

* replace MAX_IMAGES with a default parameter

* Update rosys/vision/camera/camera.py

Co-authored-by: Falko Schindler <falko@zauberzeug.com>

* dont save image_history_length

---------

Co-authored-by: Pascal Schade <pascal@zauberzeug.com>
Co-authored-by: Pascal Schade <165774906+pascalzauberzeug@users.noreply.github.com>
Co-authored-by: Falko Schindler <falko@zauberzeug.com>
  • Loading branch information
4 people authored Sep 26, 2024
1 parent 08727be commit 7bd4e89
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rosys/vision/camera/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class Camera(abc.ABC):
MAX_IMAGES = 256

def __init__(self,
*,
Expand All @@ -26,12 +25,13 @@ def __init__(self,
streaming: bool = True,
polling_interval: float = 0.1,
base_path_overwrite: str | None = None,
image_history_length: int = 256,
**kwargs) -> None:
super().__init__(**kwargs)
self.id: str = id
self.name = name or self.id
self.connect_after_init = connect_after_init
self.images: deque[Image] = deque(maxlen=self.MAX_IMAGES)
self.images: deque[Image] = deque(maxlen=image_history_length)
self.base_path: str = f'images/{base_path_overwrite or id}'

self.should_stream: bool = streaming
Expand Down Expand Up @@ -94,6 +94,7 @@ def to_dict(self) -> dict:
'name': self.name,
'connect_after_init': self.connect_after_init,
'streaming': self.should_stream,
'image_history_length': self.images.maxlen,
}

@classmethod
Expand Down

0 comments on commit 7bd4e89

Please sign in to comment.