kinann

57 views
Skip to first unread message

Karl

unread,
Feb 18, 2017, 1:24:29 AM2/18/17
to FirePick
The Learn.js file was getting too big, so I exploded it into its own repository.
The Kinann repository is still coming together slowly, but you can follow my explorations here

Initial experimentation with Kinann artificial neural networks (ANN) for Cartesian 3-axis robots
such as FirePaste is very encouraging. I have modeled XY axis skew in unit tests and the coefficients
obtained during training (~60ms) match those  obtained through painful manual linear algebra calcs.
I've also experimented with introducing polynomial inputs for modeling Z-bowl error as seen on our 
FPDS. With luck, Kinann should support FPD as well. However, I'll keep focused on the Cartesian
Kinann for now so that I can work on automating calibration.

What I like about ANNs is that we can just show the ANN a series of examples that describe the
error corrections for as few as 12 positions. The ANN figures out weights on its own by doing lots
of math with lots of formulas and calculus.  I am really grateful that mathjs just recently released the expression
package with derivative(). I could not have done Kinann without this support and it's so cool that it
showed up just a few days before I needed it. Thank you mathjs!

I'll update this thread with developments...if you're curious about how ANNs work and how Kinann uses them,
just holler and I'll attempt to share my newfound understanding.

Karl

unread,
Feb 20, 2017, 8:22:03 PM2/20/17
to FirePick
I added a wiki page on Calibration with Kinann:

The page explains how to use Kinann to calibrate a robot to correct kinematic error.
Interestingly, this process may work for FPD as well as Cartesian robots
and SCARA. Kinann doesn't care about robot kinematics--all it
cares about is where the tool head is.


Joshua Pritt

unread,
Feb 20, 2017, 9:12:22 PM2/20/17
to fire...@googlegroups.com
That's freaking nuts! I looked at the code and it is a work of art. Crazy math makes even more crazy math all by itself. Mind = blown.
I still don't have a FPD yet so I'm looking forward to hearing how the calibration goes. 

--
You received this message because you are subscribed to the Google Groups "FirePick" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firepick+unsubscribe@googlegroups.com.
To post to this group, send email to fire...@googlegroups.com.
Visit this group at https://groups.google.com/group/firepick.
For more options, visit https://groups.google.com/d/optout.

Michael Anton

unread,
Feb 21, 2017, 4:36:33 AM2/21/17
to FirePick
Do you have any interest in an FPD?  I'd be interested in selling hard to get parts, or perhaps all of mine.

Mike


On Monday, February 20, 2017 at 7:12:22 PM UTC-7, Joshua Pritt wrote:
That's freaking nuts! I looked at the code and it is a work of art. Crazy math makes even more crazy math all by itself. Mind = blown.
I still don't have a FPD yet so I'm looking forward to hearing how the calibration goes. 
On Feb 20, 2017 8:22 PM, "Karl" <ka...@firepick.org> wrote:
I added a wiki page on Calibration with Kinann:

The page explains how to use Kinann to calibrate a robot to correct kinematic error.
Interestingly, this process may work for FPD as well as Cartesian robots
and SCARA. Kinann doesn't care about robot kinematics--all it
cares about is where the tool head is.


--
You received this message because you are subscribed to the Google Groups "FirePick" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firepick+u...@googlegroups.com.

Karl

unread,
Feb 21, 2017, 12:03:38 PM2/21/17
to FirePick
Thanks, Josh. :D

For me the most amazing experience was coding the inverseNetwork function that takes a 
neural network and trains a new one to be the inverse of the original.
It was really weird writing that because I kept thinking "this can't really work, or can it?"

I am deeply grateful to the mathjs folks. It is pretty incredible to work with code that does math.
For example, all the following is just cranked out. It's the gradient expression for a simple Kinann network.
Kinann then compiles all that into Javascript using new Function(), which I just started using a few weeks
ago for the first time. It's this kind of stuff that lends Javascript so much power over C++ or Java.

gradExpr {
  "w1b0": "(2 * (w1b0 - yt0 + w1r0c0 * x0 + w1r0c1 * x1 + w1r0c2 * x2 + w1r0c3 * x3) + 0) / 2",
  "w1b1": "(2 * (w1b1 - yt1 + w1r1c0 * x0 + w1r1c1 * x1 + w1r1c2 * x2 + w1r1c3 * x3) + 0) / 2",
  "w1b2": "(2 * (w1b2 - yt2 + w1r2c0 * x0 + w1r2c1 * x1 + w1r2c2 * x2 + w1r2c3 * x3) + 0) / 2",
  "w1b3": "(2 * (w1b3 - yt3 + w1r3c0 * x0 + w1r3c1 * x1 + w1r3c2 * x2 + w1r3c3 * x3) + 0) / 2",
  "w1r0c0": "(2 * (x0 + 0) * (w1b0 - yt0 + w1r0c0 * x0 + w1r0c1 * x1 + w1r0c2 * x2 + w1r0c3 * x3) + 0) / 2",
  "w1r0c1": "(2 * (x1 + 0) * (w1b0 - yt0 + w1r0c0 * x0 + w1r0c1 * x1 + w1r0c2 * x2 + w1r0c3 * x3) + 0) / 2",
  "w1r0c2": "(2 * (x2 + 0) * (w1b0 - yt0 + w1r0c0 * x0 + w1r0c1 * x1 + w1r0c2 * x2 + w1r0c3 * x3) + 0) / 2",
  "w1r0c3": "(2 * (x3 + 0) * (w1b0 - yt0 + w1r0c0 * x0 + w1r0c1 * x1 + w1r0c2 * x2 + w1r0c3 * x3) + 0) / 2",
  "w1r1c0": "(2 * (x0 + 0) * (w1b1 - yt1 + w1r1c0 * x0 + w1r1c1 * x1 + w1r1c2 * x2 + w1r1c3 * x3) + 0) / 2",
  "w1r1c1": "(2 * (x1 + 0) * (w1b1 - yt1 + w1r1c0 * x0 + w1r1c1 * x1 + w1r1c2 * x2 + w1r1c3 * x3) + 0) / 2",
  "w1r1c2": "(2 * (x2 + 0) * (w1b1 - yt1 + w1r1c0 * x0 + w1r1c1 * x1 + w1r1c2 * x2 + w1r1c3 * x3) + 0) / 2",
  "w1r1c3": "(2 * (x3 + 0) * (w1b1 - yt1 + w1r1c0 * x0 + w1r1c1 * x1 + w1r1c2 * x2 + w1r1c3 * x3) + 0) / 2",
  "w1r2c0": "(2 * (x0 + 0) * (w1b2 - yt2 + w1r2c0 * x0 + w1r2c1 * x1 + w1r2c2 * x2 + w1r2c3 * x3) + 0) / 2",
  "w1r2c1": "(2 * (x1 + 0) * (w1b2 - yt2 + w1r2c0 * x0 + w1r2c1 * x1 + w1r2c2 * x2 + w1r2c3 * x3) + 0) / 2",
  "w1r2c2": "(2 * (x2 + 0) * (w1b2 - yt2 + w1r2c0 * x0 + w1r2c1 * x1 + w1r2c2 * x2 + w1r2c3 * x3) + 0) / 2",
  "w1r2c3": "(2 * (x3 + 0) * (w1b2 - yt2 + w1r2c0 * x0 + w1r2c1 * x1 + w1r2c2 * x2 + w1r2c3 * x3) + 0) / 2",
  "w1r3c0": "(2 * (x0 + 0) * (w1b3 - yt3 + w1r3c0 * x0 + w1r3c1 * x1 + w1r3c2 * x2 + w1r3c3 * x3) + 0) / 2",
  "w1r3c1": "(2 * (x1 + 0) * (w1b3 - yt3 + w1r3c0 * x0 + w1r3c1 * x1 + w1r3c2 * x2 + w1r3c3 * x3) + 0) / 2",
  "w1r3c2": "(2 * (x2 + 0) * (w1b3 - yt3 + w1r3c0 * x0 + w1r3c1 * x1 + w1r3c2 * x2 + w1r3c3 * x3) + 0) / 2",
  "w1r3c3": "(2 * (x3 + 0) * (w1b3 - yt3 + w1r3c0 * x0 + w1r3c1 * x1 + w1r3c2 * x2 + w1r3c3 * x3) + 0) / 2"
}

Kinann will really help with calibration. Now the challenge is to take the measurements that Kinann needs for its magic.
A Cartesian robot needs at least 9 data points to calculate linear error. FPD would probably require a quadratic error
model for calibration. A quadratic model will require at least 27 points. That is a challenge, but it is still simpler than
the DeltaMesh code I wrote last year. For now I'm confining myself to really simple Cartesian FirePaste robot just
to work out the software architecture for autocalibration. I'll keep y'all posted as I dig in deeper.
Reply all
Reply to author
Forward
0 new messages