Wednesday, May 18, 2011

Acceleration Implementation

Last January I put together my most elaborate post on the acceleration solution. It's got lots of math, geometry, and pretty pictures. As I was writing it I was imagining the world reading it, critiquing it, learning from it, I don't know. I put a lot of effort into it, especially since I had to write it twice having lost the first draft somehow.

I spent the last 2 weeks or so coding the acceleration solution. The post I produced was really helpful for remembering the solution. It would have been really hard to write if all I had was my crappy sketches on paper. So I may have like 2 people reading this blog but it's serving me quite well.

Here's another test path designed to hit the three scenarios described in the other post:


m.forward(0.25f);
m.left(5);
m.forward(1.0f);
m.left(30);
m.forward(0.375f);
m.left(25);
m.forward(1.0f);
m.left(90);
m.forward(0.375f);
m.left(90);
m.forward(0.75f);
m.right(35);
m.forward(0.5f);


And the preview:


The yellow and purple lines are the path, the alternating colors to help see the different moves for debugging (a pair of purple lines together would indicate a "double point"). The brightness of the cubes (points) is proportional to the speed as the spindle moves through the point. I ran this on the machine and it looked good. The acceleration algorithm is based on the "full acceleration distance" or the distance it takes the spindle to move from zero to full speed. I just guessed at 1/2 an inch for this and it seems to work well. I'll write some code in the firmware to determine it very accurately later.

I've been using Java/Processing and a library called toxiclibs to write the host software. I write Java for a living so that's no big deal. Processing provides the 3D animation / visualization aspect. Toxiclibs provides a boat load of geometry classes that has made the path manipulation super easy. It's got 3D Vectors, Lines, etc. It's got routines for calculating the length of 3D lines, angles between them, even for splitting lines. I haven't had to use The Pythagorean Theorem at all. If it weren't for this technology the host software would be way too much work. I'm pretty psyched.

2 comments:

  1. I read & reread each and every post. Kung Fu Machinist Rocks!

    ReplyDelete
  2. Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. standard gravity to meters per square second

    ReplyDelete