0
$\begingroup$

I have started my research with scara and cartesian robots for drawing robot. The gcodes are converted and given to robot. There are firmware like grbl, marlin, etc for this process. But I couldn't find any good source to understand how they are converting gcodes to motor commands.

I would like to create my own program for this process. Inorder to do it I need to know how it is working. So, can I get some help in understanding it.

$\endgroup$
1
  • 2
    $\begingroup$ Marlin and GRBL are open source. You could have a look at their code and documentation in more detail to pull out examples or approaches suitable for your research. github.com/MarlinFirmware github.com/grbl/grbl $\endgroup$
    – RowanP
    Commented Aug 11, 2021 at 22:02

1 Answer 1

1
$\begingroup$

The main role of the CNC controller is to "convert" G Code to motor commands. This is a highly complex function and many books have been written about this.

As a top level overview, the G-Code is first interpreted, by the Interpreter. This converts to textual form of the G-Code to an in-memory representations. At this point separating motion related commands to any other commands is done.

All motion related commands are processed in a motion buffer (used for the lookahead functionality). The lookahead is especially important for smooth trajectories. The geometrical path is created (corners are sightly rounded, tool radii are added/subtracted). After the path is geometrically created the trajectory (velocity, acceleration, jerk) components are added, based on the target speed set in the G-Code and the dynamical capabilities of the machine.

After the trajectory is created it is sent set as reference for the motor controller. Here the calculated values might be interpolated if needed.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.