(多分)全部+フライトピン+新しい加速度
Dependencies: mbed
Math.cpp
- Committer:
- seangshim
- Date:
- 2018-11-23
- Revision:
- 18:2a47ed430cfe
File content as of revision 18:2a47ed430cfe:
#include "Math.h" #include "mbed.h" const float gPI = 3.1415926536f; float convertRange( float in, float oldMin, float oldMax, float newMin, float newMax ){ return ( in - oldMin ) * ( newMax - newMin ) / ( oldMax - oldMin ) + newMin; } float convertRangePlusMinusPi( float deg ){ while ( ( deg > gPI ) || ( deg < -gPI ) ){ while ( deg > gPI ){ deg -= 2.0f * gPI; } while ( deg < -gPI ){ deg += 2.0f * gPI; } } return deg; } bool isNear( float a, float b, float error ){ return ( abs( a - b ) < error ); }