mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
Loading...
Searching...
No Matches
quadratic_throttle_model.h
1#ifndef QUADRATIC_THRUST_MODEL_H
2#define QUADRATIC_THRUST_MODEL_H
3
4#include <cmath>
5
6namespace mrs_lib
7{
8
9 namespace quadratic_throttle_model
10 {
11
12 typedef struct
13 {
14 double A;
15 double B;
16 int n_motors;
18
19 double inline throttleToForce(const MotorParams_t motor_params, const double throttle)
20 {
21
22 return motor_params.n_motors * pow((throttle - motor_params.B) / motor_params.A, 2);
23 }
24
25 double inline forceToThrottle(const MotorParams_t motor_params, const double force)
26 {
27
28 return sqrt(force / motor_params.n_motors) * motor_params.A + motor_params.B;
29 }
30
31 } // namespace quadratic_throttle_model
32
33} // namespace mrs_lib
34
35#endif // QUADRATIC_THRUST_MODEL_H
All mrs_lib functions, classes, variables and definitions are contained in this namespace.
Definition attitude_converter.h:24
Definition quadratic_throttle_model.h:13