auto-measurements
Dependencies: FastPWM3 mbed-dev
Fork of Hobbyking_Cheetah_Compact by
Diff: math_ops.cpp
- Revision:
- 34:47a55f96fbc4
- Parent:
- 26:2b865c00d7e9
diff -r 3ab3cce8b44d -r 47a55f96fbc4 math_ops.cpp --- a/math_ops.cpp Wed Aug 30 18:10:27 2017 +0000 +++ b/math_ops.cpp Mon Oct 02 00:55:39 2017 +0000 @@ -22,6 +22,12 @@ return (x < y ? (x < z ? x : z) : (y < z ? y : z)); } +float roundf(float x){ + /// Returns nearest integer /// + + return x < 0.0f ? ceilf(x - 0.5f) : floorf(x + 0.5f); + } + void limit_norm(float *x, float *y, float limit){ /// Scales the lenght of vector (x, y) to be <= limit /// float norm = sqrt(*x * *x + *y * *y);