Emc Notes

Good diagram - http://www.isd.mel.nist.gov/projects/_emc/emcsoft.html
Source docs - docs/sourcecode.txt
Many files in src/emcmot/ do basically the same thing with different flavors eg: emcmot.c emstepmot.c

Main motion loops in src/emc/motion/control.c
- see get_pos_cmds, especially for coordinated motion

Motion planning:
if interpolators are empty
- get next points from cartesian planner
- run coordinated trajectory planner tpRunCycle
- do inverse kinematics of commanded trajectory positions
- add commanded points to per-joint spline (cubic) interpolators

Planner is in tp.c and tc.c

Motion queue:
tpAddLine and tpAddCircle add to queue
tpRunCycle consumes queue

Stepper notes
Stepgen selects velocity/steprate based on pos_cmd, and vel_cmd which is (new_pos - old_pos)/dt
It also can report current position back
Possible, maybe likely, that EMC uses this position feedback data to servo out accumulating error
Should watch following error plot on HAL scope

Potential Split

  • GUI
  • Parser
  • Trajectory planner ~1ms
  • Cublic interpolation coefficient generation


  • Cubic interpolation ~1ms
  • Pulse generation scheduling ~1ms
  • Pulse generation ~20us or interrupt on demand
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License