Giter Club home page Giter Club logo

tars-software's Introduction

TARS Flight Software Repository

Illinois Space Society's flight software codebase for the TARS system.


Click to see a cool video!

Directory Structure:

  • TARS/: Mission critical flight software running on TARS. This is the code that actually flies on the rocket
    • src/: All the flight code that we write ourselves is in this directory.
      • common/: Utility code we write that is used across microcontrollers.
      • mcu_main/: Code for the primary microcontroller on TARS (Teensy 4.1)
      • mcu_telemetry/: Code for the microcontroller in charge of telemetry and GPS (ESP32-S3)
      • mcu_power: Code for the microcontroller on the power board (ATMega328P)
    • lib/: Third-party libraries that are not available on the PlatformIO Registry. Other libraries are included via the lib_deps build flag in platformio.ini
  • ground/: Code running on ground station hardware (Adafruit LoRa Feather)

Branch Naming Convention

Please use the following naming conventions when creating branches while developing:

Your <branch-name> should consist of the Trello ticket ID and a short description of the work being done. For example:

AV-420-write-cp-location-interpolation-function

Then use the following scheme to then organize your branches:

  • <branch-name> for small and simple contributions pertaining to a ticket
  • user/<github-username>/<branch-name> for individual tasks or contributions, or as a sandbox for yourself
  • feature/<branch-name> for new functionality that didn't exist before
  • bug/<branch-name> for bug fixes
  • general/<branch-name> for overall repository organization or development pipeline tweaks
  • misc/<branch-name> or junk/<branch-name> for just messing around :)

Some fictional examples:
user/AyberkY/improve-lsm9ds1-spi-latency
feature/create-mcu-state-estimation-thread
bug/gps-thread-deadlock-fix
general/create-new-directory-for-gnc
misc/testing-sd-card-bandwidth

Please include the Trello ticket ID when relevant! i.e. for a ticket [AV-69] your branch might look like:

user/AyberkY/AV-69-graceful-failure-for-fifo-buffer or feature/AV-69-create-data-logger-class

Archiving Code Base Revisions

We should try to keep an archive of the version of code that ran on each rocket launch, so that we can associate the data we collected with the code that was running on TARS.

After every launch or major milestone, create branch with the following convention:
archive/<month.day.year>-<milestone-or-launch-description>

For example: archive/09.01.21-start-of-2022-school-year

Code Style Guide

The repository now has a GitHub Actions instance that will automatically check for code style violations!

The Actions instance will not inhibit a pull-request from merging. It is merely there to encourage style consistency throughout our code base.

There is also an auto formatting script that will format your code for you! (its beautiful, you should use it) This means that you don't have to worry about coding to meet the style yourself, as you can simply run the formatting script before you commit/push your changes.

You can run the script on Linux, Mac, or WSL like so:

./run_clang_format.py -i -r .

Things to keep in mind about code formatting:

  • The code style being used is defined in .clang-format. It currently follows Google's C++ style guide exactly. However, a modification was made so that the maximum characters per line was increased from 80 to 120.
  • Third party libraries (e.g.ChRt which is ChibiOS) are exempted from code-style checks and the auto formatting script. This is to avoid any possibility of breaking proven/working libraries. If adding a new library to flight code, make sure to update .clang-format-ignore with the relevant file path if it isn't in lib.
    • Exempt directories should be listed in .clang-format-ignore so they don't get auto-formatted by the script.
    • Exempt directories should also be listed in .github/workflows/clang_format_check.yml on the lines with exclude:, so they're not checked for style violations by GitHub.
  • Changing/tweaking the style guide is always option! If you have ideas, reach out!

tars-software's People

Contributors

aidancostello avatar ary-dz avatar ayberky avatar ben-olaivar avatar colinpk2 avatar cox-joshua avatar davidcrobbins avatar gautamdayal avatar gigavoltflash avatar gracerobbins avatar isabelalviar avatar jakehawkins avatar jgcox2 avatar joshuablustein avatar jusjeev1 avatar lyc11776611 avatar mht3 avatar npiphi avatar rbhog avatar sarthakkamboj avatar sendhil2 avatar streliziapus avatar zyunlam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tars-software's Issues

Combining FifoBuffer and HistoryBuffer

The major difference between FifoBuffer and HistoryBuffer right now is that FifoBuffer has a destructive pop method, which removes items from its buffer, while HistoryBuffer can only be filled and thus may be used to look at recent history. However, using the new FifoView API available in the removed-pointer-struct branch, FifoBuffer will no longer have pop, making it's functionality a superset of HistoryBuffer, obviating the need for the latter.

We should write the code to calculate derivatives for FifoBuffer, which will let us remove HistoryBuffer and simplify the code base.

Create separate mcu folders for Teensy, ESP, Atmega(PMB)

As of now, we have all of our embedded code in a single MCU (microcontroller) folder. This it totally okay for now (Mk3) because, well, we only have one MCU. However, TARS Mk4 has a teensy for most tasks, an ESP32-S3 for telemetry and GPS, and an Atmega on the power management board (this was on Mk3 too i guess).

We should create separate mcu folders under the flight directory to organize the code for each one

HILSIM Crashes after a few seconds after startup

HILSIM crashes a few seconds after startup.

The error message is:
assertion "index >= 0 && index < size()" failed: file "lib\\Eigen/Eigen/src/Core/DenseCoeffsBase.h", line 427, function: Eigen::DenseCoeffsBase<Derived, 1>::Scalar& Eigen::DenseCoeffsBase<Derived, 1>::operator()(Eigen::Index) [with Derived = Eigen::Matrix<float, 120, 1>; Eigen::DenseCoeffsBase<Derived, 1>::Scalar = float; Eigen::Index = int]

The issue was narrowed down to KF, but it needs further investigation and resolving.

Use Platformio lib_deps instead of manually downloading libraries where possible

At the moment, our lib folder is full of libraries that are manually added. Though this works, we might as well use the library dependencies functionality that PlatformIO provides. Some minor changes may have been made to some libraries (lke radiohead for telemetry) so those can be left alone.

As of now, the only library we import through pio is pwmservo, we should start doing the same for others.

FSM Revamp

The FSM from October launch performed decently well, but there are much-needed improvements.

  1. Change our overall design so that we no longer assume a perfect flight. We shouldn't only be able to transition to the next state of an ideal flight, we should instead be able to transition to any state from any other state (with limitations) for a more accurate representation of what is actually happening.

  2. Add an error state. This is important to let us know when something has gone wrong with the rocket. Additionally, when we stage, this will be useful in determining whether or not to light the second stage.

  3. Use a wider variety of sensors (acceleration, altitude, orientation, Kalman filter velocity, etc) for state transitions. Use multiple sensors for each state transition as a way to double-check.

  4. Potentially remove buffer usage. During October launch, the acceleration change for drogue and main were distinct enough to just be detected from a single value.

Add profiling to flight code

Tasks like SD logging and Telemetry block the thread (and maybe the entirety of flight code, depending on if we turned on cooperative multithreading or not).

This is mostly a bad thing, since there's thing we'd rather our system be doing instead of spending 200 ms at a time logging data.

To address this, we should at some form of profiling to the SDLogger and Telemetry, so we can identify:

  1. If they're actually an issue
  2. Where the biggest performance impacts happen
  3. What we can address to fix this

Sensor abstraction layer unused

We've created an object-oriented design to handle all our sensors (see HighGSensor.cpp or GPSSensor.cpp etc.). These are completely unused right now in the master branch, but actually using them would create a much cleaner interface in flight code and also be very useful for playback/hardware-in-loop functionality that @GigaVoltFlash @cflynn19 @karnapp2 @rbhog and @NPIPHI have been working on.

So far, @sendhil2 has these working in branch removed-pointer-struct, and this branch is currently being debugged (things are going wel)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.