Advertisement
Guest User

Ini-hal-files

a guest
Jun 3rd, 2013
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.91 KB | None | 0 0
  1.  
  2. [HOSTMOT2]
  3. DRIVER=hm2_pci
  4. BOARD=5i20
  5. #CONFIG="firmware=hm2/5i20/SVST8_4.BIT num_encoders=3 num_pwmgens=3 num_stepgens=0"
  6.  
  7. #CONFIG="firmware=hm2/5i20/SVST8_4.BIT num_encoders=3 num_pwmgens=3 num_stepgens=3"
  8. #CONFIG="firmware=hm2/5i20/SVST6_6_7I52S.BIT num_encoders=3 num_pwmgens=0 num_stepgens=3"
  9.  
  10. CONFIG="firmware=hm2/5i20/SVST6_6_7I52S.BIT num_encoders=3 num_stepgens=3"
  11.  
  12. [EMC]
  13.  
  14. # Name of machine, for use with display, etc.
  15. MACHINE = HM2-Servo-Stepper
  16.  
  17. # Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
  18. #DEBUG = 0x00000003
  19. #DEBUG = 0x00000007
  20. DEBUG = 0
  21.  
  22.  
  23.  
  24.  
  25. [DISPLAY]
  26.  
  27. # Name of display program, e.g., tkemc
  28. DISPLAY = axis
  29.  
  30. # Cycle time, in seconds, that display will sleep between polls
  31. CYCLE_TIME = 0.0500
  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.5
  44.  
  45. # Prefix to be used
  46. PROGRAM_PREFIX = /home/nick/linuxcnc/nc_files
  47.  
  48. # Introductory graphic
  49. INTRO_GRAPHIC = linuxcnc.gif
  50. INTRO_TIME = 5
  51.  
  52.  
  53. [FILTER]
  54. PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
  55. PROGRAM_EXTENSION = .py Python Script
  56. png = image-to-gcode
  57. gif = image-to-gcode
  58. jpg = image-to-gcode
  59. py = python
  60.  
  61.  
  62. [TASK]
  63.  
  64. # Name of task controller program, e.g., milltask
  65. TASK = milltask
  66.  
  67. # Cycle time, in seconds, that task controller will sleep between polls
  68. CYCLE_TIME = 0.010
  69.  
  70.  
  71.  
  72.  
  73. [RS274NGC]
  74.  
  75. # File containing interpreter variables
  76. PARAMETER_FILE = hm2-servo.var
  77.  
  78.  
  79.  
  80.  
  81. [EMCMOT]
  82.  
  83. EMCMOT = motmod
  84.  
  85. # Timeout for comm to emcmot, in seconds
  86. COMM_TIMEOUT = 1.0
  87.  
  88. # Interval between tries to emcmot, in seconds
  89. COMM_WAIT = 0.010
  90.  
  91. # Servo task period, in nanoseconds
  92. SERVO_PERIOD = 1000000
  93.  
  94.  
  95.  
  96.  
  97. [HAL]
  98.  
  99. # The run script first uses halcmd to execute any HALFILE
  100. # files, and then to execute any individual HALCMD commands.
  101.  
  102. # list of hal config files to run through halcmd
  103. # files are executed in the order in which they appear
  104.  
  105. HALFILE = hm2-servo.hal
  106.  
  107. # list of halcmd commands to execute
  108. # commands are executed in the order in which they appear
  109. #HALCMD = save neta
  110.  
  111.  
  112.  
  113.  
  114. [TRAJ]
  115.  
  116. AXES = 3
  117. # COORDINATES = X Y Z R P W
  118. COORDINATES = X Y Z
  119. HOME = 0 0 0 0
  120. LINEAR_UNITS = inch
  121. ANGULAR_UNITS = degree
  122. CYCLE_TIME = 0.010
  123. DEFAULT_VELOCITY = 3.0
  124. MAX_VELOCITY = 4.0
  125. DEFAULT_ACCELERATION = 6.0
  126. MAX_ACCELERATION = 7.0
  127.  
  128.  
  129.  
  130.  
  131. [AXIS_0]
  132.  
  133. TYPE = LINEAR
  134. MAX_VELOCITY = 1.0
  135. MAX_ACCELERATION = 4.0
  136. BACKLASH = 0.000
  137. FERROR = 0.010
  138. MIN_FERROR = 0.002
  139.  
  140. INPUT_SCALE = 81920
  141.  
  142. OUTPUT_SCALE = -1.000
  143. OUTPUT_OFFSET = 0.0
  144. MAX_OUTPUT = 1.0
  145.  
  146. MIN_LIMIT = -3.0
  147. MAX_LIMIT = 10.0
  148. HOME = 0.000
  149. HOME_OFFSET = -2.9
  150. HOME_SEARCH_VEL = -0.50
  151. HOME_LATCH_VEL = 0.10
  152. # the X axis servo's encoder does not have an index channel, so we have to home without index
  153. HOME_USE_INDEX = NO
  154. HOME_IGNORE_LIMITS = YES
  155.  
  156. # PID tuning params
  157. DEADBAND = 0.000015
  158. P = 100.0
  159. I = 0.000
  160. D = 0.000
  161. FF0 = 0.000
  162. FF1 = 1.000
  163. FF2 = 0.0
  164. BIAS = 0.000
  165.  
  166.  
  167.  
  168.  
  169. [AXIS_1]
  170.  
  171. TYPE = LINEAR
  172. MAX_VELOCITY = 1.0
  173. MAX_ACCELERATION = 4.0
  174. BACKLASH = 0.000
  175. FERROR = 0.010
  176. MIN_FERROR = 0.002
  177.  
  178. INPUT_SCALE = -81920
  179.  
  180. OUTPUT_SCALE = 1.000
  181. OUTPUT_OFFSET = 0.0
  182. MAX_OUTPUT = 1.0
  183.  
  184. MIN_LIMIT = -3.0
  185. MAX_LIMIT = 10.0
  186. HOME = 0.000
  187. HOME_OFFSET = -2.9
  188. HOME_SEARCH_VEL = -0.50
  189. HOME_LATCH_VEL = 0.10
  190. # the Y axis servo's encoder has an index channel, so we use it to improve the home accuracy
  191. HOME_USE_INDEX = YES
  192. HOME_IGNORE_LIMITS = YES
  193.  
  194. # PID tuning params
  195. DEADBAND = 0.000015
  196. P = 100.0
  197. I = 0.000
  198. D = 0.000
  199. FF0 = 0.000
  200. FF1 = 1.000
  201. FF2 = 0.0
  202. BIAS = 0.000
  203.  
  204.  
  205.  
  206.  
  207. [AXIS_2]
  208.  
  209. TYPE = LINEAR
  210. MAX_VELOCITY = 1.0
  211. MAX_ACCELERATION = 4.0
  212. BACKLASH = 0.000
  213. FERROR = 0.010
  214. MIN_FERROR = 0.002
  215.  
  216. INPUT_SCALE = 81920
  217.  
  218. OUTPUT_SCALE = -1.000
  219. OUTPUT_OFFSET = 0.0
  220. MAX_OUTPUT = 1.0
  221.  
  222. MIN_LIMIT = -3.0
  223. MAX_LIMIT = 3.0
  224. HOME = 0.0
  225. HOME_OFFSET = -2.9
  226. HOME_SEARCH_VEL = -0.50
  227. HOME_LATCH_VEL = 0.10
  228. # the Z axis servo's encoder does not have an index channel, so we have to home without index
  229. HOME_USE_INDEX = NO
  230. HOME_IGNORE_LIMITS = YES
  231.  
  232. # PID tuning params
  233. DEADBAND = 0.000015
  234. P = 100.0
  235. I = 0.000
  236. D = 0.000
  237. FF0 = 0.000
  238. FF1 = 1.000
  239. FF2 = 0.0
  240. BIAS = 0.000
  241.  
  242.  
  243.  
  244.  
  245. [EMCIO]
  246.  
  247. # Name of IO controller program, e.g., io
  248. EMCIO = io
  249.  
  250. # cycle time, in seconds
  251. CYCLE_TIME = 0.100
  252.  
  253. # tool table file
  254. TOOL_TABLE = tool.tbl
  255.  
  256. _____________________________________________________________________________________________
  257.  
  258.  
  259. Hal File
  260. # #######################################
  261. #
  262. # HAL file for HostMot2 with 3 servos
  263. #
  264. # Derived from Ted Hyde's original hm2-servo config
  265. #
  266. # Based up work and discussion with Seb & Peter & Jeff
  267. # GNU license references - insert here. www.linuxcnc.org
  268. #
  269. #
  270. # ########################################
  271. # Firmware files are in /lib/firmware/hm2/7i43/
  272. # Must symlink the hostmot2 firmware directory of sanbox to
  273. # /lib/firmware before running EMC2...
  274. # sudo ln -s $HOME/emc2-sandbox/src/hal/drivers/mesa-hostmot2/firmware /lib/firmware/hm2
  275. #
  276. # See also:
  277. # <http://www.linuxcnc.org/docs/devel/html/man/man9/hostmot2.9.html#config%20modparam>
  278. # and http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?HostMot2
  279. #
  280. # #####################################################################
  281.  
  282.  
  283. # ###################################
  284. # Core EMC/HAL Loads
  285. # ###################################
  286.  
  287. # kinematics
  288. loadrt trivkins
  289.  
  290. # motion controller, get name and thread periods from ini file
  291. loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
  292.  
  293. # standard components
  294. loadrt pid num_chan=3
  295.  
  296. # only the 7i43 needs this, but it doesnt hurt the others
  297. loadrt probe_parport
  298.  
  299. # hostmot2 driver
  300. # if you have any firmware trouble, enable the debug flags here and see what's going on in the syslog
  301. #loadrt hostmot2 debug_idrom=1 debug_module_descriptors=1 debug_pin_descriptors=1 debug_modules=1
  302. loadrt hostmot2
  303.  
  304. # load low-level driver
  305. loadrt [HOSTMOT2](DRIVER) config=[HOSTMOT2](CONFIG)
  306.  
  307. #setp hm2_[HOSTMOT2](BOARD).0.pwmgen.pwm_frequency 40000
  308.  
  309. #added lines
  310. setp hm2_5i20.0.stepgen.00.control-type 1
  311. setp hm2_5i20.0.stepgen.01.control-type 1
  312.  
  313.  
  314.  
  315. # ################################################
  316. # THREADS
  317. # ################################################
  318.  
  319. addf hm2_[HOSTMOT2](BOARD).0.read servo-thread
  320.  
  321. addf motion-command-handler servo-thread
  322. addf motion-controller servo-thread
  323.  
  324. addf pid.0.do-pid-calcs servo-thread
  325. addf pid.1.do-pid-calcs servo-thread
  326. addf pid.2.do-pid-calcs servo-thread
  327.  
  328. addf hm2_[HOSTMOT2](BOARD).0.write servo-thread
  329. addf hm2_[HOSTMOT2](BOARD).0.pet_watchdog servo-thread
  330.  
  331.  
  332. # ######################################################
  333. # Axis-of-motion Specific Configs (not the GUI)
  334. # ######################################################
  335.  
  336.  
  337. # ################
  338. # X [0] Axis
  339. # ################
  340.  
  341. # axis enable chain
  342. newsig emcmot.00.enable bit
  343. sets emcmot.00.enable FALSE
  344. net emcmot.00.enable => pid.0.enable
  345.  
  346. #net emcmot.00.enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.enable
  347. net emcmot.00.enable <= axis.0.amp-enable-out
  348.  
  349. # encoder feedback
  350. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.counter-mode 0
  351. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.filter 1
  352. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-invert 0
  353. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-mask 0
  354. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-mask-invert 0
  355.  
  356. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.scale [AXIS_0]INPUT_SCALE
  357. net motor.00.pos-fb hm2_[HOSTMOT2](BOARD).0.encoder.00.position => pid.0.feedback
  358. net motor.00.pos-fb => axis.0.motor-pos-fb #push copy back to Axis GUI
  359.  
  360. # set PID loop gains from inifile
  361. setp pid.0.Pgain [AXIS_0]P
  362. setp pid.0.Igain [AXIS_0]I
  363. setp pid.0.Dgain [AXIS_0]D
  364. setp pid.0.bias [AXIS_0]BIAS
  365. setp pid.0.FF0 [AXIS_0]FF0
  366. setp pid.0.FF1 [AXIS_0]FF1
  367. setp pid.0.FF2 [AXIS_0]FF2
  368. setp pid.0.deadband [AXIS_0]DEADBAND
  369. setp pid.0.maxoutput [AXIS_0]MAX_OUTPUT
  370.  
  371. # position command signals
  372. #setp hm2_[HOSTMOT2](BOARD).0.pwmgen.00.output-type 1 #pwm on pin1, dir on pin2
  373. #setp hm2_[HOSTMOT2](BOARD).0.pwmgen.00.scale [AXIS_0]OUTPUT_SCALE
  374.  
  375. net emcmot.00.pos-cmd axis.0.motor-pos-cmd => pid.0.command
  376. #net motor.00.command pid.0.output => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.value
  377.  
  378.  
  379. # ################
  380. # Y [1] Axis
  381. # ################
  382.  
  383. # axis enable chain
  384. newsig emcmot.01.enable bit
  385. sets emcmot.01.enable FALSE
  386. net emcmot.01.enable => pid.1.enable
  387. #net emcmot.01.enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.01.enable
  388. net emcmot.01.enable <= axis.1.amp-enable-out
  389.  
  390. # encoder feedback
  391. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.counter-mode 0
  392. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.filter 1
  393. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-invert 0
  394. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-mask 0
  395. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-mask-invert 0
  396.  
  397. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.scale [AXIS_1]INPUT_SCALE
  398. net motor.01.pos-fb hm2_[HOSTMOT2](BOARD).0.encoder.01.position => pid.1.feedback
  399. net motor.01.pos-fb => axis.1.motor-pos-fb #push copy back to Axis GUI
  400.  
  401. # set PID loop gains from inifile
  402. setp pid.1.Pgain [AXIS_1]P
  403. setp pid.1.Igain [AXIS_1]I
  404. setp pid.1.Dgain [AXIS_1]D
  405. setp pid.1.bias [AXIS_1]BIAS
  406. setp pid.1.FF0 [AXIS_1]FF0
  407. setp pid.1.FF1 [AXIS_1]FF1
  408. setp pid.1.FF2 [AXIS_1]FF2
  409. setp pid.1.deadband [AXIS_1]DEADBAND
  410. setp pid.1.maxoutput [AXIS_1]MAX_OUTPUT
  411.  
  412. # position command signals
  413. #setp hm2_[HOSTMOT2](BOARD).0.pwmgen.01.output-type 1 #pwm on pin1, dir on pin2
  414. #setp hm2_[HOSTMOT2](BOARD).0.pwmgen.01.scale [AXIS_1]OUTPUT_SCALE
  415.  
  416. net emcmot.01.pos-cmd axis.1.motor-pos-cmd => pid.1.command
  417. #net motor.01.command pid.1.output => hm2_[HOSTMOT2](BOARD).0.pwmgen.01.value
  418.  
  419.  
  420. # ################
  421. # Z [2] Axis
  422. # ################
  423.  
  424. # axis enable chain
  425. newsig emcmot.02.enable bit
  426. sets emcmot.02.enable FALSE
  427. net emcmot.02.enable => pid.2.enable
  428. #net emcmot.02.enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.02.enable
  429. net emcmot.02.enable <= axis.2.amp-enable-out
  430.  
  431. # encoder feedback
  432. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.counter-mode 0
  433. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.filter 1
  434. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.index-invert 0
  435. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.index-mask 0
  436. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.index-mask-invert 0
  437.  
  438. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.scale [AXIS_2]INPUT_SCALE
  439. net motor.02.pos-fb hm2_[HOSTMOT2](BOARD).0.encoder.02.position => pid.2.feedback
  440. net motor.02.pos-fb => axis.2.motor-pos-fb #push copy back to Axis GUI
  441.  
  442. # set PID loop gains from inifile
  443. setp pid.2.Pgain [AXIS_2]P
  444. setp pid.2.Igain [AXIS_2]I
  445. setp pid.2.Dgain [AXIS_2]D
  446. setp pid.2.bias [AXIS_2]BIAS
  447. setp pid.2.FF0 [AXIS_2]FF0
  448. setp pid.2.FF1 [AXIS_2]FF1
  449. setp pid.2.FF2 [AXIS_2]FF2
  450. setp pid.2.deadband [AXIS_2]DEADBAND
  451. setp pid.2.maxoutput [AXIS_2]MAX_OUTPUT
  452.  
  453. # position command signals
  454. #setp hm2_[HOSTMOT2](BOARD).0.pwmgen.02.output-type 1 #pwm on pin1, dir on pin2
  455. #setp hm2_[HOSTMOT2](BOARD).0.pwmgen.02.scale [AXIS_2]OUTPUT_SCALE
  456.  
  457. net emcmot.02.pos-cmd axis.2.motor-pos-cmd => pid.2.command
  458. #net motor.02.command pid.2.output => hm2_[HOSTMOT2](BOARD).0.pwmgen.02.value
  459.  
  460.  
  461. # ##################################################
  462. # Standard I/O Block - EStop, Etc
  463. # ##################################################
  464.  
  465. # create a signal for the estop loopback
  466. net estop-loop iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in
  467.  
  468. # create signals for tool loading loopback
  469. net tool-prep-loop iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
  470. net tool-change-loop iocontrol.0.tool-change => iocontrol.0.tool-changed
  471.  
  472.  
  473. #
  474. # homing
  475. #
  476.  
  477. #
  478. # In this example, each of the three axes have their own home switch. All
  479. # home switches are connected to GPIO 25, though hostmot2 boards generally
  480. # have enough GPIO pins to put each axis' home switch on its own pin.
  481. #
  482. # Each switch is normally open, momentarily closed. When the switch is open,
  483. # GPIO 25 floats high (because that is the hostmot2 way). When the switch is
  484. # closed, it shorts GPIO 25 to ground.
  485. #
  486. # EMC expects the value on the .home-sw-in HAL pin to be active high, ie
  487. # True when the switch is closed and False when the switch is open.
  488. # We get this behavior by linking the GPIO .in_not pin instead of the .in
  489. # pin.
  490. #
  491.  
  492. net home-switch <= hm2_[HOSTMOT2](BOARD).0.gpio.025.in_not
  493. net home-switch => axis.0.home-sw-in
  494. net home-switch => axis.1.home-sw-in
  495. net home-switch => axis.2.home-sw-in
  496.  
  497. # only the Y servo has an index, X and Z home without using the index
  498. net y-index-enable hm2_[HOSTMOT2](BOARD).0.encoder.01.index-enable <=> axis.1.index-enable
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement