Skip to content

RedWvn/FlightMonitoringSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redwing FMS - (Main Branch) Telemetry Scripts

Prerequisites

  1. Python 3.9.2 (tested), anything 3.10 and above will break!

    If not installed, installation instructions using pyenv:

    sudo apt update
    sudo apt install -y build-essential zlib1g-dev libssl-dev
    sudo apt install -y libreadline-dev libsqlite3-dev \
                        libffi-dev libbz2-dev liblzma-dev
    curl -sS https://webi.sh/pyenv | sh
    source ~/.config/envman/PATH.env
    pyenv install 3.9.2
    pyenv global 3.9.2
    
    # VERIFY 3.9.2
    python -V
  2. GitHub login with access to this repository

    If not set up, instructions:

    # USING GITHUB CLI
    curl -sS https://webi.sh/gh | sh
    gh auth login
    # tested with github.com > https > yes > paste an authentication token
  3. Install venv if not already installed with pyenv:

    sudo apt-get install python3-venv

Setup

Quick Setup

  1. Clone repository:

    git clone https://github.com/RedWvn/FlightMonitoringSystem.git fms
    cd fms
  2. Create a .env file (see .env File)

  3. Complete setup process:

    chmod u+x scripts/setup.sh scripts/restart.sh
    python -m venv .
    pip install -r requirements.txt
    sudo ./scripts/setup.sh --user pi # CHANGE TO YOUR USERNAME
    sudo systemctl start setup_service
    sudo systemctl start telemetry_service

Detailed Setup

  1. Clone this repository:

    # install telemetry branch
    git clone https://github.com/RedWvn/FlightMonitoringSystem.git
    cd telemetry
  2. Allow scripts to execute:

    chmod u+x scripts/setup.sh scripts/restart.sh
  3. Create a python venv to prevent using system pacakges:

    python -V # ensure that it's still 3.9.2
    python -m venv .
  4. Install packages:

    pip install -r requirements.txt
  5. Create a .env file in the project root. Use the .env File section at the bottom of this document to find examples.

  6. Run the setup script:

    sudo ./scripts/setup.sh --user <YOUR_USERNAME>
  7. The setup and telemetry services should automatically start. If they don't, start them with:

    sudo systemctl start setup_service
    sudo systemctl start telemetry_service

    To check status:

    sudo systemctl status <...>

    To view logs:

    sudo journalctl -fu <...>
  8. (optional, but recommended) Test the setup process. If there is an error with sudo permissions in the final step (of restarting), try adding permissions to run systemctl restart telemetry_service to visudo

    Just below root ....., add this line to allow the refresh script to work.

    <YOUR_USERNAME> ALL=(ALL) NOPASSWD: /bin/systemctl restart telemetry_service
    
    ; for example:
    ubuntu ALL=NOPASSWD: /bin/systemctl restart telemetry_service
    
  9. (optional) install cockpit to view processes and memory/CPU usage

    . /etc/os-release
    sudo apt install -t ${VERSION_CODENAME}-backports cockpit

Developing

  1. Follow steps 1 to 6 of Setup

  2. To start the telemetry script, run python telem_delay.py (will work best only when source ./bin/activate is run) The script will connect to the specified drone and MQTT broker, then start publishing telemetry data.

  3. To test the setup script, run python setup.py

.env File

Example .env:

IP_ADDRESS=127.0.0.1:5760
AIRCRAFT_NAME=<CHANGE AIRCRAFT NAME>
MQTT_BROKER=hzn-01
MQTT_PORT=1883
MESSAGES_TO_LISTEN=HEARTBEAT,RANGEFINDER,VFR_HUD,BATTERY_STATUS,ATTITUDE,GLOBAL_POSITION_INT,GPS_RAW_INT,VIBRATION,EKF_STATUS_REPORT,SYS_STATUS,SERVO_OUTPUT_RAW
STATE_IN_MISSION = in_mission
STATE_LANDED = landed
STATE_ON_GROUND = on_ground
REPO_BRANCH=main

# Flight Launch Service Variables
SSID=22
GPS_2=true
BATTERY_CELLS=12
  • IP_ADDRESS: TCP address to connect to the drone.
  • AIRCRAFT_NAME: Aircraft name that shows up in the UI. Has to be unique
  • MQTT_BROKER: Hostname of the MQTT broker server (hzn-01)
  • MQTT_PORT: Port of MQTT broker. Usually 1883
  • MESSAGES_TO_LISTEN: Keep this the same (HEARTBEAT,RANGEFINDER,VFR_HUD,BATTERY_STATUS,ATTITUDE,GLOBAL_POSITION_INT,GPS_RAW_INT)
  • STATE_IN_MISSION, STATE_LANDED, STATE_ON_GROUND: Keep this the same (in_mission, landed, on_ground)
  • REPO_BRANCH: The GitHub branch to track (here, main). Changing this will only cause bugs but will not change the branch being tracked. To change the branch, checkout to the other branch and then change this variable
  • Other .env variables are related to Flight Launch Service

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •