Closed amcewen closed 8 years ago
Not machinekit, but possibly useful code at polargraph.co.uk/sourcecode
The code is here: https://github.com/euphy/polargraphcontroller/blob/2016-01-26-23-24/Machine.pde#L310
Turns out the conversion functions are pretty trivial.
If top left is (0,0) and top right is (width,0) and string is at (x,y) (where y<0) then stringleft = ConstL + dist(x,y) stringright = ConstR + dist(width-x, y)
Conversion back is a bit harder.
x^2 + y^2 = sl^2 (x-width)^2 + y^2 = sr^2 subtracting: 2.width.x + width^2 = sl^2 - sr^2 x = (sl^2 - sr^2)/(2.width) y = sqrt(sl^2 - x^2)
These should be coded into a new version of the kinematics file as xytojoints() and jointstoxy()
This new file needs to be referenced in the INI file and for it to be compiled.
It ought to be possible trim down all the parameters (except for width) and set the values in the INI file to control the gearing and the home stops. You can set the width through the HAL configuration. This means that everything can be configured in the field.
The INI file will also set limits on the acceleration and max speed (lower acceleration, and high speeds are okay here), and it will compensate for going round corners.
Code above has been put into mk7skins.c and committed. Appears to work.
This software issue with machinekit appears solved and it's now hardware engineering from here on.
There are lots of Polargraphs around so it's quite possible someone has already worked out how to drive it from Machinekit.
Although wiring up the steppers is done, we still need to work out the code to map the geometry from X/Y to polar coords, and it'll be easier to reuse someone else's work.
So if anyone finds a link to a Machinekit Polargraph, or similar info, post it in as a comment.