Skip to content
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
125 changes: 125 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Changelog

Toutes les modifications notables de ce projet sont documentées dans ce fichier.

Le format est basé sur [Keep a Changelog](https://keepachangelog.com/fr/1.0.0/),
et ce projet adhère au [Versioning Sémantique](https://semver.org/lang/fr/) :
`MAJEUR.MINEUR.CORRECTIF`.

- **MAJEUR** : refonte ou rupture de compatibilité
- **MINEUR** : nouvelle fonctionnalité
- **CORRECTIF** : correction de bug ou ajustement mineur

La version courante est également disponible dans [`version.json`](version.json).

## [5.4.4] - 2026-06-10

### Modifié
- `README.rst` : ajout d'une note précisant que le viewer PiCamera n'est disponible
que sur Linux/Raspberry (dépendance `picamera2`).
- Documentation et commentaires nettoyés de références internes peu compréhensibles
hors du contexte de développement.

## [5.4.3] - 2026-06-10

### Corrigé
- Installation impossible sur Windows/macOS : la dépendance `picamera2` (qui tire
`python-prctl`, Linux-only) est désormais conditionnée à Linux via un marqueur
d'environnement (`picamera2; platform_system == "Linux"`). La machine de contrôle
peut installer le plugin (actionneur/détecteur distants) ; le viewer PiCamera
reste disponible sur le Raspberry.

## [5.4.2] - 2026-06-10

### Modifié
- `README.rst` réécrit du point de vue de l'utilisateur du plugin (contrôle d'un
dispositif expérimental via un Raspberry). Mise en avant des trois axes
d'adaptabilité : communication PyMoDAQ ⇄ Raspberry, communication
Raspberry ⇄ composants, et ajout de nouvelles requêtes JSON des deux côtés.

## [5.4.1] - 2026-06-10

### Corrigé
- `CONTRIBUTING.md` : convention de tags alignée sur l'historique du dépôt
(`5.0.0`, `5.0.1`) — les tags de production sont au format `MAJEUR.MINEUR.CORRECTIF`
sans préfixe `v`.

## [5.4.0] - 2026-06-10

### Ajouté
- Documentation du plugin dans `README.rst` : liste des instruments
(`MoveRasp`, `ViewRasp`, `picamera`) et description du serveur Raspberry
(`src_raspberry/`).

### Modifié
- `README.rst` : mise à jour des auteurs et de la version PyMoDAQ requise (>= 5).

### Vérifié
- Conformité à `tests/test_plugin_package_structure.py` (conventions de nommage et
méthodes obligatoires des plugins `DAQ_Move_MoveRasp` et `DAQ_0DViewer_ViewRasp`).

## [5.3.0] - 2026-06-10

### Ajouté
- `hardware/Link_PMQ.py` : client `ZMQLink` (lien ZeroMQ DEALER vers le serveur Raspberry).
- `hardware/Config_Components.py` : lecture des composants (actionneurs/détecteurs)
depuis le fichier de configuration TOML.
- `daq_move_plugins/daq_move_MoveRasp.py` : plugin actionneur `DAQ_Move_MoveRasp`.
- `daq_viewer_plugins/plugins_0D/daq_0Dviewer_ViewRasp.py` : plugin détecteur
`DAQ_0DViewer_ViewRasp`.

### Modifié
- `resources/config_template.toml` : section de configuration `[Raspberry]`.
- `pyproject.toml` : ajout de la dépendance `pyzmq` (requise par `ZMQLink`).
- Le plugin `DAQ_2DViewer_PiCamera` n'est pas modifié.

### Corrigé
- Remplacement des f-strings à guillemets imbriqués identiques (`f"{d["k"]}"`),
valides seulement en Python 3.12+, par une forme compatible Python 3.8+.

## [5.2.0] - 2026-06-10

### Ajouté
- Pilote de capteur `PT-100` (sonde de température via CAN ADS1115), enregistré
dans `SENSOR_DRIVER_REGISTRY` (import de la dépendance Adafruit isolé localement).
- Pilotes d'actionneurs **interchangeables** derrière l'interface `CActuatorDriver`,
sélectionnés par le champ `driver` de la configuration, et enregistrés dans
`ACTUATOR_DRIVER_REGISTRY` :
- `PWM` — pilotage en rapport cyclique ;
- `DIGITAL` — pilotage tout-ou-rien.
- `config_examples/config_pizero.py` : configuration d'exemple d'un banc tout-ou-rien
avec sonde PT100.

### Modifié
- `CActuatorManager` instancie désormais le pilote adapté à chaque actionneur
(au lieu d'un pilotage PWM codé en dur), permettant de mélanger des modes de
pilotage différents sur un même banc.
- `CActuatorConfig` accepte un champ `driver` (défaut `PWM`) ; `pwm_frequency`
devient optionnel (inutile pour les actionneurs tout-ou-rien).
- `config.py` documente le choix du pilote par actionneur.

### Supprimé
- Moniteur de sécurité (`safety_monitor`) : retiré car il lisait des constantes de
configuration inexistantes et n'était jamais démarré par le `main`.

### Corrigé
- Construction de la cartographie des capteurs unifiée dans `HardwareBackend`
(suppression d'une fonction morte aux références non importées).

## [5.1.0] - 2026-06-10

### Ajouté
- `version.json` à la racine (version du projet, SemVer).
- `CHANGELOG.md` et `CONTRIBUTING.md` (stratégie de branches/tags, processus de version).
- Serveur Raspberry dans `src_raspberry/` selon une topologie en couches, chaque
maillon étant une **classe interchangeable** derrière une interface :
- `ITransport` / `ZmqServer` — communication avec le client PyMoDAQ (ZeroMQ) ;
- `IRequestHandler` / `JsonRequestHandler` — décodage et routage des requêtes JSON,
sans aucun accès matériel ;
- `IHardwareBackend` / `HardwareBackend` — communication avec les capteurs et actionneurs ;
- `main.py` — boucle principale qui assemble les trois couches.

### Modifié
- La gestion des requêtes et la communication matérielle sont deux entités distinctes
(`JsonRequestHandler` d'un côté, `HardwareBackend` de l'autre).
- Le transport ZeroMQ est isolé de la logique de framing/décodage des messages.
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Contribuer

## Versioning et notes de version

### Numérotation
Format obligatoire : `MAJEUR.MINEUR.CORRECTIF` (ex. `5.1.0`).

- **MAJEUR** : refonte ou rupture de compatibilité
- **MINEUR** : nouvelle fonctionnalité
- **CORRECTIF** : correction de bug ou ajustement mineur

La version courante est portée par [`version.json`](version.json) à la racine du projet.

### Fichier `CHANGELOG.md`
- Présent à la racine, mis à jour à **chaque** modification livrée.
- Une entrée par version, avec les sections : `Ajouté`, `Modifié`, `Corrigé`,
`Supprimé`, `Sécurité`.
- Aucun merge en production sans mise à jour du `CHANGELOG.md`.

### Branches Git
- `main` : version en production
- `develop` : version en cours
- `feature/nom-court` : nouvelles fonctionnalités
- `hotfix/nom-court` : correctifs urgents

### Tags
- Tag Git obligatoire à chaque déploiement en production (ex. `5.1.0`),
aligné sur `version.json` et sur la convention de l'historique (sans préfixe `v`).
103 changes: 94 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,39 @@ Raspberry plugin
:target: https://github.com/PyMoDAQ/pymodaq_plugins_raspberry/actions/workflows/Test.yml


Set of instrument plugins to be used from or on your Raspberry Pi
PyMoDAQ plugin to control an experimental device (or test bench) through a
Raspberry Pi.

A small server runs **on the Raspberry Pi** and drives the components of the
device (sensors, actuators); PyMoDAQ talks to that server over the network. From
PyMoDAQ you then get a detector (to read the sensors) and an actuator (to drive
the outputs) as if they were local instruments.


Authors
=======

* Sebastien J. Weber (sebastien.weber@cnrs.fr)
* Fabien Villedieu


Instruments
===========

Below is the list of instruments included in this plugin

Actuators
+++++++++

* **MoveRasp**: drive the outputs of the device (e.g. PWM or all-or-nothing
actuators) wired to the Raspberry

Viewer0D
++++++++

* **ViewRasp**: read the sensors of the device (e.g. I2C sensors) wired to the
Raspberry

Viewer1D
++++++++

Expand All @@ -41,21 +61,86 @@ Viewer1D
Viewer2D
++++++++

* **picamera**: control of the integrated pi camera using the Picamera2 library
* **picamera**: control of the integrated pi camera using the Picamera2 library.
This viewer relies on ``picamera2``, which is **only available on Linux/Raspberry**
(it depends on a Linux-only package). On a Windows/macOS control machine the
plugin still installs and works for the remote actuator/detector, but the
PiCamera viewer is simply not loaded.

.. if needed use this field

PID Models
==========
Adapting the plugin to your setup
=================================

Beware: some plugins are meant to be used with PyMoDAQ installed on the Raspberry directly:

* **daqhats**
* **picamera**

Some other are using the raspberry and the components plugged on it as an external DAQ connected to a computer.
The computer and the Raspberry communicate over ZMQ:

* **MoveRasp**
* **ViewRasp**


ZMQ plugins
===========

Extensions
==========
Communication
+++++++++++++

The plugin is built to be adapted to a wide range of benches. Three things can be
changed independently:

* **The PyMoDAQ ⇄ Raspberry communication.** It uses a ZeroMQ link by default,
but the transport is isolated behind a dedicated layer: it can be replaced by
another communication mean (serial, HTTP, ...) without touching the rest. On the
Raspberry side, implement the transport interface (``ITransport``) and wire it in
``main.py``; on the PyMoDAQ side, provide a class exposing the same methods as
``ZMQLink`` (``hardware/Link_PMQ.py``).

* **The Raspberry ⇄ components communication.** Each sensor and each actuator is
driven by an interchangeable driver selected from the bench configuration
(``src_raspberry/config.py``). Adding a new component is just a matter of writing
a small driver class and registering it:

- a new sensor → a class in ``src_raspberry/hardware/sensors.py`` registered in
``SENSOR_DRIVER_REGISTRY``;
- a new actuator control mode → a class in ``src_raspberry/hardware/actuators.py``
registered in ``ACTUATOR_DRIVER_REGISTRY`` (``PWM`` and ``DIGITAL`` are provided).

* **The set of JSON requests.** The PyMoDAQ side and the Raspberry side exchange
JSON messages, and new request types can be added easily on both ends:

- **Raspberry side**: add an entry to the routing table ``_requestHandlers`` in
``src_raspberry/handlers/json_handler.py`` with its handler method, which
delegates any hardware access to the hardware backend (``IHardwareBackend``);
- **PyMoDAQ side**: add a method to ``ZMQLink`` (``hardware/Link_PMQ.py``) that
builds and sends the new request, then call it from the move/viewer plugins.


Raspberry-side server
+++++++++++++++++++++

The code that must run on the Raspberry Pi lives in the ``src_raspberry/`` folder
at the root of this repository. It is organised in independent layers — network
transport, JSON request handling, and hardware communication — each behind an
interface, which is what makes the points above easy to adapt. See
``src_raspberry/README.md`` for installation and the JSON protocol.


Installation instructions
=========================
+++++++++++++++++++++++++

* PyMoDAQ’s version >= 5
* Tested on/with a raspberry pi 4
* On a Windows/macOS control machine the plugin installs as is; the ``picamera2``
dependency (Linux-only) is automatically skipped, so only the PiCamera viewer is
unavailable there.
* The Raspberry-side server requires the I2C bus and the ``pigpio`` daemon
(see ``src_raspberry/README.md``).


OnRaspberry Plugins
===================
* PyMoDAQ’s version >= 5

6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ name = "pymodaq_plugins_raspberry"
description = 'Set of instrument plugins to use with a raspberry'
dependencies = [
"pymodaq>=5.0.0",
'picamera2',
'pyzmq',
# picamera2 ne s'installe que sur Linux/Raspberry (il dépend de python-prctl,
# Linux-only). Sur la machine de contrôle (Windows/macOS), le plugin reste
# installable ; seul le viewer PiCamera est alors indisponible.
'picamera2; platform_system == "Linux"',
]

authors = [
Expand Down
Loading