simulation

This commit is contained in:
2026-05-05 14:59:09 +02:00
parent 5c78c042a4
commit d946de7b63
5 changed files with 15 additions and 30 deletions
+1 -1
View File
@@ -11,4 +11,4 @@ cargo --version
rustc --version rustc --version
cargo install reductstore cargo install reductstore
mkdir -p $HOME/medias mkdir -p $HOME/reduct-media
+3 -3
View File
@@ -1,12 +1,12 @@
[program:reductstore] [program:reductstore]
process_name=%(program_name)s process_name=%(program_name)s
priority=10 priority=10
environment=RS_DATA_PATH="/home/rpi4/medias" environment=RS_DATA_PATH="/home/rpi4/reduct-media"
directory=/home/rpi4/medias directory=/home/rpi4/reduct-media
command=/home/rpi4/.cargo/bin/reductstore command=/home/rpi4/.cargo/bin/reductstore
user=rpi4 user=rpi4
group=rpi4 group=rpi4
stopasgroup=true stopasgroup=true
stopsignal=SIGINT stopsignal=SIGINT
autostart=true autostart=true
autorestart=true autorestart=true
+2 -13
View File
@@ -38,7 +38,6 @@ class VideoFileCapture(VideoCaptureInterface):
jpeg_quality: int = 85, jpeg_quality: int = 85,
width: Optional[int] = None, width: Optional[int] = None,
height: Optional[int] = None, height: Optional[int] = None,
video_lists = [],
use_tracking: bool = False, use_tracking: bool = False,
display = None, display = None,
parent = None, parent = None,
@@ -55,28 +54,18 @@ class VideoFileCapture(VideoCaptureInterface):
self._jpeg_quality: int = jpeg_quality self._jpeg_quality: int = jpeg_quality
self._width: Optional[int] = width self._width: Optional[int] = width
self._height: Optional[int] = height self._height: Optional[int] = height
self._video_lists = video_lists
self.ptf = 0
self._cap = None # Instance cv2.VideoCapture self._cap = None # Instance cv2.VideoCapture
def get_file(self): def set_video_file(self, vf):
if self._video_lists: self._video_file = vf
self._video_file = self._video_lists[self.ptf]
self.ptf += 1
if self.ptf >= len(self._video_lists):
self.ptf = 0
return self._video_file return self._video_file
# ------------------------------------------------------------------ # ------------------------------------------------------------------
# Implémentation des méthodes abstraites # Implémentation des méthodes abstraites
# ------------------------------------------------------------------ # ------------------------------------------------------------------
def open(self) -> None: def open(self) -> None:
"""Ouvre le flux V4L2 via OpenCV et configure la résolution.""" """Ouvre le flux V4L2 via OpenCV et configure la résolution."""
self.get_file()
self._cap = cv2.VideoCapture(self._video_file) self._cap = cv2.VideoCapture(self._video_file)
if not self._cap.isOpened(): if not self._cap.isOpened():
+7 -2
View File
@@ -172,11 +172,16 @@ class MultiWellManager:
if self.stop_playing.is_set(): if self.stop_playing.is_set():
break break
self.cnc_controller.move_to(wl.x, wl.y, feed=wl.multiwell.feed) self.cnc_controller.move_to(wl.x, wl.y, feed=wl.multiwell.feed)
self._grid_scanning_capture(experiment, wl, simulate=simulate)
## change file ## change file
if self.process.conf.capture_type == 'file': if self.process.conf.capture_type == 'file':
self.process.cam._error_occured = True vf = settings.MEDIA_ROOT / 'simulation' / f'{wl.name}.mp4'
if vf.exists():
self.process.cam._video_file = str(vf)
self.process.cam._error_occured = True
self._grid_scanning_capture(experiment, wl, simulate=simulate)
logger.info(f"Scan terminé — retour à l'origine (X={xnext:.1f} Y={ynext:.1f})") logger.info(f"Scan terminé — retour à l'origine (X={xnext:.1f} Y={ynext:.1f})")
self.cnc_controller.move_to(xnext, ynext, feed=multiwell.feed*2) self.cnc_controller.move_to(xnext, ynext, feed=multiwell.feed*2)
+2 -11
View File
@@ -27,7 +27,7 @@ from modules import reductstore, grbl, utils, planarian_metrics
from modules.circular_crop import CircularCrop, CropStrategy from modules.circular_crop import CircularCrop, CropStrategy
from .multiwell import MultiWellManager from .multiwell import MultiWellManager
from .constants import ScannerConstants from .constants import ScannerConstants
from . import models #from . import models
@dataclass @dataclass
@@ -183,17 +183,9 @@ class ScannerProcess(Task):
capture_type = self.conf.capture_type capture_type = self.conf.capture_type
if capture_type == 'file': if capture_type == 'file':
video_lists = []
wells = models.Well.objects.all()
for wl in wells:
if exists := (settings.MEDIA_ROOT / 'simulation' / f'{wl.name}.mp4').exists():
video_lists.append(str( settings.MEDIA_ROOT / 'simulation' / f'{wl.name}.mp4') )
from modules.videofile_capture import VideoFileCapture from modules.videofile_capture import VideoFileCapture
self.cam = VideoFileCapture( self.cam = VideoFileCapture(
video_file=settings.MEDIA_ROOT / 'simulation' / 'A1.mp4', video_file=settings.MEDIA_ROOT / 'simulation' / 'default-simulation.mp4',
fps=self.video_fps, fps=self.video_fps,
width=self.video_width, width=self.video_width,
height=self.video_height, height=self.video_height,
@@ -201,7 +193,6 @@ class ScannerProcess(Task):
use_tracking=self.use_tracking, use_tracking=self.use_tracking,
display=self._display, display=self._display,
parent=self, parent=self,
video_lists=video_lists,
) )
elif capture_type == 'webcam': elif capture_type == 'webcam':
from modules.webcam_capture import WebcamCapture from modules.webcam_capture import WebcamCapture