AP_PID: compiler warnings: apply is_zero(float)

This commit is contained in:
Tom Pittenger 2015-05-01 23:51:14 -07:00 committed by Andrew Tridgell
parent ac4e7b2b03
commit 01180d52c4
2 changed files with 5 additions and 5 deletions

View File

@ -132,7 +132,7 @@ float AC_PID::get_p() const
float AC_PID::get_i()
{
if(!is_zero(_ki) && !is_zero(_dt)) {
if(!AP_Math::is_zero(_ki) && !AP_Math::is_zero(_dt)) {
_integrator += ((float)_input * _ki) * _dt;
if (_integrator < -_imax) {
_integrator = -_imax;
@ -199,7 +199,7 @@ void AC_PID::operator() (float p, float i, float d, float imaxval, float input_f
// calc_filt_alpha - recalculate the input filter alpha
float AC_PID::get_filt_alpha() const
{
if (is_zero(_filt_hz)) {
if (AP_Math::is_zero(_filt_hz)) {
return 1.0f;
}

View File

@ -95,7 +95,7 @@ Vector2f AC_PI_2D::get_p() const
Vector2f AC_PI_2D::get_i()
{
if(!is_zero(_ki) && !is_zero(_dt)) {
if(!AP_Math::is_zero(_ki) && !AP_Math::is_zero(_dt)) {
_integrator += (_input * _ki) * _dt;
float integrator_length = _integrator.length();
if ((integrator_length > _imax) && (integrator_length > 0)) {
@ -109,7 +109,7 @@ Vector2f AC_PI_2D::get_i()
// get_i_shrink - get_i but do not allow integrator to grow in length (it may shrink)
Vector2f AC_PI_2D::get_i_shrink()
{
if (!is_zero(_ki) && !is_zero(_dt)) {
if (!AP_Math::is_zero(_ki) && !AP_Math::is_zero(_dt)) {
float integrator_length_orig = min(_integrator.length(),_imax);
_integrator += (_input * _ki) * _dt;
float integrator_length_new = _integrator.length();
@ -167,7 +167,7 @@ void AC_PI_2D::operator() (float p, float i, float imaxval, float input_filt_hz,
// calc_filt_alpha - recalculate the input filter alpha
void AC_PI_2D::calc_filt_alpha()
{
if (is_zero(_filt_hz)) {
if (AP_Math::is_zero(_filt_hz)) {
_filt_alpha = 1.0f;
return;
}