|TinyG & G2||GCodeCNCdemo|
The arc is approximated by generating a huge number of tiny, linear segments. The length of each segment is configured in settings.mm_per_arc_segment. Vector rotation by transformation matrix: r is the original vector, r_T is the rotated vector, and phi is the angle of rotation. Based on the solution approach by Jens Geisler.|
r_T = [cos(phi) -sin(phi);
sin(phi) cos(phi] * r ;
This approximation also allows mc_arc to immediately insert a line segment into the planner without the initial overhead of computing cos() or sin(). By the time the arc needs to be applied a correction, the planner should have caught up to the lag caused by the initial mc_arc overhead. This is important when there are successive arc motions.
|Using a midpoint circle interpolating algorithm, with tables for: dominate axis, octant steps etc.||Using a midpoint circle interpolating algorithm, with one switch statement to determine the octant and response.||Again an approximation method. The actual calculation is using straight line segments, SIN/COS for each straight line and a count down to finish.|
+Probably the fastest code. |
|(Just use GRBL instead..)||
-No speed control
?Unsure if all coordinates will work.
+Simple midpoint circle algoritm.|
-Only quadrant start/stops.
-No speed control.
+Simple to understand.|
-Code not found in repositories.
There 2 issue's:
Finally all the mechanical/electronic/software modules are connected.
Now it's possible to write G-Code in text file (only G0 & G1 are supported) and send this to the machine :)
Basically, the controller has 2 mayor functionalities:
Manual movement could be done by a PC screen, but it's more handy without PC interference, just working with a handheld.
CNC controller approach will be as follow:
One of my main challenges, was to implement the Bresenham algorithm in the Arduino. After reading a lot on the web, I programmed a 4-axis version. It's was running on 15.6 [kHz] or 62 [us/step], which if fast enough to run a stepper.
Maximum speed algorithm with arduino-uno: 64 [us/step] = 15625 [steps/sec] / 5 [micro stepping driver ] / 200 [steps/rev] * 5 (pitch: [mm/sec]) = 78 [mm/sec] = 4.68 [m/min] fast enough!