mc_pos_control: fixed all pull request complaints

mainly changing parameters to BlockParams, reorder them and comment
This commit is contained in:
Matthias Grob
2017-03-22 15:21:34 +01:00
committed by Dennis Mannhart
parent bfb4de0e66
commit b32e5e7ec0
2 changed files with 23 additions and 29 deletions
+5 -4
View File
@@ -36,6 +36,7 @@
*
* So called exponential curve function implementation.
* It is essentially a linear combination between a linear and a cubic function.
* It's used in the range [-1,1]
*/
#pragma once
@@ -62,17 +63,17 @@ template<typename _Tp>
inline const _Tp deadzone(const _Tp &value, const _Tp &dz)
{
_Tp x = constrain(value ,(_Tp)-1, (_Tp)1);
_Tp dzc = constrain(dz ,(_Tp)-1, (_Tp)1);
// Rescale the input such that we get a piecewise linear function that will be continuous with applied deadzone
_Tp out = (x-sign(x)*dz)/(1-dz);
_Tp out = (x-sign(x)*dzc)/(1-dzc);
// apply the deadzone (values zero around the middle)
return out * (fabsf(x) > dz);
return out * (fabsf(x) > dzc);
}
template<typename _Tp>
inline const _Tp expo_deadzone(const _Tp &value, const _Tp &e, const _Tp &dz)
{
_Tp x = constrain(value ,(_Tp)-1, (_Tp)1);
return expo(deadzone(x, dz),e);
return expo(deadzone(value, dz),e);
}
}