sbgisen / vesc

VESC Interface for ROS
Apache License 2.0
47 stars 34 forks source link

I gain is rounded off. #52

Open nyxrobotics opened 1 year ago

nyxrobotics commented 1 year ago

Abstract

The problem occurs when adjusting the PID gain of the position. When the I-gain is 0.4 or less, it is not integrated at all. When the I-gain is set to 0.5 or higher, it suddenly becomes integrated.

How to Reproduce the Bug

Problem due to the Bug

Factors

Suggestion

nyxrobotics commented 1 year ago

If the value obtained by multiplying the gain by the deviation is less than 1, a digit drop occurs, which occurs for all PID gains.

nyxrobotics commented 1 year ago

The I control calculation was correctly performed with a double type. However, there seems to be a bug in the calculation of antiwindup. We need to check if the #72 change has improved the situation.

https://github.com/sbgisen/vesc/blob/3d5e62e736d2c3f92d26e006b3ccf48f5f5c4dc4/vesc_hw_interface/src/vesc_servo_controller.cpp#L103-L124

nyxrobotics commented 1 year ago

In order to improve the calculation of antiwindup, we referred to the following article. Anti-windup of PID controller

The behavior was unstable because of the proprietary calculation method. It has been re-implemented using the "Back-Calculation" method.