I did some testing of sandify’s scara output. From the post I linked, the basic math is this:
alpha = acos(rho) * 3 / pi
X = theta + alpha
Y = theta - alpha
The 3/pi just converts from radians to our 6/rotation units.
I made a very simple shape, a single loop of a square, 100x100 on a 250mm polar table. I exported it as thetarho (5.6 KB) and scara.gcode (6.3 KB)
thetarho.gcode (5.6 KB)
In the theta rho file, I found the 5 major points (where the rho was the largest):
0.78540 0.40000
...
-0.78540 0.40000
...
-2.35619 0.40000
...
-3.92699 0.40000
...
-5.49779 0.40000
Theta rho draws nothing but arcs, so to make straight line segments, sandify breaks all of the lines into many dozens of coordinates to follow, so there were a lot of other lines in there.
I made a table to convert those key coordinates into scara gcode:
theta |
rho |
X |
Y |
0.7854 |
0.4 |
1.857 |
-0.357 |
-0.78540 |
0.4 |
0.357 |
-1.857 |
-2.356 |
0.4 |
-1.143 |
-3.357 |
-3.927 |
0.4 |
-2.643 |
-4.86 |
-5.498 |
0.4 |
-4.143 |
-6.357 |
I also grabbed the same pattern in scara gcode output. Since the shape is rotating around one way, both motors end up rotating a full circle between the beginning and the end. So these coordinates make sense, right?
-4.143 - 1.857 = -6.000
-6.357 - -0.357 = -6.000
Those are both one full rotation from start to finish.
And just scrolling through (I am just scanning the X values to look for matches and checking the Y values), I see these lines:
G01 X1.857 Y-0.357 ;;
...
G01 X0.357 Y-1.857 ;;
...
G01 X-1.143 Y-3.357 ;;
...
G01 X-2.643 Y-4.857 ;;
...
G01 X-4.143 Y-6.357 ;;
I added the ;; comments to make it clearer.
That’s doing exactly as predicted. Which isn’t a surprise, because I am only confirming my own model . The question remains, why would the gcode you found that went through my scripts be different than the gcode that you’re getting from sandify? Maybe there is a setting missing? Maybe there is a procedure that is missing?
The grbl controller should work very well for you. I don’t think trying to write any embedded code is the solution. We just have to figure out what is wrong with the gcode generation, or the procedure.