Skip to content

Feature/timelapse#4

Draft
ArthurLuciani2 wants to merge 2 commits intodevelopfrom
feature/timelapse
Draft

Feature/timelapse#4
ArthurLuciani2 wants to merge 2 commits intodevelopfrom
feature/timelapse

Conversation

@ArthurLuciani2
Copy link
Collaborator

Adding timelapse scan functionality following the plan:

Plant-Imager3: Time-Lapse

Objectives

Here are the various objectives expected for the Plant-Imager to perform a time-lapse reconstruction:

  1. Capture at fixed intervals or at fixed dates the subject
  2. Being able to configure a time-lapse via the webui
  3. Do not accept new time-lapse order while one is running
  4. Resume current time-lapse in case of restart of the plantimager-app
  5. Switch on and off various part of the Plant-Imager as they are required or not
  6. Warn the user in case of faillure and cause of faillure
  7. Warn the user when a time-lapse ends

Auxillary objectives:

  • Adapt plantdb for time-lapses (multiple filesets ?)

Plan

1. time-lapse

New Scan and TimeLapse class

A TimeLapse represents the process of capturing the subject and consists of one or multiple Scan. The Scanner effectuate the scan of the plant through the TimeLapse class and can only have one TimeLapse at a time (3.).

A Scan is a 3D capture of the plant at a given time, moving through the path once and captures by the cameras at each point.

The current status (no time-lapse) is one TimeLapse which does one Scan.

Each Scan is time-coded for the start time, finish time then recorded.

The Scanner wakes up the machine (5.) before a Scan is due and starts it on time (1.).

When a Scan is finished the Scanner evaluates if the next Scan (if there is one) is scheduled to take place less than a set ammount of time later. If True the scanner remains on standby. If False, the Scanner powers down the CNC and turn down the lights or switch to growth lights depending on the time and the parameters of the TimeLapse (5.)

Current Scan recovery

The current Scan configuration is stored in a JSON file on the disk in a non-temporary folder. On startup, the plantimager-app checks this file to see if a scan was already in progress. If it is the case the scan is loaded back and resumed. (4.)

Interface

When a Scan is configured a new interface is created where its configuration can be reviewed. The information displayed include the path configured and the various time-points planned. The time-points already executed are marked as completed.

On the main interface in the scanner area (bottom left), the current (planned) timestamp is displayed during a capture, otherwise the next timestamp and the time to said timestamp.

A secondary progress-bar is displayed to represent the progression of the number of Scans

Webui

New sections in the configuration toml (2.):

  • timelapse
    • mode ["interval", "fixed_times", "one_shot"]
    • interval
    • grace_period
    • warmup_period
    • time-points
  • light-control
  • email (to warn the user in case of failure (6. 7.))

optionaly: create a configuration wizard

2. hardware

The main changes in hardware are done to allow the plant-imager controller (RasPi) to turn on and off various part of the scanner (cnc, lights, growth lights). This is done to allow coordination and power-savings (5.).

The power supply of the different parts must be seperated.

For switching the different parts a two stage design is used. The first stage is a low-voltage relay board that is controlled by the plant-imager controller through the GPIO pins. This first stage then controls the second stage, each relay controlling a high(er)-voltage power relay.

Additionnal change of the led bands possible.

  • electro-magnet lock for the door when Scan is running

…ntralize scanning functionality:

  - Introduced `Scan` class to manage scanning operations, including path execution, image capture, and metadata handling.
  - Added `DataUploader` to handle asynchronous upload of scan data to `PlantDB` with queuing and threading support.
  - Integrated `TimeLapse` class to schedule and coordinate multiple scans with configurable modes and timings.
  - Implemented `PowerManager` to manage power control for CNC and lights.
- Enhanced `grbl.py` and `dummy_cnc.py` to support standby state (`_standby`) for CNC operations.
- Updated `pyproject.toml` to include the `gpio` dependency.
- Improved `hal.py` to define `ready` and `standby` properties for abstract CNC interfaces.
  - Added callback-based `activity_monitor` to `PowerManager` for watching CNC activity and handling timeouts.
  - Introduced GPIO pin configurations for CNC, lights, and growth lights in `PowerManager`.
  - Implemented structured power-on/off methods for CNC, lights, and growth lights with GPIO control.
  - Improved GRBL configuration in `grbl.py` to skip sending unchanged settings for efficiency.
  - Added `parse_duration` utility to handle and convert duration strings into `datetime.timedelta`.
  - Updated `TimeLapse` to support dynamic path imports, improved scan scheduling, and metadata initialization.
  - Refactored `TimeLapse` to better manage scan intervals, fixed timings, and number of scans.
@ArthurLuciani2 ArthurLuciani2 self-assigned this Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant