You can read all about the how on Zenta's blog.

The fluid movements of Zenta's six legged robot has inspired me to really put some thought into the mathematics behind the movement of a spider before I get too far with design and coding. After a few days of diagrams, equations, and some proofs of concept I have come up with some trigonometric functions that describe a subset of the movement of a spider. Now, let's dive in.

Consider the following:

Yes. That is correct. Spiders have legs. Now, consider the following:

A picture says a thousand words. What I am trying to convey with this one is that the joints that make up the leg of a spider have ranges of motion. At one given point in time the position of this leg can be described by two angles, i.e. the hip and knee, angles. These angles are key because they are "servo speak".

Now, wouldn't be good fun if we could describe the position of the leg in terms

*D*and

*H*in the following diagram?

Considering I will be building these legs I will know

*L1*and

*L2*. So,

**given**.

*L1*,*L2*,*D*, and*H*, how do we find*a1*and*a2*The first step is to find

*k*. According to Pythagoras,

*a*

^{2}+

*b*

^{2}=

*c*

^{2}.

So...

*k*

^{2}=

*D*

^{2}+

*H*

^{2}

**.**

*k*= sqrt(*D*^{2}+*H*^{2})Once we have

*k*we can use the Law Of Cosines to find

*a2*.

*k*

^{2}=

*L1*

^{2}+

*L2*

^{2}- (2 *

*L1**

*L2** cos(

*a2*))

cos(

*a2*) = (

*L1*

^{2}+

*L2*

^{2}-

*D*

^{2}-

*H*

^{2}) / (2 *

*L1**

*L2*)

**.**

*a2*= cos^{-1}( (*L1*^{2}+*L2*^{2}-*D*^{2}-*H*^{2}) / (2 **L1***L2*) )Similarly, we can find

*a4*.

**.**

*a4*= cos^{-1}( (*L1*^{2}-*L2*^{2}+*D*^{2}+*H*^{2}) / (2 **L1** sqrt(*D*^{2}+*H*^{2})) )We also know that

tan(

*a3*) = D / H

**.**

*a3*= tan^{-1}(D / H)Finally, we can solve for

*a1*.

*a1*= 180� -

*a3*-

*a4*

**.**

*a1*= 180� - tan^{-1}(D / H) - cos^{-1}( (*L1*^{2}-*L2*^{2}+*D*^{2}+*H*^{2}) / (2 **L1** sqrt(*D*^{2}+*H*^{2})) )In my next blog entry I will show a video of some proof of concept work, as well as share the source code that makes it all happen.

## No comments:

## Post a Comment