MASTERCLASS

# Robot joint Control

### Lessons

#### Share

#### Transcript

Here again is the block diagram of a robot joint control system. What we're going to do now is to actually build a model for joint 2 of the PUMA 560 robot.

One of the advantages of the PUMA 560 robot is that it's a very well-studied robot, and many of the parameters of its controller and of its mechanism are very well understood.

Here are listed a few of the important parameters of joint 2 for this robot. We have the inertia of the motor; we have the friction of the motor, the motor torque constant, the amplifying gain. That's the number of amps into the motor for every volt applied to the amplifier. Finally, the gear ratio for the second joint of the PUMA robot.

I have just been entering the parameters for our robot dynamic model into the MATLAB Workspace, creating a number of variables. The last one that I need to create is the gear ratio which is 107.815 for this particular joint of the PUMA robot.

Next thing I'm going to do is to invoke Simulink, which is the MATLAB tool for creating and simulating dynamical models. Invoked Simulink, and here is the window which gives us all the rest of the components of the models that we need. I'm going to create a new model, and here's the window in which I can create my new graphical model.

Now, the first thing I'm going to do is to add some continuous time dynamic blocks. The first thing I'm going to do is to drag in the transfer function which is going to be our motor model.

Here is the block which is going to be our motor, and I'm going to change the parameters. The numerator in this particular case is the variable 'km,' that's the motor torque constant, and the denominator is a polynomial, and the highest order coefficient is 'jm,' that's the motor inertia followed by the motor friction and followed by a zero. It is a second-order polynomial. There we go.

Here, we have a block which represents the dynamics of our motor. I'm also going to draw in a PID controller, and that's it there. I'm going to create a source. This is the signal that I want the robot joint to follow. I'm going to drag in a signal generator and I'm going to set it to have a frequency of 0.5 Hertz.

That's one cycle every two seconds, and it’s going to be a square wave and I'm going to connect that to the reference input of my controller. I'm going to set the controller parameters a proportional gain of 1, integral gain of 0, and so on.

Now we're ready to simulate the system. I'm going to apply a square wave to the reference input of my controller.

In the real robot, the output of the controller is a voltage which goes to the motor drive, which is effectively a big power amplifier, and the output of that is a current which flows into the motor. This block here represents the dynamics of the motor, and the output is the position of the motor. We can see the feedback path. What I'm going to do is hit the 'Play' button here, and Simulink is going to simulate this dynamic model.

Here we see the output response. We can see that the motor is responding in some way to the square wave, which is being injected, but we can see that it's very very oscillatory, there's a lot of overshoot there which is very undesirable.

We can adjust the parameters of the controller. What I’m going to do is to add a little bit of derivative gain, otherwise known as damping.

If I simulated now, that's where the derivative gain is set to a value of 0.1. Here we see the response is much more desirable. We see that the motor position is changing between -1 and +1. That's exactly what this signal generator is demanding. We see that there's only a very small amount of overshoot. This is not a bad robot joint controller.

We use a little bit of trial and error to make this controller work well. Although it's quite common practice to do this, a much better approach is to design the controller that requires we have a model of the system to be controlled. In the case of the PUMA robot, we do have a very, very good model of that robot, of its mechanical and its electrical components.

Then we need to have a specification for the quality of control. How much overshoot are we willing to tolerate? How quickly do we want the robot joint to get to the desired joint angle?

Then we use well-known techniques from control theory such as, 'Root locus method,' or 'pole placement' or 'LQR synthesis'.

There are lots of techniques in control theory. Pick the one that you prefer, and you apply that to design a controller. Perhaps it needs a little bit of tweaking, perhaps because the model that you're using doesn't exactly reflect the reality of the particular robot that you're working on, but you'll get a very very good first approximation to a decent controller.

For a multi-joint robot like the PUMA 560, a common strategy is what's called, 'Independent Joint Control.' We design and build a controller for each of these separate joints.

For economies of scale, it's common to use the same design for the controller for each of the joints. All that's different is some parameters in the joint control algorithm to reflect the fact that the joints have got different dynamics. Perhaps they have different size motors` with different inertia, different friction characteristics, and so on.

#### Code

We will use Simulink to create a dynamic model of a single robot joint and simulate its operation.

### Skill level

Undergraduate engineering

#### Undergraduate-level engineering

This content requires an understanding of undergraduate-level engineering; for example, dynamics, classical control theory - PID, poles, zeros, probability theory - random variables and Bayes’ rule.

#### Undergraduate-level mathematics

This content requires an understanding of undergraduate-level mathematics; for example, linear algebra - matrices, vectors, complex numbers, vector calculus and MATLAB programming.

### Rate this lesson

## Discussion

## Leave a comment

Please Sign In to leave a comment.

I have a question, In the video you got the current position of the motor shaft before the gear mechanism. Why is that ?

It increases the resolution of angle measurement. Let’s say the encoder can measure to 1 degree and the gearbox is 100:1. On the output shaft we can measure the angle to 1 degree. On the motor shaft we can measure it to 1 degree, but that corresponds to 0.01 degrees of the output shaft.