stack-of-tasks / sot-torque-control

Collection of dynamic-graph entities aimed at implementing torque control on different robots.
Other
9 stars 15 forks source link

Improve current control of HRP-2 #33

Closed andreadelprete closed 6 years ago

andreadelprete commented 6 years ago

The current control of HRP-2's motor does not perform well. After a careful analysis of the system (both at hardware and software level) we believe the current control to be a simple analog high-gain proportional control with a dead zone on the current error. The motor voltage V is thus a piecewise-affine function of the current tracking error:

     | K*(u-i-dz)       if (u-i)>dz
V = -| 0                otherwise
     | K*(u-i+dz)       if (u-i)<-dz

where u is the control input, i is the motor current, K is the current control gain, and dz is the dead-zone threshold.

As long as the joint doesn't move, this controller does a good job at keeping the tracking error below the dead-zone threshold dz. However, the dead-zone threshold is quite large: around 0.5 A, which corresponds to about 5/10 Nm, depending on the joint. Moreover, as soon as the joint starts moving, the uncompensated back-EMF kicks in, dramatically increasing the current tracking error.

For these reasons, we are currently working on implementing a dead-zone compensation and a back-EMF compensation. The back-EMF compensation is straightforward: it boils down to adding a term proportional to the joint velocity to u. On the contrary, the dead-zone compensation is extremely challenging, mainly because it has to rely on the current measurement, which is noisy and may also be biased.

andreadelprete commented 6 years ago

This was the current tracking on the right hip roll joint: rhr_no_dz_no_bemf_comp And here it is after compensating for 75% of the dead zone: rhr_zero_vel_dz_comp_0 75

andreadelprete commented 6 years ago

Here you can see the original current tracking at the right hip roll and knee joints while the robot was balancing: balancing_kp_torque_0 5_old_current_ctrl And here it is the current tracking after compensating for back-EMF, dead zone, and adding an integral on the current tracking error: balancing_kp_torque_0 5_current_integral Results speak for themselves! :)

andreadelprete commented 6 years ago

The improvements in the current tracking are directly affecting also the torque tracking. For instance here you can see what happens to the torque tracking of the right knee when I enable the dead-zone compensation: torque_tracking_knee_with_vs_without_dz_comp The large delay between desired and estimated torque is mainly due to the low-pass filters we were using during that experiments.

andreadelprete commented 6 years ago

Given the recent improvements of the current control I believe we can close the issue. However, we are currently compensating for only 80% of the dead zone, while the remaining 20% is compensated through the integral term. Compensating for 100% of the dead zone would of course be preferable, but we did not manage to do it without introducing vibrations is the system, which is undesirable. We may need to come back and improve once more the current control is we think a better tracking is needed. I personally believe there is still room for improvement, but it may require a significant effort, and it would probably result in a relatively small improvement with respect to what we have now.