Skip to content

Custom Python multiprocessing architecture for the FOKA USV onboard system. Handles sensor acquisition, data logging, and LoRa telemetry. Project migrated to ROS 2.

Notifications You must be signed in to change notification settings

antpial/Telemetry_architecture

Repository files navigation

FOKA USV - Onboard Embedded System (Legacy) 🛥️

⚠️ PROJECT STATUS: SUSPENDED / ARCHIVED

Development of this custom Python architecture has been halted. The entire software stack for the FOKA autonomous boat has been migrated to the ROS 2 (Robot Operating System 2) framework to ensure better scalability, modularity, and industry-standard communication.

This repository remains available for historical reference and to demonstrate the custom multiprocessing architecture developed prior to the ROS 2 migration.

📖 Project Overview

The main goal of this project was to design a robust system for acquisition, storage, and transmission of measurement data from the FOKA research USV (Unmanned Surface Vehicle). The boat is equipped with a specific array of sensors that must collect data simultaneously at a fixed frequency.

Key design principles included reliability and flexibility. Beyond raw data collection, the system handles:

  • Data Timestamping & Pre-processing: Preparing raw signals for analysis.
  • Local Storage: Saving data to the onboard SD card via dedicated processes.
  • Telemetry: Transmitting vital statistics to the Ground Control Station via LoRa.

🏗️ System Architecture

To utilize the onboard computer's resources efficiently and ensure that a failure in one module does not crash the entire system, the architecture relies heavily on Python's multiprocessing.

1. Data Flow Strategy

Each sensor (e.g., pH sensor, thermometer) is handled by a dedicated pair of processes:

  1. Driver Process: Connects to the hardware and acquires data.
  2. Saver Process: Writes data to the hard drive (SD card).

A single, shared Telemetry Process handles long-range communication for all sensors.

System Data Transfer Diagram Fig. 1: Simplified data transfer diagram for a 2-sensor setup.

2. Process Communication: Driver ↔ Saver

Since data acquisition and storage are tightly coupled, they are managed by a common parent script (sensor_main.py).

  • Mechanism: The parent process creates a multiprocessing.Queue and passes it to both children upon spawning.
  • Benefit: Low overhead and simple synchronization. The parent process terminates immediately after spawning children to save resources.

Driver to Saver Communication Fig. 2: Direct queue passing between sibling processes.

3. Process Communication: Driver ↔ Telemetry

Telemetry is a global service, decoupled from individual sensors.

  • Mechanism: A Queue Manager (from multiprocessing.managers.BaseManager) acts as a localhost server (procesManager.py).
  • Producer: Sensor drivers connect to the manager's port and put() data.
  • Consumer: The telemetry module connects to the same port and get() data.
  • Benefit: Decoupling. If the LoRa radio fails, the manager remains active. It also allows external debugging tools to connect to the queue over the network (Wi-Fi/Ethernet) to inspect real-time data flow manually.

Driver to Telemetry Communication Fig. 3: Server-based queue management for telemetry.

4. Process Hierarchy

The system creates a "family tree" of processes. The "lightning bolt" in the diagram below indicates processes that spawn children and then terminate (fire-and-forget).

Process Family Tree Fig. 4: Process genealogy.

🚀 How to Launch

Prerequisites

  • Python 3.x
  • Required Python libraries (see requirements.txt if available)
  • Configured hardware (or simulation mode)

1. Start the Telemetry Server

First, launch the telemetry manager which acts as the data hub. From the architecture directory:

python3 -m Telemetry.telemetry

Wait ~10 seconds for all managers to initialize.

2. Start Sensor Modules

Open a new terminal. Use the launcher.sh script to spawn sensor processes. You must specify the configuration file for the target sensor:

# Example for pH sensor
./launcher.sh ph_config.yml

This executes sensor_main.py using the specified config.

3. Stopping the System

To shut down the system, run the terminator script:

python3 terminator.py

Note: If the script fails to kill all detached processes, use:

pkill python3

📋 Legacy TODO List (Status at Freeze)

The following tasks were in the backlog before the project was archived in favor of ROS 2:

  • Refine sensor driver code for edge cases.
  • Move hardcoded logging configurations to the main config file.
  • Append system health logs to telemetry packets.
  • Extend logging coverage to auxiliary modules (outside the main driver).
  • Final integration tests with physical LoRa hardware and RPi power management.
  • Verify analog data acquisition using a potentiometer as a mock sensor.

About

Custom Python multiprocessing architecture for the FOKA USV onboard system. Handles sensor acquisition, data logging, and LoRa telemetry. Project migrated to ROS 2.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published