Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/control-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry==1.7.1
run: pipx install poetry==2.1.2

- name: Set up Python
uses: actions/setup-python@v5
Expand All @@ -43,7 +43,8 @@ jobs:
- name: Install build dependencies
run: |
sudo apt-get install -y libcap-dev
poetry -C ./control/ install --with dev,hw-dev --no-root
poetry -C ./control/ install --with dev --no-root

- name: Run checks
run: poetry -C ./control/ run poe --root ./control/ check
working-directory: ./control
run: poetry run poe check
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ This repository contains the PlanktoScope's backend software services implementi
- Data processing: transforms raw data into processed data for downstream analysis and quantification. Currently, data processing functionality consists of:
- [Object isolation and segmentation](./processing/segmenter/README.md): detects objects from camera frames and creates an image for each isolated object, with the background removed.

## Usage

TBD

## Licensing

Except where otherwise indicated, source code provided here is covered by the following information:
Expand Down
8 changes: 5 additions & 3 deletions control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ However, the organization of the source code does not yet reflect the organizati

Currently the hardware controller can only be deployed as part of the distro setup scripts at [github.com/PlanktoScope/PlanktoScope](https://github.com/PlanktoScope/PlanktoScope).

Please note that for camera we rely on the Raspberry OS packages `python3-picamera2` and `python3-libcamera`.

### Development

To install all dependencies including development tooling, run:
```
poetry install --with dev,hw-dev --no-root
poetry install --with dev --no-root
```

Then you can run the code auto-formatter on the project by running:
Expand Down Expand Up @@ -51,8 +53,8 @@ needed.

To use this project, you'll need:

- Python 3.9
- Poetry 1.4.2
- Python >= 3.9
- Poetry 2.1.2

## Licensing

Expand Down
2 changes: 1 addition & 1 deletion control/planktoscopehat/planktoscope/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Register(enum.IntEnum):

def __init__(self):
# The led is controlled by LM36011
# but on version < 2 of the PlanktoScope hat (for example PlanktoScope v2.6)
# but on version 1.2 of the PlanktoScope HAT (PlanktoScope v2.6)
# the circuit is connected to that pin so it needs to be high
# pin is assigned to self to prevent gpiozero from immediately releasing it
self.__pin = DigitalOutputDevice(pin=18, initial_value=True)
Expand Down
862 changes: 603 additions & 259 deletions control/poetry.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions control/poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[virtualenvs.options]
system-site-packages = true
45 changes: 12 additions & 33 deletions control/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,42 +33,20 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry.dependencies]
python = ">=3.9.2"
paho-mqtt = "~1.6.1"
loguru = "~0.5.3"
readerwriterlock = "~1.0.9"
paho-mqtt = "^1.6.1"
loguru = "^0.5.3"
readerwriterlock = "^1.0.9"

[tool.poetry.group.hw.dependencies]
rpi-gpio = "~0.7.0"
adafruit-blinka = "~8.19.0"
adafruit-circuitpython-motorkit = "~1.6.3"
adafruit-circuitpython-motor = "~3.3.1"
adafruit-ssd1306 = "~1.6.2"
adafruit-platformdetect = "~3.45.2"
smbus2 = "~0.4.1"
spidev = "~3.5"
rpi-gpio = "^0.7.0"
adafruit-blinka = "^8.19.0"
adafruit-circuitpython-motorkit = "^1.6.3"
adafruit-circuitpython-motor = "^3.3.1"
adafruit-ssd1306 = "^1.6.2"
adafruit-platformdetect = "^3.45.2"
smbus2 = "^0.4.1"
spidev = "^3.5"
gpiozero = "^2.0.1"
# Note: the following packages are only indirect dependencies, but we need to download wheels from
# the appropriate sources, so we must explicitly select them here
rpi-ws281x = "~5.0.0"
sysv-ipc = "~1.1.0"

[tool.poetry.group.hw-dev]
optional = true

# Note: the following packages are only indirect dependencies of picamera2, and on the RPi we use
# the system's installation of them (managed by apt-get) because poetry tries to build them from
# source instead of installing the armv7l wheels. Maybe poetry is messing up at detecting the
# machine platform or something.
[tool.poetry.group.hw-dev.dependencies]
# v1.19.5 (the version from the RPi on bullseye) fails to install in GitHub Actions, so we just use
# the latest version and hope that the differences won't be significant enough to cause a mismatch
# between CI and the production environment (i.e. the RPi):
picamera2 = "==0.3.12"
numpy = "~1.26.4"
pidng = "~4.0.9"
simplejpeg = "~1.6.4"
pillow = "~10.2.0"
av = "~10.0.0"

[tool.poetry.group.dev]
optional = true
Expand All @@ -84,6 +62,7 @@ flake8-import-restrictions = "^2.0.1"
pylint = "^3.1.0"
pylint-google-style-guide-imports-enforcing = "^1.3.0"
types-paho-mqtt = "^1.6.0.20240106"
picamera2 = "^0.3.25"

[tool.black]
# We are gradually introducing standard formatting as we rewrite each module; we haven't rewritten
Expand Down
2 changes: 1 addition & 1 deletion processing/segmenter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ WORKDIR /home/pi/device-backend/processing/segmenter
COPY --chown=pi:pi pyproject.toml poetry.lock ./
RUN \
export PATH="/home/pi/.local/bin:$PATH" && \
pip install --no-cache-dir cryptography==43.0.3 poetry==1.7.1 \
pip install --no-cache-dir cryptography==43.0.3 poetry==2.1.2 \
--extra-index-url https://www.piwheels.org/simple && \
poetry install --no-root --only main --compile && \
poetry --no-interaction cache list && \
Expand Down
7 changes: 7 additions & 0 deletions processing/segmenter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ Currently, the simplest way to deploy the segmenter on any computer is using the

TBD

### Prerequisites

To use this project, you'll need:

- Python >= 3.9
- Poetry 2.1.2

## Licensing

Except where otherwise indicated, source code provided here is covered by the following information:
Expand Down
Loading