Skip to content

Flight software for the CanSat 'DRIVE' developed by the payload team for the Mach25 competition in 2024/25

Notifications You must be signed in to change notification settings

endeavourrockets/DRIVE-FS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Repo for the Flight Software of the DRIVE Project

This repository contains the final version of the flight fsm used at the Mach25 competition. The software is inspired by the FSM used by the endeavour software team, following similar logic and state transition triggers. Note that the number of states required for payload is reduced compared to the main rocket FSM due to the variation in complexity at each stage.

For ground station software, please refer to the /ground_station folder in the mach25 cansat repo: https://github.com/Janvdk5/mach25-cansat. NOTE: this ground station software may be outdated. Check with @Dom

NOTE: please branch off main if you wish to make versions for upcoming launches to maintain the record of the Mach25 version.

Structure

  • '/bno055' contains the library for the BNO055 IMU. This includes a specific ReadMe with installation instructions and code explanations. Please refer to that for more information.
  • '/states' contains the different states of the FSM as separate files. Each file contains the code for that specific state. NOTE: State transitions after lift off detection are overlapped with hardcoded time delays. This was done to reduce risk of rover activation inside the rocket. You may wish to remove this for future launches.
  • 'subsystems.py' contains the code for the different subsystems of the rover. This includes the buzzer, rover and sampling system. Note that the piezo ML code is not included here due to this software being implemented on seperate hardware within the CanSat. Refer to subsytem ReadMe's for more information.
  • 'constants.py' contains the constants used throughout the code. This currently only locates the FSM states.
  • 'fsm.py' contains the main FSM code. This includes simply the loop that runs the current state and transitions between states. It also includes specific state transition trigger thresholds.
  • 'startscript.sh' is the script that runs on startup of the Raspberry Pi. This simply runs the fsm.py code but note that it is depricated currently.
  • 'transmit.py' contains the code for transmitting data via the LoRa module.
  • 'requirements.txt' contains the required libraries for the code to run. Use pip to install these.

Usage

General

  1. Set up raspi and connect to it via ssh. Refer here for more info: https://www.notion.so/Electronics-Help-1a19e217370880fca59beeeba6c9b726
  2. Clone this repository
  3. Follow instructions in the BNO055 folder to install the BNO055 library.
  4. Create virtual environment. python3 -m venv venv
  5. Activate the venv. source venv/bin/activate
  6. Install required libraries via pip: pip install -r requirements.txt
  7. Follow prompts to clear any remaining issues.

Mach RasPi with current software flashed

  1. ssh into payload@cansat.local, password rover.
  2. cd to Documents
  3. Activate the venv: source venv/bin/activate
  4. Activate GPS socket with gpsd command: sudo gpsd /dev/ttyAMA0 -F /var/run/gpsd.sock
  5. Start the FSM implementation: nohup python fsm.py > fsm_stdout.log 2> fsm_stderr.log &
    • The nohup command allows the process to continue running after logging out or losing ssh connection.
    • The & at the end runs the process in the background, allowing you to continue using the terminal if needed.
    • The fsm_stdout.log and fsm_stderr.log files will contain the standard output and error messages respectively to allow fsm verification
  6. Verify operation by checking the fsm_stdout.log file: tail -f fsm_stdout.log

Common Issues

  • If BNO055 fails to initialize, check connections and ensure I2C is enabled on the raspi.
  • If LoRa fails to initialize, ensure only 1 SPI device is connected.
  • If SSH fails to see the MC, double check there’s not other hotspots active before starting

Notes

  • See Issues for future improvements.
  • Startup sequence is not set up with systemd to run on boot on current hardware. Follow the sequence above and verify with buzzer beeps.

About

Flight software for the CanSat 'DRIVE' developed by the payload team for the Mach25 competition in 2024/25

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published