Robot control part 7: OSC of a 3-link arm

So we’ve done control for the 2-link arm, and control of the one link arm is trivial (where we control joint angle, or x or y coordinate of the pendulum), so here I’ll just show an implementation of operation space control for a more interesting arm model, the 3-link arm model. The code can all be found up on my Github.

In theory there’s nothing different or more difficult about controlling a 3-link arm versus a 2-link arm. For the inertia matrix, what I ended up doing here is just jacking up all the values of the matrix to about 100, which causes the controller to way over control the arm, and you can see the torques are much larger than they would need to be if we had an accurate inertia matrix. But the result is the same super straight trajectories that we’ve come to expect from operational space control:

3link

It’s a little choppy because I cut out a bunch of frames to keep the gif size down. But you get the point, it works. And quite well!

Because this is also a 3-link arm now and our task space force signal is 2D, we have redundant space of solutions, meaning that the task space control signal can be carried out in a number of ways. In other words, a null space exists for this controller. This means that we can throw another controller in our system to operate inside the null space of the first controller. We’ve already worked through all the math for this, so it’s straightforward to implement.

What kind of null space controller should we put in? Well, you may have noticed in the above animation the arm goes through itself, here’s another example:

3linknonull

Often it’s desirable to avoid this (because of physics or whatever), so what we can do is add a secondary controller that works to keep the arm’s elbow and wrist near some comfortable default angles. When we do this we get the following:

3linknull

And there you have it! Operational space control of a three link arm with a secondary controller in the null space to try to keep the angles near their default / resting positions.

I also added mouse based control to the arm so it will try to follow your mouse when you move over the figure, which makes it pretty fun to explore the power of the controller. It’s interesting to see where the singularities become an issue, and how having a null space controller that’s operating in joint space can actually come to help the system move through those problem points more smoothly. Check it out! It’s all up on my Github.

Tagged , , , , , ,

8 thoughts on “Robot control part 7: OSC of a 3-link arm

  1. thesuisse says:

    thanks for sharing¡¡, I’m doing a course in robotics and python use, this really helps me to complete the course to avoid using language that is adopted Matlab

  2. Aisha says:

    how can i do this same thing in matlab?

  3. Jovian5 says:

    Hi Travis,
    I tried to look for your GitHub link but it gives 404 error. Can u please provide a good link?

    • travisdewolf says:

      Hello! Sorry about that I changed things around on my github a while ago, the link should work now! You can run the demo in this script with ‘python run.py arm3 osc random_movements’
      Cheers!

  4. Jovian5 says:

    Thanks Travis for the prompt reply!! I ran the combination of ‘arm3 osc X’ and it worked great. Gave me a great insight into 3link manipulators. Thanks for the thorough tutorials.
    However, I couldn’t get it worked for ‘arm3 dmp X.’ Can you guide me thru for dmp cases?
    Also, in the ‘task’ folder, write.pyc is not present; how can I generate this file using write.py?

    Thanks again!

    • travisdewolf says:

      Hi Jovian, you’re welcome! Glad the code is helpful!
      I really need to add a section on how to give commands to the code, if you look in the run.py file it might provide some insight for different options, but it’s really not clear. To use the dmp system you’ll do a command like
      python run.py arm3 dmp write –sequence=”hello”
      where the sequence option can be any string of characters that you find in the tasks/write_data folder (with no spaces).
      Hopefully things compile for you now, I had named a folder and a file both ‘write’ which was confusing the system, if you do another pull i’ve fixed that in the master branch.
      Let me know!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: