Giter Site home page Giter Site logo

astraflightsoftware's Introduction

ASTRAFlightSoftware

Main ASTRA flight software.

Setup

Clone this repository:

git clone --recursive https://github.com/activecontrols/ASTRAFlightSoftware.git # Or use the SSH repo link

The recursive flag is required to pull in external drivers.

Download platformio. We recommend getting both the IDE and the core CLI. Instructions will generally use the CLI to be IDE-agnostic.

Structure and Standards

Structure

  • Source files are located in ./src.

  • Header files are located in ./include.

  • External libraries are located in ./lib.

  • Test files are located in ./test.

  • Lower-level drivers are in ./drivers. This is the property of the Avionics team, so ask before making changes in here.

Standards

Code should be written in camelCase where possible, with 4-space indentation and Java-style braces. Methods should also have a descriptive multi-line comment describing their function. Constants should be uppercase where possible. Example:

char * SOMETHING = "Did something!";

/* This function prints out the
String "Did something!" */
void doSomething() {
    Serial.println(SOMETHING);
}

Files should have a comment block at the top detailing what it contains, as well as the person taking responsibility for it (so that questions can be routed to the correct person):

/**
 * comms.cpp
 * This file contains methods for communicating with the ground station.
 *
 * @author <[email protected]>
 */

(For source-header file pairs, both require a comment block, but one can just reference the other.)

For header files, always add include guards:

#ifndef TRAJECTORY_H
#define TRAJECTORY_H
void trajectory();
#endif // TRAJECTORY_H

When referencing object properties and methods, always explicitly use the this-> pointer:

void StateLogic::state() {
    return this->_state;
}

This helps make it easier to track where variables are defined.

After dynamically deallocating a pointer, the pointer should be set back to NULL.

int * xlocation = malloc(sizeof(int));
free(xlocation);
xlocation = NULL;

int * ylocation = new int;
delete(ylocation);
ylocation = NULL;

For anything else not covered, write "good code" where possible - use your best judgement. Some rules of thumb:

  1. If you have a function that is very long (200+ lines), consider splitting it.
  2. If you have very deeply nested code (e.g. a chain of 20 if statements nested within each other), consider flattening or splitting into sub-functions.
  3. Use descriptive and meaningful names for variables and functions. For example, a variable named t vs trajectory/traj
  4. Closing brace should be on the same indentation level as the function/loop.

These rules are not hard requirements, but they are intended to make code easier to read.

Authors: Teresa Wan, Vincent Wang

astraflightsoftware's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.