mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
quadratic_throttle_model.h
1
#ifndef QUADRATIC_THRUST_MODEL_H
2
#define QUADRATIC_THRUST_MODEL_H
3
4
#include <cmath>
5
6
namespace
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;
17
}
MotorParams_t
;
18
19
double
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
24
double
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
mrs_lib::quadratic_throttle_model::MotorParams_t
Definition:
quadratic_throttle_model.h:12
mrs_lib
All mrs_lib functions, classes, variables and definitions are contained in this namespace.
Definition:
attitude_converter.h:29
include
mrs_lib
quadratic_throttle_model.h
Generated by
1.8.17