Hummingbird Flight Software
Flight software for the Hummingbird FCU quadcopter flight controller. Designed to run on the Teensy 4.1. Developed with VSCode+PlatformIO.
conversions.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // FLIGHT CONTROLLER CONVERSIONS
3 //
4 // Code By: Michael Wrona | B.S. Aerospace Engineering
5 // Created:
6 // ----------------------------------------------------------------------------
11 #pragma once
12 
13 
14 #include "hummingbird_config.h"
15 
16 
17 constexpr float DEG2RAD = 0.01745329251994329576923690768489f; // PI / 180, convert degrees to radians
18 constexpr float RAD2DEG = 57.295779513082320876798154814105f; // 180 / PI, convert radians to degrees
19 
20 // --------------------------------------
21 // Conversion factors and equations
22 // --------------------------------------
24 {
25 public:
26  // --------------------------------------
27  // Conversion factors and equations
28  // --------------------------------------
29  Conversions(){} // Constructor
30 
31  /* Convert celsius to kelvin */
32  float C2K(float inC) { return (inC + 273.15f); }
33 
34  /* Convert kelvin to celsius */
35  float K2C(float inK) { return (inK - 273.15f); }
36 
37  /* Convert celsius to fahrenheit. */
38  float C2F(float inC) { return ((inC * (9.0f / 5.0f)) + 32.0f); }
39 
40  /* Convert fahrenheit to celsius. */
41  float F2C(float inF) { return ((inF - 32.0f) * (5.0f / 9.0f)); }
42 
43  /* Convert meters to feet */
44  float Meters2Feet(float meters) { return (meters * 3.28084f); }
45 
46  /* Convert feet to meters */
47  float Feet2Meters(float feet) { return (feet / 3.28084f); }
48 
49  /* Convert pressure in Pa to in.Hg */
50  float Pascals2InHg(float pa) { return (pa * 0.0002953f); }
51 
52  /* Convert pressure in in.Hg to Pa */
53  float InHg2Pascals(float inhg) { return (inhg * 3386.38673f); }
54 };
Definition: conversions.h:24
float C2K(float inC)
Definition: conversions.h:32
float Pascals2InHg(float pa)
Definition: conversions.h:50
float Meters2Feet(float meters)
Definition: conversions.h:44
Conversions()
Definition: conversions.h:29
float InHg2Pascals(float inhg)
Definition: conversions.h:53
float Feet2Meters(float feet)
Definition: conversions.h:47
float F2C(float inF)
Definition: conversions.h:41
float C2F(float inC)
Definition: conversions.h:38
float K2C(float inK)
Definition: conversions.h:35
constexpr float RAD2DEG
Definition: conversions.h:18
constexpr float DEG2RAD
Define conversion factors 'n stuff.
Definition: conversions.h:17