Hacker News new | ask | show | jobs
by 392 557 days ago
That's odd, have you profiled it?
1 comments

I took a look at the code that I started with and... it is kinda horrible.

https://github.com/AnykeyNL/Quincy/blob/master/coordcalc.py#...

There is a loop in a loop that goes through all the possible values of x and y to find the correct ones. No wonder it's so slow!

The scipy solver - inspired by the original article, I used https://docs.scipy.org/doc/scipy/reference/generated/scipy.o... - isn't much faster though (from reading the docs, it's just a smarter random search).

I guess it's time to learn some linear algebra (again!) and create a custom algorithm.

Did you try using the previous configuration as an initial guess to the numerical optimizer? If the next position is close to the previous one, the solver should be very quick.

Also, you can probably get much faster results if you obtain the gradient of the forward kinematics.

Thanks, much appreciated! I will try that.

I am trying multiple optimizations right now, mostly centered around reducing the amount of lookups required.