nobleo / path_tracking_pid

Path Tracking PID offers a tuneable PID control loop, decouling steering and forward velocity
Apache License 2.0
129 stars 38 forks source link

Step response of the lowpass filter has an overshoot #93

Closed Rayman closed 2 years ago

Rayman commented 2 years ago

I put a step response on the second order lowpass and the output I've printed below. As you can see the filter has an overshoot, which is very strange. I think there is something wrong with it.

0.292893
0.87868
1.12132
1.02082
0.979185
0.996429
1.00357
1.00061
0.999387
0.999895
1.00011
1.00002
0.999982
0.999997
1
1
0.999999
1
1
1
cesar-lopez-mar commented 2 years ago

Second order lowpass filters can have an overshoot, depending on the damping factor of the filter. I see the filter settles rather fast (especially compered to the dynamics of a physical robot), and it usually is there to filter noise and its input won't be step-like functions. So in my experience with this step response I would say there should not be issues during nominal operation. Have you noticed an issue on the vehicle behavior?

Rayman commented 2 years ago

When I calculate the step response of the critically damped second order lowpass I get this (1000Hz sampling, 50Hz cutoff): image

When I put the cutoff at 1/4 of the sampling frequency as the comment in the filter suggest, I still get this: image

cesar-lopez-mar commented 2 years ago

So it means the implemented LPF should be critically damped? We took that implementation from another code and did not make an exhaustive review. So either, there is a bug in the filter implementation, or it was intended not to be critically damped. In any case we should find the original equations and double check.

Rayman commented 2 years ago

Fixed by https://github.com/nobleo/path_tracking_pid/pull/119