sbgisen / vesc

VESC Interface for ROS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[vesc_servo_controller.cpp] Nonlinear treatment of integral terms at saturation boundaries

nyxrobotics opened this issue · comments

Abstract

In the following program, the behavior of the I-control appears to be non-linear near saturation.

double error_integ_new = error_integ_ + (error_current + error_previous_) / 2.0 * dt;
const double u_pid = u_pd + Ki_ * error_integ_new;
// not use I control if PID input is saturated
// since error integration causes bugs
if (isSaturated(u_pid))
{
u = u_pd;
}

I think the correct solution is as follows.

    if (isSaturated(u_pid))
    {
      u = saturate(u_pid);
    }