Draw a robot arm with a hand that points downward in C#

[robot arm]

The example Draw a simple robot arm in C# shows how to use transformations to draw a robot arm with a “hand” that opens and closes. See that example for the basic explanation.

If you wanted to pick something up with the hand, then you might want the hand to always point downward. Then the question is, “What angle do you need to give the wrist to make the hand always point down?”

It turns out that this isn’t as hard as you might imagine. If the other robot arm joints have angles 0, then the wrist has to have an angle of 90 degrees to point downward. If the other joints don’t have angles of 0, then you simply add them to 90 degrees.

The example uses the following code to calculate the wrist angle.

float wrist_angle = 90 + scrJoint1.Value + scrJoint2.Value;

The rest of the program’s code is the same as in the same as before. See the previous example for additional details.

Download Example   Follow me on Twitter   RSS feed   Donate

About RodStephens

Rod Stephens is a software consultant and author who has written more than 30 books and 250 magazine articles covering C#, Visual Basic, Visual Basic for Applications, Delphi, and Java.
This entry was posted in algorithms, drawing, graphics and tagged , , , , , , , , , , . Bookmark the permalink.

1 Response to Draw a robot arm with a hand that points downward in C#

  1. Pingback: Make a robot arm track the mouse in C# - C# HelperC# Helper

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.