Advertisement
Einar

Untitled

Sep 17th, 2013
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.24 KB | None | 0 0
  1. univstep.ini
  2. # EMC controller parameters for generic controller. Make these what you need
  3. # for your system.
  4.  
  5. # General note: Comments can either be preceded with a # or ; - either is
  6. # acceptable, although # is in keeping with most linux config files.
  7.  
  8.  
  9. # General section -------------------------------------------------------------
  10. [EMC]
  11.  
  12. # Version of this INI file
  13. VERSION = $Revision$
  14.  
  15. # Name of machine, for use with display, etc.
  16. MACHINE = LinuxCNC-UNIVSTEP
  17.  
  18. # Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
  19. # DEBUG = 0
  20. # DEBUG = 0x00000007
  21. DEBUG = 0x7FFFFFFF
  22.  
  23. # Sections for display options ------------------------------------------------
  24. [DISPLAY]
  25.  
  26. # Name of display program, e.g., xemc
  27. DISPLAY = axis
  28. # DISPLAY = usrmot
  29. # DISPLAY = tkemc
  30. # Cycle time, in seconds, that display will sleep between polls
  31. CYCLE_TIME = 0.100
  32.  
  33. # Path to help file
  34. HELP_FILE = tklinucnc.txt
  35.  
  36. # Initial display setting for position, RELATIVE or MACHINE
  37. POSITION_OFFSET = RELATIVE
  38.  
  39. # Initial display setting for position, COMMANDED or ACTUAL
  40. POSITION_FEEDBACK = ACTUAL
  41.  
  42. # Highest value that will be allowed for feed override, 1.0 = 100%
  43. MAX_FEED_OVERRIDE = 1.2
  44.  
  45. # Prefix to be used
  46. PROGRAM_PREFIX = /home/einar/linuxcnc/nc_files
  47.  
  48. # Introductory graphic
  49. INTRO_GRAPHIC = linuxcnc.gif
  50. INTRO_TIME = 2
  51.  
  52. # Enable popup balloon help
  53. BALLOON_HELP = 1
  54.  
  55. # Task controller section -----------------------------------------------------
  56. [TASK]
  57.  
  58. # Name of task controller program, e.g., milltask
  59. TASK = milltask
  60.  
  61. # Cycle time, in seconds, that task controller will sleep between polls
  62. CYCLE_TIME = 0.010
  63.  
  64. # Part program interpreter section --------------------------------------------
  65. [RS274NGC]
  66.  
  67. # File containing interpreter variables
  68. PARAMETER_FILE = univstep.var
  69.  
  70. # Motion control section ------------------------------------------------------
  71. [EMCMOT]
  72.  
  73. EMCMOT = motmod
  74.  
  75. # Timeout for comm to emcmot, in seconds
  76. COMM_TIMEOUT = 1.0
  77.  
  78. # Interval between tries to emcmot, in seconds
  79. COMM_WAIT = 0.010
  80.  
  81. # Servo task period, in nanoseconds
  82. SERVO_PERIOD = 1000000
  83.  
  84. # Hardware Abstraction Layer section --------------------------------------------------
  85. [HAL]
  86.  
  87. # The run script first uses halcmd to execute any HALFILE
  88. # files, and then to execute any individual HALCMD commands.
  89. #
  90.  
  91. # list of hal config files to run through halcmd
  92. # files are executed in the order in which they appear
  93. HALFILE = univstep_load.hal
  94. HALFILE = univstep_servo.hal
  95. HALFILE = univstep_motion.hal
  96. HALFILE = univstep_io.hal
  97.  
  98. # list of halcmd commands to execute
  99. # commands are executed in the order in which they appear
  100. #HALCMD = save neta
  101.  
  102. # Trajectory planner section --------------------------------------------------
  103. [TRAJ]
  104.  
  105. AXES = 4
  106. # COORDINATES = X Y Z R P W
  107. COORDINATES = X Y Z A
  108. HOME = 0 0 0 0
  109. LINEAR_UNITS = inch
  110. ANGULAR_UNITS = degree
  111. CYCLE_TIME = 0.010
  112. DEFAULT_VELOCITY = 0.0167
  113. MAX_VELOCITY = 1.20
  114. DEFAULT_ACCELERATION = 15.0
  115. MAX_ACCELERATION = 20.0
  116.  
  117. # Axes sections ---------------------------------------------------------------
  118.  
  119. # First axis
  120. [AXIS_0]
  121.  
  122. TYPE = LINEAR
  123. HOME = 0.000
  124. MAX_VELOCITY = 1.20
  125. MAX_ACCELERATION = 20.0
  126. PID_MAX_VEL = 1.25
  127. BACKLASH = 0.000
  128. SCALE = 4000
  129. OUTPUT_SCALE = 1.000
  130. MIN_LIMIT = -10.0
  131. MAX_LIMIT = 10.0
  132. FERROR = 0.0100
  133. MIN_FERROR = 0.001
  134. HOME_OFFSET = 0.0
  135. HOME_SEARCH_VEL = 0.0
  136. HOME_LATCH_VEL = 0.0
  137. HOME_USE_INDEX = NO
  138. HOME_IGNORE_LIMITS = NO
  139. DEADBAND = 0.000126
  140. P = 150
  141. I = 100
  142. D = 0.1
  143. BIAS = 0.0
  144. FF0 = 0
  145. FF1 = 1
  146. FF2 = 0.0
  147.  
  148.  
  149. # Second axis
  150. [AXIS_1]
  151.  
  152. TYPE = LINEAR
  153. HOME = 0.000
  154. MAX_VELOCITY = 1.20
  155. MAX_ACCELERATION = 20.0
  156. PID_MAX_VEL = 1.25
  157. BACKLASH = 0.000
  158. SCALE = 4000
  159. OUTPUT_SCALE = 1.000
  160. MIN_LIMIT = -10.0
  161. MAX_LIMIT = 10.0
  162. FERROR = 0.010
  163. MIN_FERROR = 0.001
  164. HOME_OFFSET = 0.0
  165. HOME_SEARCH_VEL = 0.0
  166. HOME_LATCH_VEL = 0.0
  167. HOME_USE_INDEX = NO
  168. HOME_IGNORE_LIMITS = NO
  169. DEADBAND = 0.000126
  170. P = 150
  171. I = 100
  172. D = 0.1
  173. BIAS = 0.0
  174. FF0 = 0
  175. FF1 = 1
  176. FF2 = 0.0
  177.  
  178. # Third axis
  179. [AXIS_2]
  180.  
  181. TYPE = LINEAR
  182. HOME = 0.0
  183. MAX_VELOCITY = 1.20
  184. MAX_ACCELERATION = 20.0
  185. PID_MAX_VEL = 1.25
  186. BACKLASH = 0.000
  187. SCALE = 4000
  188. OUTPUT_SCALE = 1.000
  189. MIN_LIMIT = -10.0
  190. MAX_LIMIT = 10.0
  191. FERROR = 0.010
  192. MIN_FERROR = 0.001
  193. HOME_OFFSET = 0.0
  194. HOME_SEARCH_VEL = 0.0
  195. HOME_LATCH_VEL = 0.0
  196. HOME_USE_INDEX = NO
  197. HOME_IGNORE_LIMITS = NO
  198. DEADBAND = 0.000126
  199. P = 150
  200. I = 100
  201. D = 0.1
  202. BIAS = 0.0
  203. FF0 = 0
  204. FF1 = 1
  205. FF2 = 0.0
  206.  
  207. # Fourth axis
  208. [AXIS_3]
  209.  
  210. TYPE = ANGULAR
  211. HOME = 0.0
  212. MAX_VELOCITY = 65
  213. MAX_ACCELERATION = 20.0
  214. PID_MAX_VEL = 66
  215. BACKLASH = 0.000
  216. SCALE = 11.11111111
  217. OUTPUT_SCALE = 1.000
  218. MIN_LIMIT = -3600.0
  219. MAX_LIMIT = 3600.0
  220. FERROR = 0.1
  221. MIN_FERROR = 0.2
  222. HOME_OFFSET = 0.0
  223. HOME_SEARCH_VEL = 0.0
  224. HOME_LATCH_VEL = 0.0
  225. HOME_USE_INDEX = NO
  226. HOME_IGNORE_LIMITS = NO
  227. DEADBAND = 0.046
  228. P = 150
  229. I = 100
  230. D = 0.1
  231. BIAS = 0.0
  232. FF0 = 0
  233. FF1 = 1
  234. FF2 = 0.0
  235.  
  236.  
  237. # section for main IO controller parameters -----------------------------------
  238. [EMCIO]
  239.  
  240. # Name of IO controller program, e.g., io
  241. EMCIO = io
  242.  
  243. # cycle time, in seconds
  244. CYCLE_TIME = 0.100
  245.  
  246. # tool table file
  247. TOOL_TABLE = univstep.tbl
  248.  
  249. --------------------------
  250. univstep_load.hal:
  251. # sample file pulls all load commands into a single file
  252. # when emc2 starts it loads iocontrol
  253.  
  254. # kinematics
  255. loadrt trivkins
  256. # motion controller, get name and thread periods from ini file
  257. loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
  258.  
  259. # next load the PID module, for four PID loops
  260. loadrt pid num_chan=4
  261.  
  262. # install driver
  263. loadrt hal_ppmc
  264.  
  265. # make some signals for the scope for tuning.
  266. loadrt ddt count=4
  267. # add components for E-stop logic
  268. loadrt estop_latch count=1
  269. loadrt and2 count=1
  270.  
  271. # set up the realtime thread
  272. # read inputs first
  273. addf ppmc.0.read servo-thread
  274. # then run the motion controller
  275. addf motion-command-handler servo-thread
  276. addf and2.0 servo-thread
  277. addf estop-latch.0 servo-thread
  278. addf motion-controller servo-thread
  279. # then the PID loops
  280. addf pid.0.do-pid-calcs servo-thread
  281. addf pid.1.do-pid-calcs servo-thread
  282. addf pid.2.do-pid-calcs servo-thread
  283. addf pid.3.do-pid-calcs servo-thread
  284. # write outputs last
  285. addf ppmc.0.write servo-thread
  286.  
  287. ----------------
  288. univstep_motion.hal:
  289. # HAL config file for Pico Systems USC board
  290.  
  291. # set sane pulse timing - these are basically Gecko numbers
  292. # both pulse width and space are set to 3.5 uS, to prevent
  293. # problems if the outputs are inverted externally
  294. setp ppmc.0.stepgen.00-03.pulse-width-ns 3500
  295. setp ppmc.0.stepgen.00-03.pulse-space-min-ns 3500
  296. # setup time is set to 1 uS
  297. setp ppmc.0.stepgen.00-03.setup-time-ns 1000
  298.  
  299. # connect position feedback signals to encoders
  300. net Xpos-fb <= ppmc.0.encoder.00.position
  301. net Ypos-fb <= ppmc.0.encoder.01.position
  302. net Zpos-fb <= ppmc.0.encoder.02.position
  303. net Apos-fb <= ppmc.0.encoder.03.position
  304.  
  305. # get feedback scaling from ini file
  306. setp ppmc.0.encoder.00.scale [AXIS_0]SCALE
  307. setp ppmc.0.encoder.01.scale [AXIS_1]SCALE
  308. setp ppmc.0.encoder.02.scale [AXIS_2]SCALE
  309. setp ppmc.0.encoder.03.scale [AXIS_3]SCALE
  310.  
  311. # connect PID output signals to step generators
  312. net Xoutput => ppmc.0.stepgen.00.velocity
  313. net Youtput => ppmc.0.stepgen.01.velocity
  314. net Zoutput => ppmc.0.stepgen.02.velocity
  315. net Aoutput => ppmc.0.stepgen.03.velocity
  316.  
  317. # connect axis enables to step generators
  318. net Xenable => ppmc.0.stepgen.00.enable
  319. net Yenable => ppmc.0.stepgen.01.enable
  320. net Zenable => ppmc.0.stepgen.02.enable
  321. net Aenable => ppmc.0.stepgen.03.enable
  322.  
  323. # set output scaling from ini file
  324. # input and output scales should (normally) be the same for a USC
  325. setp ppmc.0.stepgen.00.scale [AXIS_0]SCALE
  326. setp ppmc.0.stepgen.01.scale [AXIS_1]SCALE
  327. setp ppmc.0.stepgen.02.scale [AXIS_2]SCALE
  328. setp ppmc.0.stepgen.03.scale [AXIS_3]SCALE
  329.  
  330. # add a couple of tuning test links
  331. # if these are useful will want to add them to the other axes as well
  332. # or make these setup with the tuning script
  333. net Xoutput ddt.0.in
  334. net Xpos-fb ddt.1.in
  335.  
  336. ----------------------
  337. univstep_servo.hal:
  338. # HAL config file for servos -- expanded from core_servo.hal
  339. # for a full four axis setup
  340.  
  341. # create four position feedback signals
  342.  
  343. # connect position feedback to PID loop
  344. net Xpos-fb => pid.0.feedback
  345. net Ypos-fb => pid.1.feedback
  346. net Zpos-fb => pid.2.feedback
  347. net Apos-fb => pid.3.feedback
  348.  
  349. # connect position feedback to motion module
  350. net Xpos-fb => axis.0.motor-pos-fb
  351. net Ypos-fb => axis.1.motor-pos-fb
  352. net Zpos-fb => axis.2.motor-pos-fb
  353. net Apos-fb => axis.3.motor-pos-fb
  354.  
  355. # create PID to DAC output signals
  356.  
  357. # connect output signals to output of PID loops
  358. net Xoutput <= pid.0.output
  359. net Youtput <= pid.1.output
  360. net Zoutput <= pid.2.output
  361. net Aoutput <= pid.3.output
  362.  
  363. # set PID loop output limits to +/-1.00
  364. setp pid.0.maxoutput [AXIS_0]PID_MAX_VEL
  365. setp pid.1.maxoutput [AXIS_1]PID_MAX_VEL
  366. setp pid.2.maxoutput [AXIS_2]PID_MAX_VEL
  367. setp pid.3.maxoutput [AXIS_3]PID_MAX_VEL
  368.  
  369. # set PID loop gains
  370. setp pid.0.Pgain [AXIS_0]P
  371. setp pid.0.Igain [AXIS_0]I
  372. setp pid.0.Dgain [AXIS_0]D
  373. setp pid.0.bias [AXIS_0]BIAS
  374. setp pid.0.FF0 [AXIS_0]FF0
  375. setp pid.0.FF1 [AXIS_0]FF1
  376. setp pid.0.FF2 [AXIS_0]FF2
  377. setp pid.0.deadband [AXIS_0]DEADBAND
  378.  
  379. setp pid.1.Pgain [AXIS_1]P
  380. setp pid.1.Igain [AXIS_1]I
  381. setp pid.1.Dgain [AXIS_1]D
  382. setp pid.1.bias [AXIS_1]BIAS
  383. setp pid.1.FF0 [AXIS_1]FF0
  384. setp pid.1.FF1 [AXIS_1]FF1
  385. setp pid.1.FF2 [AXIS_1]FF2
  386. setp pid.1.deadband [AXIS_1]DEADBAND
  387.  
  388. setp pid.2.Pgain [AXIS_2]P
  389. setp pid.2.Igain [AXIS_2]I
  390. setp pid.2.Dgain [AXIS_2]D
  391. setp pid.2.bias [AXIS_2]BIAS
  392. setp pid.2.FF0 [AXIS_2]FF0
  393. setp pid.2.FF1 [AXIS_2]FF1
  394. setp pid.2.FF2 [AXIS_2]FF2
  395. setp pid.2.deadband [AXIS_2]DEADBAND
  396.  
  397. setp pid.3.Pgain [AXIS_3]P
  398. setp pid.3.Igain [AXIS_3]I
  399. setp pid.3.Dgain [AXIS_3]D
  400. setp pid.3.bias [AXIS_3]BIAS
  401. setp pid.3.FF0 [AXIS_3]FF0
  402. setp pid.3.FF1 [AXIS_3]FF1
  403. setp pid.3.FF2 [AXIS_3]FF2
  404. setp pid.3.deadband [AXIS_3]DEADBAND
  405.  
  406. # create four position command signals
  407.  
  408. # connect position commands to motion controller
  409. net Xpos-cmd <= axis.0.motor-pos-cmd
  410. net Ypos-cmd <= axis.1.motor-pos-cmd
  411. net Zpos-cmd <= axis.2.motor-pos-cmd
  412. net Apos-cmd <= axis.3.motor-pos-cmd
  413.  
  414. # connect position commands to PID input
  415. net Xpos-cmd => pid.0.command
  416. net Ypos-cmd => pid.1.command
  417. net Zpos-cmd => pid.2.command
  418. net Apos-cmd => pid.3.command
  419.  
  420. # create bit signals to enable/disable the PID loops
  421.  
  422. # connect the signals to the motion controller
  423. net Xenable <= axis.0.amp-enable-out
  424. net Yenable <= axis.1.amp-enable-out
  425. net Zenable <= axis.2.amp-enable-out
  426. net Aenable <= axis.3.amp-enable-out
  427.  
  428. # connect the signals to the PID blocks
  429. net Xenable => pid.0.enable
  430. net Yenable => pid.1.enable
  431. net Zenable => pid.2.enable
  432. net Aenable => pid.3.enable
  433.  
  434. --------------------------
  435. univstep_io.hal:
  436. # HAL config file for Pico Systems USC board
  437. #
  438. # Connect motion controller I/Os
  439. #
  440.  
  441. # connect limit/home switch outputs to motion controller
  442. net Xminlim <= ppmc.0.din.01.in
  443. net Xminlim => axis.0.neg-lim-sw-in
  444. net Xmaxlim <= ppmc.0.din.02.in
  445. net Xmaxlim => axis.0.pos-lim-sw-in
  446. net Xhome <= ppmc.0.din.00.in
  447. net Xhome => axis.0.home-sw-in
  448.  
  449. net Yminlim <= ppmc.0.din.05.in
  450. net Yminlim => axis.1.neg-lim-sw-in
  451. net Ymaxlim <= ppmc.0.din.06.in
  452. net Ymaxlim => axis.1.pos-lim-sw-in
  453. net Yhome <= ppmc.0.din.04.in
  454. net Yhome => axis.1.home-sw-in
  455.  
  456. net Zminlim <= ppmc.0.din.09.in
  457. net Zminlim => axis.2.neg-lim-sw-in
  458. net Zmaxlim <= ppmc.0.din.10.in
  459. net Zmaxlim => axis.2.pos-lim-sw-in
  460. net Zhome <= ppmc.0.din.08.in
  461. net Zhome => axis.2.home-sw-in
  462.  
  463. net Aminlim <= ppmc.0.din.12.in
  464. net Aminlim => axis.3.neg-lim-sw-in
  465. net Amaxlim <= ppmc.0.din.13.in
  466. net Amaxlim => axis.3.pos-lim-sw-in
  467. net Ahome <= ppmc.0.din.11.in
  468. net Ahome => axis.3.home-sw-in
  469.  
  470.  
  471. # connect index pulses to motion controller
  472. # uncomment these lines only if you have a Rev 2 USC board
  473. #newsig Xindex bit
  474. #newsig Yindex bit
  475. #newsig Zindex bit
  476. #linksp Xindex <= ppmc.0.encoder.00.index-enable
  477. #linksp Xindex => axis.0.index-enable
  478. #linksp Yindex <= ppmc.0.encoder.01.index-enable
  479. #linksp Yindex => axis.1.index-enable
  480. #linksp Zindex <= ppmc.0.encoder.02.index-enable
  481. #linksp Zindex => axis.2.index-enable
  482.  
  483. #
  484. # Connect I/O controller I/Os
  485. #
  486.  
  487. # connect e-stop write/sense to I/O controller
  488. # and univstep's fault with estop's output, so estop FF is reset, but
  489. # prevent continued estop signal from univstep from holding FF cleared
  490. net ppmcEstop ppmc.0.din.15.in-not
  491. net ppmcEstop and2.0.in0
  492. net EstopOkIn estop-latch.0.fault-in
  493. net EstopOkIn and2.0.out
  494. net EstopOkOut <= ppmc.0.dout.07.out
  495. net EstopOkOut iocontrol.0.emc-enable-in
  496. net EstopOkOut estop-latch.0.ok-out
  497. net EstopOkOut and2.0.in1
  498. net emc-estop-out iocontrol.0.user-enable-out
  499. net emc-estop-out estop-latch.0.ok-in
  500. net emc-estop-reset iocontrol.0.user-request-enable
  501. net emc-estop-reset estop-latch.0.reset
  502.  
  503. # connect spindle fwd/rev to I/O controller
  504. net SpindleFwd <= ppmc.0.dout.00.out
  505. net SpindleFwd => motion.spindle-forward
  506. net SpindleRev <= ppmc.0.dout.01.out
  507. net SpindleRev => motion.spindle-reverse
  508.  
  509. # connect spindle brake to I/O controller
  510. net SpindleBrakeOn <= ppmc.0.dout.02.out
  511. net SpindleBrakeOn => motion.spindle-brake
  512.  
  513. # connect mist/flood coolant to I/O controller
  514. net MistOn <= ppmc.0.dout.03.out
  515. net MistOn => iocontrol.0.coolant-mist
  516. net FloodOn <= ppmc.0.dout.04.out
  517. net FloodOn => iocontrol.0.coolant-flood
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement