Skip to content

AAST-Triton-ROVs/Pi-Daemons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pi-Daemons

Banner

Repository contains the daemons that are to be run on the raspberry pi for the Triton ROV project.

Overview

Pi-Daemons is a collection of Python services designed to run on Raspberry Pi devices to provide telemetry monitoring, system administration, camera streaming, and hardware communication capabilities for underwater ROV operations. The system is built with modularity in mind, allowing each daemon to run independently and communicate over network protocols.

Core Functionality

1. Pi Telemetry (pi_telemetry)

The telemetry daemon monitors and reports system health metrics in real-time:

  • CPU Usage: Monitors processor utilization percentage
  • CPU Temperature: Reads temperature from thermal sensors
  • RAM Usage: Tracks memory utilization percentage
  • Disk Usage: Monitors storage space utilization
  • GPU Temperature: Reads GPU temperature (Raspberry Pi specific using vcgencmd)
  • Voltage Monitoring: Measures external 5V supply voltage using PMIC
  • Network Communication: Sends telemetry data via UDP packets using binary struct format

The daemon automatically detects if it's running on a Raspberry Pi and adjusts functionality accordingly. Data is transmitted at 2-second intervals to a configurable base station.

2. Camera Streamer (camera_streamer)

Multi-camera streaming service for real-time video transmission:

  • Multi-Camera Support: Automatically detects and initializes available cameras (indices 0-8)
  • Video Configuration: Configurable resolution (960x540), FPS (30), and JPEG quality (80%)
  • Process Architecture: Each camera runs as a separate daemon process for isolation
  • Network Streaming: TCP-based frame transmission with size-prefixed payloads
  • Error Recovery: Automatic camera reconnection on failures
  • V4L2 Integration: Uses Video4Linux2 API for optimal camera control on Linux

3. MNFLTY Router (mnflty_router)

Hardware communication bridge for Arduino/microcontroller integration:

  • Serial Communication: Manages USB/UART connections to Arduino devices
  • Device Detection: Auto-detection of Arduino Nano devices by VID/PID
  • Network Interface: UDP socket for receiving control commands
  • Keep-Alive Protocol: Maintains connection with periodic heartbeat messages
  • Error Handling: Automatic reconnection on serial communication failures
  • Low Latency Mode: Optimizes serial connection for real-time control

4. Pi Admin (pi_admin)

System administration interface (currently in development):

  • Service Management: Framework for controlling system services
  • Network Interface: TCP-based administrative control
  • Service Registry: Manages predefined services including camera-streamer, mnflty-router, mavproxy-router

Architecture

Network Communication

The system uses a hybrid network architecture:

  • UDP: For high-frequency, low-latency data (telemetry, control commands)
  • TCP: For reliable connections (camera streaming, administration)

Configuration

  • Base Station IP: 192.168.1.50 (configurable in constants.py)
  • Local Binding: 0.0.0.0 for all network interfaces
  • Port Assignment: Command-line configurable for each service

Dependencies

  • psutil: System monitoring and process management
  • loguru: Structured logging with color output
  • pyserial: Serial port communication
  • opencv-python: Computer vision and camera operations
  • msgpack: Binary serialization (prepared for future use)

Usage

Each daemon can be run as a standalone service:

# Start telemetry daemon
pi_telemetry 192.168.1.50:5000

# Start camera streamer
camera_streamer 0.0.0.0:8000

# Start MNFLTY router
mnflty_router 0.0.0.0:6000

# Start admin interface
pi_admin 0.0.0.0:7000

Installation

Using Poetry (recommended):

poetry install

Using pip:

pip install -r requirements.txt

Development

The project uses modern Python tooling:

  • Poetry: Dependency management and packaging
  • MyPy: Static type checking
  • Type Hints: Full type annotation coverage for better code reliability

License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0).

GPL-3.0 License Summary

The GPL-3.0 is a strong copyleft license that guarantees end users the freedom to run, study, share, and modify the software. Key points:

  • Freedom to Use: You can use this software for any purpose
  • Freedom to Study: You have access to the source code and can study how it works
  • Freedom to Share: You can redistribute copies of the software
  • Freedom to Modify: You can modify the software and distribute your modifications
  • Copyleft Protection: Any derivative works must also be licensed under GPL-3.0
  • Patent Protection: The license includes explicit patent grant protections

License Terms

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

For the complete license text, please refer to the GNU General Public License v3.0.

About

Contains collection of daemons to be deployed on RPI

Resources

License

Stars

Watchers

Forks

Contributors

Languages