Skip to content

StudentOrganisationForAerospaceResearch/RocketControlUnit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rocket Control Unit

Python 3 Raspberry Pi Git Git Git Git Git

Table of Contents

Description

This is the repository for the rocket control unit. This software allows us to interface with our ground systems and rocket through an easy to use and functional dashboard.

The backend runs on a raspberry pi 5 and uses python. the raspberry pi is connected through UART and GPIO to the RCU-STM PCB.

The frontend is built on SvelteKit and Skeleton for UI components. Svelte is a compiled framework allowing for maximum performance.

To connect the backend to the frontend we use a self-hosted instance of PocketBase. PocketBase is a real-time database allowing for instant telemetry and commands. This also allows us to store all telemetry and analyze or process the data later on.

Technology Stack

Svelte

Svelte is a modern JavaScript framework designed to build user interfaces. Unlike traditional frameworks that shift much of the work to the browser, Svelte shifts this burden to the build step, resulting in highly optimized and performant applications. With its reactive approach, Svelte simplifies complex UI development by efficiently updating the DOM without unnecessary runtime overhead.

Python

Python is a versatile and widely-used programming language known for its readability and ease of use. Python's extensive libraries and frameworks, coupled with its straightforward syntax, make it great for our needs.

PocketBase

PocketBase is a real-time database designed for seamless data synchronization between applications. By providing a self-hosted instance, it offers us the flexibility to maintain control over out data while ensuring instant updates and efficient communication between backend and frontend. PocketBase is particularly useful for our application requiring real-time telemetry, command execution, and data storage.

Skeleton

Skeleton is a lightweight CSS framework that provides a simple and responsive foundation for web development. It offers a set of styles for common HTML elements, making it easy to create clean and consistent user interfaces. While not as feature-rich as some larger frameworks, Skeleton is ideal for our use case where a minimalistic approach to styling and responsiveness is desired.

Raspberry Pi

Raspberry Pi is a small, single-board computer running a version of Debian. The Raspberry Pi 5, in particular, is equipped with sufficient processing power and connectivity options. The Raspberry Pi serves as the backend infrastructure for the Rocket Control Unit in this project, connecting to the RCU and Flight PCBs.

Dependencies

You will need Python 3.11 or greater. You will need a PocketBase binary for your specific OS. Svelte dependencies are inside the package.json Python dependencies are inside the requrements.txt

Installation Guide

  • Clone repository

    git clone https://github.com/StudentOrganisationForAerospaceResearch/RocketControlUnit.git
    cd RocketControlUnit
  • Database Setup

    • Download PocketBase Binary

    • Move PocketBase Binary

      • Move the PocketBase binary to the database directory of the RocketControlUnit project. Replace path_to_pocketbase_binary with the actual path of the PocketBase binary on your system:

        mv path_to_pocketbase_binary RocketControlUnit/database/
    • Hosting Database

      cd RocketControlUnit/database/
      ./pocketbase serve

      Now enter the Admin UI URL into a browser and create a PocketBase account.

      You will now be able to access the PocketBase admin dashboard

  • Backend Setup

    cd RocketControlUnit/backend
    pip install -r requirements.txt
  • Frontend Setup

    cd RocketControlUnit/RocketControlUnitGUI/
    npm install

    To run an instance for development:

    npm run dev

    To build for production using the node adapter:

    npm i -D @sveltejs/adapter-node

    NOTE: You may have to run the above with --force or --legacy-peer-deps.

    npm run build
    npm ci --omit dev

    NOTE: You may have to run the above with --force or --legacy-peer-deps.

    node build

    By default, the server will accept connections on 0.0.0.0 using port 3000. These can be customised with the PORT and HOST environment variables:

    HOST=127.0.0.1 PORT=4000 node build

    To preview the app:

    npm run build
    npm run preview

    NOTE: For testing state transition locally you must uncomment this line in src/routes/+page.svelte

    nextState(nextStatePending);

TODO

  • General
    • Add secrets.ini for db URL
    • Need to add heartbeat
  • RaspberryPi
    • Add script to run backend on startup
  • Backend
    • Fix PBV4 Proto
    • Fix GPS showing NULL
    • Fix system state proto
    • Fix PBV3 telemetry issue
    • Fix launch rail load cell telemetry
    • Finish serial handler
    • Finish database handler
    • Add backend handler thread
    • Add loadcell calibration and tare
    • Look into overhauling the threading system
    • In the backend handler thread add an error handling or a push error to db table.
    • In the backend handler we could also have a status table method which can keep track of threads life and other system status information
    • Overhaul logging system to allow for using different log levels, switching log levels and having the logs possibly be handled by one thread, maybe not even the backend thread but possibly a different logging thread.
    • Update DB URL.
    • Cython
  • Database
    • Add LoadCellCommands Table
    • Remove Unused fields
  • Frontend
    • Finish Background Creation
    • Move Components in Place
    • Add Loadcell Calibration
    • Add Fluid Flow Animation
    • Add Authentication
    • Add Test State
    • Tie Ignitors
    • Verify Correct State on Refresh
    • Figure Out Deployment
  • Integration Test