# Loopshaping Design for Robot Joint with Harmonic Drive

This article is a continuation from our previous one: Linear Model of Robot Joint with Harmonic Drive. There we have demonstrated that PID control for this plant can be difficult due to the flexible mechanism inherited in the harmonic drive. A custom-designed controller, even a simple one like lead-lag compensator, can cope with the undesirable dynamics better because it allows the control engineer to shape the frequency response of the feedback system. Refer to Module 3: Classical Loopshaping Design in our Scilab Engineering Basics, from which we learn how to shape the frequency response of loop transfer function conforming to a given set of specifications. Such knowledge can be effectively applied to the problem at hand.

Using the same set of parameters from last article, we have the plant transfer function

(1)

with poles at . Let’s observe the Bode plot for this plant in Figure 1. We see the noticeable peak at frequency around 2.8 Hz, corresponding to the flexible mode of harmonic drive. The other peak at 16.7 Hz is more damped, and it happens at higher frequency so has less impact on the closed-loop performance.

Figure 1 Bode frequency response of (1)

Hence, to achieve good tracking and disturbance attenuation, the controller must increase the low frequency gain of loop transfer function. The lightly-damped mode, however, effectively limits the control bandwidth since we want that peak at 2.8 Hz to stay well below 0 dB.

With these constraints, together with the phase margin requirement, we write down some crude specs for our control design as follows

1. steady-state error less than 0.01 below 0.01 Hz
2. high-frequency magnitude of close-loop is attenuated to 0.1 above 1 Hz
3. phase margin at least 40 degrees

These can be translated to stability and performance bounds (see Module 3: Classical Loopshaping Design for explanation)

1. below 0.01 Hz
2. above 1 Hz
3. has at least 40 degrees phase margin, or

Put these criteria at the top of hmd_lshape.sce. First try to craft your version of controller. Start with some initial one, and execute the file. See the resulting magnitude and phase response of loop transfer function and determine whether it conforms to the above specs. Then add zero(s) and pole(s) as you like.

In case you are too busy to experiment on your own, uncomment the lines for cnum and cden to use my choice of controller

(2)

which does not quite meet the specs no 1 and 2, but is good enough for illustration purpose. The script hmd_lshape.sce gives you the plots for open and closed loop transfer functions in Figure 2 and 3, respectively. The low-frequency bound is violated slightly at the corner, and high-frequency bound at the peak of lower flexible mode.

Figure 2 Bode plot of L versus bounds

Figure 3 Bode magnitude plot of S and T versus bounds

To simulate the time-domain response, use the Xcos model lshape_hmdrvsim.zcos shown in Figure 4. It needs the numerator and denominator data for both the plant and controller from hmd_lshape.sce. Note from the diagram that a step disturbance is applied at t = 10 secs, to see closed-loop disturbance rejection performance.

Figure 4 Xcos model for step response simulation lshape_hmdrvsim.zcos

Running the simulation yields the step response and controller output in Figure 5. Compare it to the response achieved from PID controller in the previous article.

Figure 5 load angle and controller output from simulation

### Conclusion

In this article we discuss preliminary control design for the robot joint actuated by DC motor with harmonic drive, using the linear model developed from our previous work. Using the well-studied classical loopshaping design approach, we get a quite simple controller, with only one zero and two poles, that yields superior performance than a standard PID controller. This result is reasonable, since the PID is only a second-order transfer function with not much degree-of-freedom to compensate the undesirable plant dynamics. Indeed, the integral term of PID in this case is somehow useless. That’s why in [1] they often use only PD control.

### Exercises

1. Tweak the controller (2) to see if you can achieve one that does not violate any bound.

2. For the plant transfer function (1), one can get quite decent response using a controller with only one pole in the form

(3)

Using the script file hmd_lshape.sce, find your choice of a and b that gives better response than from the PID controller.

Hint: the magnitude response of already descends at slope -20 dB/decade below the first resonance peak. Where would you place the controller pole then?

### Scilab Script and Model Files

The files can be downloaded from links embedded in the text. Both are also contained in this zip file: hmd_lshape.zip

### References

1. M.W.Spong, S. Hutchinson and M. Vidyasagar, Robot Modeling and Control. John Wiley & Sons. 2006.
2. V. Toochinda, Robot Analysis and Control with Scilab and RTSX, Mushin Dynamics, 2014.