Saturday, August 22, 2009

Spiderwheels: motion...

Here is a video of a proof of concept I put together.


movement experiment of spider leg... from gavilan on Vimeo.


The materials are minimalistic and only for this experiment. You can clearly see that the leg is cycling through (D = 2, H = 3), then (D = 8, H = 3), then (D = 8, H = 4), then (D = 2, H = 4), then back. With two legs mounted on the front of my robot, this would be enough to propel it forward 6 inches per touch down.

Here is the source code:



#define servo2Pin 2
#define servo3Pin 3

int i;

void setup(){
  pinMode(servo2Pin, OUTPUT);
  pinMode(servo3Pin, OUTPUT);

  Serial.begin(9600);
}

float l1 = 4.5;
float l2 = 6;
float d,H;
void loop(){
  H = 3;
  for(d=2;d<8;d=d+0.2){
    for(i=0;i<1;i++){
      goToAngle(servo3Pin, hipAngle(d, H, l1, l2));
      goToAngle(servo2Pin, kneeAngle(d, H, l1, l2));
      delay(20);
    }
  }
  H = 4;
  for(d=8;d>2;d=d-0.2){
    for(i=0;i<1;i++){
      goToAngle(servo3Pin, hipAngle(d, H, l1, l2));
      goToAngle(servo2Pin, kneeAngle(d, H, l1, l2));
      delay(20);
    }
  }
}

int kneeAngle(float d, float H, float l1, float l2){
  return ((acos((l1*l1 + l2*l2 - d*d - H*H)/(2*l1*l2))*180)/PI);
}

int hipAngle(float d, float H, float l1, int l2){
  return 180 - (atan(d/H) + acos((l1*l1 - l2*l2 + d*d + H*H)/(2*l1*sqrt(d*d + H*H))))*180/PI;
}

void goToAngle(int pinNumber, int angle){
  if(angle <= 180 && angle >= 0){
    sendPulse(pinNumber, (600+(angle*9.72)));
  }
}

void sendPulse(int pinNumber, int pulseWidth){
  digitalWrite(pinNumber, HIGH);
  delayMicroseconds(pulseWidth);
  digitalWrite(pinNumber, LOW);
}


Fun stuff! 50 or so lines can do quite a bit!

Spiderwheels: algebra, geometry, and trigonometry...

I've been wanting to build a spider robot for a log time. I remember looking around the internet years ago to see if other people have done this. One project really stands out in my mind.



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, a2 + b2 = c2.




So...

k2 = D2 + H2
k = sqrt(D2 + H2).

Once we have k we can use the Law Of Cosines to find a2.

k2 = L12 + L22 - (2 * L1 * L2 * cos(a2))
cos(a2) = (L12 + L22 - D2 - H2) / (2 * L1 * L2)
a2 = cos-1( (L12 + L22 - D2 - H2) / (2 * L1 * L2) ).

Similarly, we can find a4.

a4 = cos-1( (L12 - L22 + D2 + H2) / (2 * L1 * sqrt(D2 + H2)) ).

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( (L12 - L22 + D2 + H2) / (2 * L1 * sqrt(D2 + H2)) ).

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.

Sunday, August 16, 2009

Spiderwheels: a step in the right direction...

If you've read some of my other blogs you will know that I have been attempting to get into robotics since I graduated college in 2008. This journey lead me to create my own 3d printer with help from the RepRap team. Though I am still working to improve the quality and speed of my prints I have passed the point where it requires intellectual work. I must move on. With what I currently know about robotics (which isn't a whole lot) I've put together an idea for my first robot. This project should sharpen my abilities in writing c / c++ applications under Linux. It should give me an introduction into streaming image processing, skin detection, face detection, and potentially face recognition. It will also be a good project for getting experience using micro-controllers, and servos. Finally, and I'm not 100% sure on this, it may be a good platform for starting an open-source project.

Now that I've laid out all of these very lofty goals let me step back and describe the project that I have envisioned and where it came from.

Every interesting robot has the following characteristics:

  • sensors

  • a brain

  • interaction

In terms of hardware this implies processing power, motors, camera... among other things. I've spent quite some time thinking through the best platform for my first robot when I stumbled across the following:



Above is a picture of an MSI Wind U100-420US Netbook. The amazing thing about a Wind is it weighs 2 lbs and can be purchased off the shelf for under $300. I was fortunate enough to find one on ebay for under $200. Built into this machine is a 1+ hr power supply, 1.6Ghrz processor, 1.3Mpix webcam, mic, speakers, wifi, and a 10 inch screen. Thus, this machine alone can supply a large amount of portable computing power, vision, hearing, speaking, wireless communication, and visual expression. The only gaping hole between this machine and an interesting robot is interaction. This is where my new friend the adruino microcontroller comes in.



This micro-controller is opensource and inexpensive. It is also really easy to program. I know of it because it is the brain for the Reprap. Micro-controllers, among other things, can tell servo motors what to do. A few lines of C, and a bunch of these



and you can have pretty cool interaction. My end goal is to build a six legged spider with these parts, but the servos alone cost $30 a piece. Considering three are needed per leg your are looking at a bit of saving up. I am going to start with only two legs and some wheels.

Monday, August 10, 2009

RepStrap: a whale of a tale...

A friend stopped by to nerd it out last week. He is known for a whale that he draws as part of his signature. Thus, a key element of the nerd out was designing and printing a 3D whale. Much fun was had by all.



More images can be found here:
http://dunajwiki.dyndns.org/mywikipedia/index.php/The_Whale

RepStrap: decor by repstrap...

My wife and I have been putting up curtains recently. The land lord doesn't particularly like holes in the wall so we have been using 3M tape as much as possible. I decided to have a little fun and design a kind of tieback hook that can be printed. I feel they turned out quite functional.




My dad was visiting with a new HD camera... so I had to take a video.


A RepStrap prints useful things... from gavilan on Vimeo.

Thursday, August 6, 2009

RepStrap: bigger parts...

I am finally starting to work on my projects again. I have taken an extended break from it all in order to spend more time with my wife between her classes. After returning to my projects the first challenge that I attempted to conquer was a common warping issue when printing ABS plastic. It wasn't really an issue when printing corner brackets and motor couplings. However, bigger pieces like the x carriage were near impossible. Luckily the solution was handed to me by nophead. It is clearly described in his Thoughts on rafts entry. After taking his suggestions into account I was finally able to print the x-carriage. Here are some pictures.