[Home]EmcConfig

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Note: this page is definately obsolete, the information presented is quite old. In the mean time emc2.2.x contains a new configurator called StepConf?

Old Information, just for historical reasons kept here:

The code to access this config file is on the EmcConfTickle page.

A page describing PROPOSED emcconfig config files,

Do NOT try and configure EMC with such stuff yet, as it doesnt work like this at the moment.

Here is an example XML Data Type Definition (DTD) for validation.

<?xml version="1.0"?>

<!DOCTYPE EMC [

	<!ATTLIST EMC NAME CDATA #IMPLIED>
	<!ELEMENT GENERAL (DEBUG?, NML_FILE)>
		<!ELEMENT DEBUG (#CDATA)>
		<!ELEMENT NML_FILEDEBUG (#CDATA)>
	<!ELEMENT DISPLAY (MODULE, CYCLE_TIME, HELP_FILE, POSITION_OFFSET, POSITION_FEEDBACK)>
		<!ELEMENT MODULE (#CDATA)>
		<!ELEMENT CYCLE_TIME (#CDATA)>
		<!ELEMENT HELP_FILE (#CDATA)>
		<!ELEMENT POSITION_OFFSET (#CDATA)>
		<!ELEMENT POSITION_FEEDBACK (#CDATA)>
	<!ELEMENT TASK (MODULE, CYCLE_TIME, MAX_FEED_OVERRIDE, MAX_SPEED_OVERRIDE, PROGRAM_PREFIX)>
		<!ELEMENT MODULE (#CDATA)>
		<!ELEMENT CYCLE_TIME (#CDATA)>
		<!ELEMENT MAX_FEED_OVERRIDE (#CDATA)>
		<!ELEMENT MAX_SPEED_OVERRIDE (#CDATA)>
		<!ELEMENT PROGRAM_PREFIX (#CDATA)>
	<!ELEMENT RS274NGC (LENGTH_UNITS, PARAMETERS)>
		<!ELEMENT LENGTH_UNITS (#CDATA)>
		<!ELEMENT PARAMETERS (PARAM*)>
			<!ELEMENT PARAM (#CDATA)>
				<!ATTLIST PARAM ID ID #REQUIRED>
	<!ELEMENT MOTION (MODULE, SHMEM_KEY, COMM_TIMEOUT, COMM_WAIT)>
		<!ELEMENT MODULE (#CDATA)>
		<!ELEMENT SHMEM_KEY (#CDATA)>
		<!ELEMENT BASE_PERIOD (#CDATA)>
		<!ELEMENT SERVO_PERIOD (#CDATA)>
		<!ELEMENT TRAJ_PERIOD (#CDATA)>
		<!ELEMENT COMM_TIMEOUT (#CDATA)>
		<!ELEMENT COMM_WAIT (#CDATA)>
	<!ELEMENT IO (MODULE, TOOL_TABLE)>
		<!ELEMENT MODULE (#CDATA)>
		<!ELEMENT TOOL_TABLE (NUM_SLOTS, TOOL*)>
			<!ELEMENT NUM_SLOTS (#CDATA)>
			<!ELEMENT TOOL (SLOT, LENGTH, DIAMETER)>
				<!ATTLIST TOOL ID ID #REQUIRED>
				<!ELEMENT SLOT (#CDATA)>
				<!ELEMENT LENGTH (#CDATA)>
				<!ELEMENT DIAMETER (#CDATA)>
	<!ELEMENT TRAJECTORY (PLANNER, AXIS+)>
		<!ELEMENT PLANNER (AXES, LINEAR_UNITS, ANGULAR_UNITS, DEFAULT_VELOCITY, MAX_VELOCITY, DEFAULT_ACCELERATION, MAX_ACCELERATION)>
			<!ELEMENT AXES (#CDATA)>
			<!ELEMENT LINEAR_UNITS (#CDATA)>
			<!ELEMENT ANGULAR_UNITS (#CDATA)>
			<!ELEMENT DEFAULT_VELOCITY (#CDATA)>
			<!ELEMENT MAX_VELOCITY (#CDATA)>
			<!ELEMENT DEFAULT_ACCELERATION (#CDATA)>
			<!ELEMENT MAX_ACCELERATION (#CDATA)>
		<!ELEMENT AXIS (TYPE, UNITS, HOME, MAX_VELOCITY, MAX_ACCELERATION, INPUT_SCALE, OUTPUT_SCALE, BACKLASH, PHYSICAL_LIMITS, DRIVER, HOME)>
			<!ATTLIST AXIS NAME ID #REQUIRED>
			<!ELEMENT TYPE (#CDATA)>
			<!ELEMENT UNITS (#CDATA)>
			<!ELEMENT MAX_VELOCITY (#CDATA)>
			<!ELEMENT MAX_ACCELERATION (#CDATA)>
			<!ELEMENT INPUT_SCALE (#CDATA)>
			<!ELEMENT OUTPUT_SCALE (#CDATA)>
			<!ELEMENT BACKLASH (#CDATA)>
			<!ELEMENT SOFTWARE_LIMITS (MIN, MAX)>
				<!ELEMENT MIN (#CDATA)>
				<!ELEMENT MAX (#CDATA)>
			<!ELEMENT DRIVER (P, I, D, FF0, FF1, FF2)>
				<!ELEMENT P (#CDATA)>
				<!ELEMENT I (#CDATA)>
				<!ELEMENT D (#CDATA)>
				<!ELEMENT FF0 (#CDATA)>
				<!ELEMENT FF1 (#CDATA)>
				<!ELEMENT FF2 (#CDATA)>
			<!ELEMENT HOME (P, I, D, FF0, FF1, FF2)>
				<!ELEMENT OFFSET (#CDATA)>
				<!ELEMENT SEARCH_VELOCITY (#CDATA)>
				<!ELEMENT LATCH_VELOCITY (#CDATA)>
				<!ELEMENT USE_INDEX (#CDATA)>
				<!ELEMENT IGNORE_LIMITS (#CDATA)>
	<!ELEMENT HAL (FILE*)>
		<!ELEMENT FILE (#CDATA)>
]>

Here is and example XML file.

<?xml version="1.0"?>

<EMC NAME="GENERIC" > <!--GENERAL SETTINGS-->

  <GENERAL>
    <DEBUG>NONE LOW MEDIUM HIGH VERY-HIGH</DEBUG>
    <NML_FILE>emc.nml</NML_FILE>
  </GENERAL>
<!-- DISPLAY SETTINGS -->
  <DISPLAY>
    <MODULE>TKEMC AXIS MINI</MODULE>
    <CYCLE_TIME>0.200</CYCLE_TIME>
    <HELP_FILE>doc/help.txt</HELP_FILE>
    <POSITION_OFFSET>RELATIVE</POSITION_OFFSET>
    <POSITION_FEEDBACK>ACTUAL</POSITION_FEEDBACK>
  </DISPLAY>
<!-- TASK-CONTROLLER SETTINGS -->
  <TASK>
    <MODULE>MILLTASK MINIMILLTASK</MODULE>
    <CYCLE_TIME>0.010</CYCLE_TIME>
    <MAX_FEED_OVERRIDE>1.2</MAX_FEED_OVERRIDE>
    <MAX_FEED_OVERRIDE>1.2</MAX_FEED_OVERRIDE>
    <PROGRAM_PREFIX>../nc_files/</PROGRAM_PREFIX>
  </TASK>
<!--G-CODE INTERPRETER SETTINGS-->
  <RS274NGC>
    <LENGTH_UNITS>MM</LENGTH_UNITS>
    <PARAMETERS>
      <PARAM ID="5161" >0</PARAM>
      <PARAM ID="5161" >0</PARAM>
      <PARAM ID="5161" >0</PARAM>
    </PARAMETERS>
  </RS274NGC>
<!--MOTION CONTROLLER SETTINGS-->
  <MOTION>
    <MODULE>MOTMOD</MODULE>
    <SHMEM_KEY>111</SHMEM_KEY>
    <BASE_PERIOD>0.000050</BASE_PERIOD>
    <SERVO_PERIOD>0.001000</SERVO_PERIOD>
    <TRAJ_PERIOD>0.010000</TRAJ_PERIOD>
    <COMM_TIMEOUT>1.0</COMM_TIMEOUT>
    <COMM_WAIT>0,010</COMM_WAIT>
  </MOTION>
<!-- IO CONTROLLER SETTINGS -->
  <IO>
    <MODULE>SIMIO IOCONTROL</MODULE>
    <TOOL_TABLE>
      <NUM_SLOTS>20</NUM_SLOTS>
      <TOOL ID="128" >
        <SLOT>2</SLOT>
        <LENGTH>2.5</LENGTH>
        <DIAMETER>0.5</DIAMETER>
      </TOOL>
      <TOOL ID="65" >
        <SLOT>3</SLOT>
        <LENGTH>2.5</LENGTH>
        <DIAMETER>0.5</DIAMETER>
      </TOOL>
      <TOOL ID="13" >
        <SLOT>4</SLOT>
        <LENGTH>2.5</LENGTH>
        <DIAMETER>0.5</DIAMETER>
      </TOOL>
      <TOOL ID="35" >
        <SLOT>5</SLOT>
        <LENGTH>2.5</LENGTH>
        <DIAMETER>0.5</DIAMETER>
      </TOOL>
    </TOOL_TABLE>
  </IO>
<!--TRAJECTORY PLANNER SETTINGS -->
  <TRAJECTORY>
    <PLANER>
<!-- NUMBER OF AXES -->
      <AXES>3</AXES>
<!-- DEFAULT UNITS -->
      <LINEAR_UNITS>1.0 0.03937007874016</LINEAR_UNITS>
      <ANGULAR_UNITS>1.0</ANGULAR_UNITS>
<!-- VELOCITY, ACCEL -->
      <DEFAULT_VELOCITY>0.10</DEFAULT_VELOCITY>
      <MAX_VELOCITY>1.2</MAX_VELOCITY>
      <DEFAULT_ACCELERATION>2.0</DEFAULT_ACCELERATION>
      <MAX_ACCELERATION>20.0</MAX_ACCELERATION>
    </PLANER>
<!-- AXIS CONFIGURATION -->
    <AXIS NAME="X" >
<!-- BASIC AXIS SETUP -->
      <TYPE>LINEAR ROTATORY</TYPE>
      <UNITS>1.0 0.03937007874016</UNITS>
<!-- VELOCITY, ACCEL -->
      <MAX_VELOCITY>1.2</MAX_VELOCITY>
      <MAX_ACCELERATION>20.0</MAX_ACCELERATION>
<!-- INPUT & OUTPUT SCALES -->
      <INPUT_SCALE>1000</INPUT_SCALE>
      <OUTPUT_SCALE>1000</OUTPUT_SCALE>
      <BACKLASH>0.000</BACKLASH>
      <SOFTWARE_LIMITS>
        <MIN>-150</MIN>
        <MAX>420</MAX>
      </SOFTWARE_LIMITS>
      <DRIVER TYPE="SEGMOTQUEUE" >
        <P>1000</P>
        0
        <D>0</D>
        <FF0>0</FF0>
        <FF1>0</FF1>
        <FF2>0</FF2>
      </DRIVER>
      <HOME>
        <OFFSET>0.000</OFFSET>
        <SEARCH_VELOCITY>0.0</SEARCH_VELOCITY>
        <LATCH_VELOCITY>0.0</LATCH_VELOCITY>
        <USE_INDEX>NO</USE_INDEX>
        <IGNORE_LIMITS>NO</IGNORE_LIMITS>
      </HOME>
    </AXIS>
    <AXIS NAME="Y" >
      <TYPE>LINEAR ROTATORY</TYPE>
      <UNITS>1.0 0.03937007874016</UNITS>
      <MAX_VELOCITY>1.2</MAX_VELOCITY>
      <MAX_ACCELERATION>20.0</MAX_ACCELERATION>
      <INPUT_SCALE>1000</INPUT_SCALE>
      <OUTPUT_SCALE>1000</OUTPUT_SCALE>
      <BACKLASH>0.000</BACKLASH>
      <SOFTWARE_LIMITS>
        <MIN>-150</MIN>
        <MAX>420</MAX>
      </SOFTWARE_LIMITS>
      <DRIVER TYPE="SEGMOTQUEUE" >
        <P>1000</P>
        0
        <D>0</D>
        <FF0>0</FF0>
        <FF1>0</FF1>
        <FF2>0</FF2>
      </DRIVER>
      <HOME>
        <OFFSET>0.000</OFFSET>
        <SEARCH_VELOCITY>0.0</SEARCH_VELOCITY>
        <LATCH_VELOCITY>0.0</LATCH_VELOCITY>
        <USE_INDEX>NO</USE_INDEX>
        <IGNORE_LIMITS>NO</IGNORE_LIMITS>
      </HOME>
    </AXIS>
    <AXIS NAME="Z" >
      <TYPE>LINEAR ROTATORY</TYPE>
      <UNITS>1.0 0.03937007874016</UNITS>
      <MAX_VELOCITY>1.2</MAX_VELOCITY>
      <MAX_ACCELERATION>20.0</MAX_ACCELERATION>
      <INPUT_SCALE>1000</INPUT_SCALE>
      <OUTPUT_SCALE>1000</OUTPUT_SCALE>
      <BACKLASH>0.000</BACKLASH>
      <SOFTWARE_LIMITS>
        <MIN>-150</MIN>
        <MAX>420</MAX>
      </SOFTWARE_LIMITS>
      <DRIVER TYPE="SEGMOTQUEUE" >
        <P>1000</P>
        0
        <D>0</D>
        <FF0>0</FF0>
        <FF1>0</FF1>
        <FF2>0</FF2>
      </DRIVER>
      <HOME>
        <OFFSET>0.000</OFFSET>
        <SEARCH_VELOCITY>0.0</SEARCH_VELOCITY>
        <LATCH_VELOCITY>0.0</LATCH_VELOCITY>
        <USE_INDEX>NO</USE_INDEX>
        <IGNORE_LIMITS>NO</IGNORE_LIMITS>
      </HOME>
    </AXIS>
  </TRAJECTORY>
<!-- HAL CONFIGURATION -->
  <HAL>
    <FILE>CORE_SERVO.HAL</FILE>
    <FILE>MOTENC_MOTION.HAL</FILE>
    <FILE>MOTENC_IO.HAL</FILE>
  </HAL>
</EMC>

Now ... you're probably thingink that looks complex .. but its fairly easy to 'fold' that ina a folding browser ...

Imagine you browse the config in some graphical way

perhaps:

[+]EMC Config

clicking on the link gets you:

[-]EMC Config
   [+]EMC
   [+]HAL
   [+]ClassicLadder

then maybe

[-]EMC Config
   [-]EMC
      Basic units      1.0
      Default Velocity 0.134
      [+]Axis X
      [+]Axis Y
      [+]Axis Z
      [+]Spindle
   [+]HAL
   [+]ClassicLadder

with a hierarchical configuration all this is not too hard, but with a 'flat' too, its quite rticky, unless the configuration software knows a lot about the format .. with a hierarchical config, the tool needs to know little about what its doing, new parameters can be included and should just work, without needing to fudge the toolset in some way ...

I did play a little yesterday with xml file parsing. By supper time my thought turned to the xml master file format. Maybe the format as already been decide upon. Any way here are some less than complete thoughts I had about the master file format.

One way:

<ini_parm>EMCMOT
<ini_section>EMCMOT</ini_section>
<parm_rule>all</parm_rule>
<parm_option>freqmod
<parm_option> smdromod
<parm_option>etc</parm_option>
<parm_help>help text or file? </parm_help
<parm_help_i18> ????
</ini_parm>

<ini_parm>PERIOD
<ini_section>EMCMOT</ini_section>
<parm_rule>freqmod
<parm_rule>others?</parm_rule>
<parm_option>Calculate</parm_option>
<parm_help>help text or file? </parm_help
<parm_help_i18> ????
</ini_parm>

<ini_parm>STEPPING_TYPE
<ini_section>EMCMOT</ini_section>
<parm_rule>freqmod
<parm_rule>others?</parm_rule>
<parm_option>1
<parm_option> 2
<parm_option>3
<parm_option>etc</parm_option>
<parm_help>help text or file? </parm_help
<parm_help_i18> ????
</ini_parm>

Another way:

<ini_parm>EMCMOT
<ini_section>EMCMOT</ini_section>
<parm_rule>all</parm_rule>
<parm_option>freqmod
<parm_option> smdromod
<parm_option>etc</parm_option>
<parm_help>help text or file? </parm_help
<parm_help_i18> ????
</ini_parm>

<ini_parm_module>freqmod
<parms_needed>PERIOD
<parms_needed>STEPPING_TYPE
<parms_needed>HOLD_TIME
<parm_needed>others needed parms</parm_needed>
</ini_parm_module>

[P.C.] I like the last one better - But.... With the modules being listed separately, do they also need to be listed in the :<ini_param> section ?
IMO the main sections should have options that are required by all modules, (input scale, units, min & max limits) and multiple ini_param_module sections detailing options specific to each (e.g. smdromod requires DRO_BASE_ADDRESS, PERIOD, & INPUT_SCALE, where as freqmod only needs PERIOD) - Below, a modified rendition... [/P.C.]

<ini_section>EMCMOT
<parm_parm>
<parm_option> module</parm_option>
<parm_option>IO_BASE_ADDRESS</parm_option>
<parm_help_i18> ????
</ini_parm>
;</ini_section>

<ini_parm_module>freqmod
<description "Basic stepper motor control"/>
<motor_type>stepper</motor_type>
<parms_needed>PERIOD</parms_needed>
<parms_needed>STEPPING_TYPE</parms_needed>
<parms_needed>HOLD_TIME</parms_needed>
<max_axis 6/>
</ini_parm_module>

<ini_parm_module>smdromod
<description "Stepper motor control with encoder feedback using the Kaluga DRO card"/>
<motor_type>stepper</motor_type>
<parms_needed>PERIOD</parms_needed>
<parms_needed>STEPPING_TYPE</parms_needed>
<parms_needed>HOLD_TIME</parms_needed>
<parms_needed>DRO_BASE_ADDRESS</parms_needed>
<parms_needed>INPUT_SCALE</parms_needed>
<max_axis 8/>
</ini_parm_module>

<ini_parm_module>Foomod
<description "Mixed mode control with custom PCI card"/>
<motor_type>stepper+servo</motor_type>
<parms_needed>INPUT_SCALE</parms_needed>
<parm_option_not_required>IO_BASE_ADDRESS</parm_option_not_required>
<max_axis=4/>
<provides_DIO_in=128/>
<provides_DIO_out=76/>
<provides_AIO_out=8/>
</ini_parm_module>

As I said this is only first thoughts and the xml format isn't correct. As of today my thoughts are that I may do a little experimenting using a xml master with my Python program. This may help you in deciding the format, if you haven't already dicided that.

Martin D. Krenz

It might be posible to do something similar to KBuild, like KBuildConfig?

If you actually want to be able to READ the file, you might want to take a look at SLiP?, or YAML: http://www.scottsweeney.com/projects/slip/ http://www.yaml.org/start.html


LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited November 24, 2007 4:12 am by Alex Joni (diff)
Search:
Published under a Creative Commons License