Summary
Keywords
Full Transcript
A salam alaikum. Dear learners, I hope you are fine and doing great. Moreover, I hope that you have viewed the previous video in which we discussed the basics of simscape toolbox and robotic system toolbox from ad traps. Moreover, we used those two toolboxes to model a very simple robot, a planar robot in fact, and then drove it on a very basic trajectory.
Today in this video, we are very quickly going to go through that what inverse cinematics is and how we can use it to drive a robot on a defined trajectory. For this video, the trajectory would be very simple because we are not going to use any feedback or a control system that can allow the robot or that can make the robot to move on a complex trajectory. Therefore, the trajectory would be a simple square that is we want the previously developed robot which we developed in our previous video to move in a square. Just to revise a bit, this was our planar robot.
It had two joints attached over here and over here. And the end effector which is shown by this black box will move whenever these two joints are going to rotate. Furthermore, as this is a planar robot, this black body or the end effector will only move in a plane. And if viewed from the top side, then this gray area is the workspace of this robot.
So in this video, what we want to do is we want to make this robot move in a square trajectory. That is, we want this robot to draw a square somewhere in its workspace. But let's suppose it is drawing a square somewhere over here. So the very first thing you need to do is you need to define the coordinates of these four corners of the square.
So let's suppose that the coordinates of the square are shown as this. That is, this point of the square lies at 0.25, 0.01 in the workspace. That is 0.25 in the x direction and 0.01 in the y direction. Remember that the region or the world coordinate frame is right at the center of this blue base.
Therefore, 0.25 would mean that we have to move in this direction, 0.25 in x direction and then 0.01 in y direction. After that, this would be the next point. That is, we want the end effector to follow this straight line and go to this point. And the coordinates of this point would be 0.25 in x direction and 0.11 in y direction.
And after that, we want the end effector to go in this direction and end at this point. The coordinates of this point would be now 0.15 and 0.11 in y direction. And for the last corner, the end effector should reach this point, which is 0.15 and 0.01 in y direction. And then we want that it should go to the initial point to complete this square.
So we need to provide this trajectory to some kind of algorithm that will drive the robot on this trajectory. Now to move the robot on this trajectory, we don't know that what joint angles do we need? Because in the border, all we have is the joint angles. We have joint number one and joint number two and nothing else.
So the algorithm which will come in handy over here is all the inverse kinematics. We are going to provide all these locations, the physical locations, which are somewhere in the workspace to the inverse kinematics algorithm. And we will provide the rigid body tree of this robot to the inverse kinematics algorithm as well. And this algorithm will then take in the points of the workspace on which we want our robot to move and will generate the required joint angles.
Those joint angles will be given to the robot in civilization and then we will see that the robot is moving on this trajectory. So now let's move to the MATLAB's environment and see that how we can make the robot move on to this trajectory. So before doing anything, if you have viewed the previous video, you should know that the robot system toolbox will require rigid body tree variable of our robot. So in the previous video, we saw that how we can create that thing.
So right over here, I have the M file that will load the rigid body tree or the previously made robot. So I just need to run it. So let me run it and then I will have the rigid body tree over here. So after running it, I can see that I have this variable, which is duf2 underscore arm as a rigid body tree.
So now this variable will be used in my simulink files. Moreover, you should have made a simulink file in the previous video in which we made the CAD model of the robot, then we drove it through a forward kinematics block. So I'm going to open that model and will be modifying that thing so that we can incorporate what we are going to do in this video in the same file as well. So this was the model that we created in the previous video.
Over here, we had some random joint angles that were being supplied to the robot and then the robot was moving on those joint angles. Then we made those joint angles using the encoders or the sensors placed at the joint. Then we use those joint angles provided it to the forward kinematics block. The forward kinematics block figured out the tool positions, that is the positions in x, y and z coordinates of the end effector and we showed those positions in a scope.
So now in this video, we are going to modify this model so that we can move our robot in a defined trajectory. For that, the first thing is we need to generate the trajectory and to generate a trajectory, we can use a signal builder that will generate the trajectory and then we will use that generated trajectory for our purpose. So I won't be needing these two things. I'm going to delete them and I'm going to readjust these things over here.
Inside this signal builder, I can have different options of signals. For example, if you go over here in this menu, then you can see a range of signals that this signal builder can build. But right now, we want a custom signal because we want to define the x, y and z coordinates of the end effector of our robot. So I'm going to select custom over here and then for custom, I need to define the time values and the y values as well.
We are not just creating path over here, but we are creating trajectories. So for x axis, these are the time values and x values, which I would want. These values show that at zero time, my end effector's x position should be at 0.35. We know that in a fully extended state, the end effector, that is at the initial state, the end effector would be at 0.35 in x direction.
So one second, I want my end effector to be at 0.25 in x direction, which is the x coordinate of the first corner of the square. And after one second, I want my end effector to remain at 0.25 x coordinate, because in this time, the end effector would be moving in y direction, that is, it will be going upwards. And so on, I will keep on incrementing the x directions and y directions after one second. So every segment of the square would be drawn in one second.
That is the time I am allocating. You can always allocate smaller or larger times, but that will make the robot faster or slower. So this will be the signal that we will be using for x axis. So I am going to label this.
So first of all, I'm going to delete this signal one, because we won't be needing this thing. And I'm going to label this signal to as x axis. After that, I need to provide another signal that is of y axis. And for y axis, once again, the time values would be seen, but the y values would be a bit different.
So at the very start, the y value would be at 0. And then the first corner of the square is at y value 0.01. And then it would be 0.11, then 0.11 again. After that, 0.01.
And the last one that is the first point actually again would be 0.01. So these are the six points that would be required by the rewards and the factor to move in y direction. So this is the second signal that I want. I'm going to label it as y.
And for the third axis, we know that it is a planar robot. It will not be moving in z axis. So we can insert a constant signal like this. And I can label it as z.
And its value will be 0.1. And its value will be 0.11. Because we know that the end effectors z position will remain 0.11. Over here, I should mention that this was explained in the previous video.
So if you have no idea that from where this point 1 1 came, you better watch the previous video. So these are the signals in x, y and z directions, which I want by robots and the factor to reach in order to draw. So now let's provide these signals to inverse kinematics block so that inverse kinematics block can give us the joint angles, which will be provided to this robot over here. So for inverse kinematics algorithm, I need inverse kinematics block.
I can get it like this. And it requires three inputs and generate two outputs. The first input of this inverse kinematics block is the pose. This means the end effectors position and orientation included in a single matrix.
And that matrix over here is called homogeneous transformation matrix. So to provide the pose to this inverse kinematics block, we need to convert this translation vector into a homogeneous transformation matrix. And for that, we need a coordinate transformation block from robot existing robots, which is this one. We have already used it in forward kinematics in the previous video.
So this time in the input side, we will have a translation vector, whereas on the output side, we would have homogeneous transformation matrix. So this would be the block that we are going to use. Let me drag these things a bit over here. And I can attach things like this.
I need to provide a translation vector over here. So I need to mark it. I need a month of three inputs and one output, which would be this one. It would be attached over here.
X, Y, and Z. After that, it requires the second input, which is of weights. As this inverse kinematics block is going to solve the inverse kinematics equation through iterative process. So it requires that which inputs or which parts it should focus on.
So we are going to apply weights to the positions only, because right now we are not concerned about the rotations. So it would require a constant array of six numbers that and each number in that array will correspond to the weight. We are going to assign to that particular position or orientation. The first three numbers are for rotations and then three numbers are for translations.
So I need a constant. And in that constant, I'm going to pass an array. It will have three zeros for rotations. And then for positions, we need three ones that we are going to equally weigh X, Y, and Z positions.
So this constant is going to go into the weights. And if you are aware of the process through which iterative equations are solved, then an initial guess is required. So we need another constant that will provide initial guess. And because we have two joints, so we need to provide initial guess of both two joints.
But we know that for the initial position, both joints are at zero position. So we are going to give zero, zero as initial guess. And this vector is going to go over here. And that's it.
This block will provide us the configuration. But before that, we need to provide rigid body tree to this block as well. So double click on it, going to the properties. Then in this rigid body tree, type the name of the rigid body tree, which we already have in the workspace, which is this one, the UF2 underscore arm.
And then we have to select the last body, which is the tool as body three. After that, we have to adjust some solver parameters so that the iterative process doesn't take too long. And this tool works provide two options through which this iterative process can be solved. My experience is that Levinberg market process is much more state forward and provides better results.
Therefore, I'm going to use this solver. And for the added change, childrens, I'm going to increase it a bit so that the process of iterative solution becomes a bit faster. Moreover, in the exit conditions, I'm going to increase these tolerances just to speed up the process. Now we have the inverse mathematics block configured.
It will provide the configuration that is both joint angles and we need to provide these two joint angles to the reward and to demux it, that is to separate out the two angles from the configuration board. We need a demux. And this block can be blocked. We don't need this code for anything.
So I'm going to terminate it using a terminator and that's it. This is everything which we want. We are providing the trajectory and we know that this trajectory will move the end effector of our robot in a square. We are converting that trajectory into homogeneous transformation matrix.
That matrix, the will be called pose of the robot that is provided through inverse mathematics. This inverse mathematics block will convert the end effectors position into joint angles. Those joint angles will be provided to the robot and the robot will move. The movement of the robot will be mallured by the sensors which are placed on the joints and then those joint angle may be given to the forward kinematics, forward kinematics will calculate the end effectors position.
Now this end effectors position can be taken as a feedback and then matched with the trajectory which we provided. If these two things are different, then we will need some kind of control system in between them that will manage the differences. But right now we are not going to go into those details. So right now I'm going to run it and we will see that the robot is going to move on the trajectory that we provided.
We advised over here that the simulation is going to take a considerable time because all these things are being solved iteratively by the inverse mathematics block. It is going to take quite a lot of time. Moreover, if you adjust the tolerances to be much smaller values, then it will take more time but it will generate much smoother trajectories. So once the simulation is complete, you can redone this trajectory following of this manipulator to see that where this manipulator is going.
So from the top view, we can see that it is moving in a square and it is taking one second to move in the each segment of the square. You can view this thing from an isometric view or some other view as well. Now all the joint angles that are required by this robot so that the end effector will move in a square are being calculated by the inverse mathematics block and we don't need to worry about that what joint angles this robot should follow. So the learners, this was a very quick short video that how you can use the inverse mathematics block from robotic system toolworks and drive the manipulator on to your required trajectory.
That's all for this video. Thank you and take care.
