mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-15 19:13:34 +08:00
mc_pos_control: fixed all pull request complaints
mainly changing parameters to BlockParams, reorder them and comment
This commit is contained in:
committed by
Dennis Mannhart
parent
bfb4de0e66
commit
b32e5e7ec0
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user