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
9namespace quadratic_throttle_model
10{
11
12typedef struct
13{
14 double A;
15 double B;
16 int n_motors;
18
19double inline throttleToForce(const MotorParams_t motor_params, const double throttle) {
20
21 return motor_params.n_motors * pow((throttle - motor_params.B) / motor_params.A, 2);
22}
23
24double inline forceToThrottle(const MotorParams_t motor_params, const double force) {
25
26 return sqrt(force / motor_params.n_motors) * motor_params.A + motor_params.B;
27}
28
29} // namespace quadratic_throttle_model
30
31} // namespace mrs_lib
32
33#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