Advertisement
Guest User

Untitled

a guest
Nov 9th, 2012
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.17 KB | None | 0 0
  1. # BP Series 1
  2. loadrt trivkins
  3. loadrt motmod base_period_nsec=100000 servo_period_nsec=1000000 num_joints=[TRAJ]AXES
  4.  
  5. # hostmot2 drivers
  6. loadrt hostmot2
  7. loadrt hm2_pci config="num_encoders=6 sserial_port_0=002xxx"
  8.  
  9. # pid
  10. loadrt pid num_chan=3
  11.  
  12. setp hm2_5i25.0.watchdog.timeout_ns 10000000
  13.  
  14. # Threads
  15. addf hm2_5i25.0.read servo-thread
  16. addf motion-command-handler servo-thread
  17. addf motion-controller servo-thread
  18. addf pid.0.do-pid-calcs servo-thread
  19. addf pid.1.do-pid-calcs servo-thread
  20. addf pid.2.do-pid-calcs servo-thread
  21. addf hm2_5i25.0.write servo-thread
  22. addf hm2_5i25.0.pet_watchdog servo-thread
  23.  
  24. # MPG
  25. setp hm2_5i25.0.encoder.05.counter-mode true
  26. loadrt mux4 names=mpg-scale
  27. addf mpg-scale servo-thread
  28. loadrt ilowpass
  29. addf ilowpass.0 servo-thread
  30. loadrt or2 count=2
  31. addf or2.0 servo-thread
  32. addf or2.1 servo-thread
  33.  
  34. setp ilowpass.0.gain 0.02
  35. setp ilowpass.0.scale 1000
  36. setp mpg-scale.in0 0.0
  37. setp mpg-scale.in1 -0.0000001
  38. setp mpg-scale.in2 -0.000001
  39. setp mpg-scale.in3 -0.00001
  40.  
  41. net jog-smoothing ilowpass.0.in <= hm2_5i25.0.encoder.05.count
  42. net jog-position <= ilowpass.0.out
  43. net jog-position => axis.0.jog-counts
  44. net jog-position => axis.1.jog-counts
  45. net jog-position => axis.2.jog-counts
  46.  
  47. net scale1 or2.0.in0 <= hm2_5i25.0.7i77.0.0.input-03
  48. net scale2 or2.1.in0 <= hm2_5i25.0.7i77.0.0.input-04
  49. net scale3 or2.0.in1 or2.1.in1 <= hm2_5i25.0.7i77.0.0.input-05
  50.  
  51. net pos2 mpg-scale.sel0 <= or2.0.out
  52. net pos3 mpg-scale.sel1 <= or2.1.out
  53.  
  54. net axis-mpg-jog-scale axis.0.jog-scale <= mpg-scale.out
  55. net axis-mpg-jog-scale axis.1.jog-scale <= mpg-scale.out
  56. net axis-mpg-jog-scale axis.2.jog-scale <= mpg-scale.out
  57.  
  58. # Servo Drive
  59. net power-on hm2_5i25.0.7i77.0.0.output-00 <= motion.motion-enabled
  60. net power-on hm2_5i25.0.7i77.0.0.output-01
  61.  
  62. # X Axis
  63. setp hm2_5i25.0.encoder.00.scale -30000
  64. setp pid.0.Pgain [AXIS_0]P_GAIN
  65. setp pid.0.Igain [AXIS_0]I_GAIN
  66. setp pid.0.Dgain [AXIS_0]D_GAIN
  67. setp pid.0.FF0 [AXIS_0]FF0
  68. setp pid.0.FF1 [AXIS_0]FF1
  69. setp pid.0.FF2 [AXIS_0]FF2
  70.  
  71. net x-axis-enable pid.0.enable <= axis.0.amp-enable-out
  72. net x-axis-enable hm2_5i25.0.7i77.0.1.analogena
  73. net x-axis-fb pid.0.feedback <= hm2_5i25.0.encoder.00.position
  74. net x-axis-fb axis.0.motor-pos-fb
  75. net x-axis-pos-cmd axis.0.motor-pos-cmd => pid.0.command
  76. net x-axis-command pid.0.output => hm2_5i25.0.7i77.0.1.analogout0
  77.  
  78. net x-jog-select axis.0.jog-enable <= hm2_5i25.0.7i77.0.0.input-00
  79. net x-limits <= hm2_5i25.0.7i77.0.0.input-09-not
  80. net x-limits => axis.0.pos-lim-sw-in axis.0.neg-lim-sw-in
  81. net x-limits => axis.0.home-sw-in
  82.  
  83. # Y Axis
  84. setp hm2_5i25.0.encoder.01.scale -30000
  85. setp pid.1.Pgain [AXIS_1]P_GAIN
  86. setp pid.1.Igain [AXIS_1]I_GAIN
  87. setp pid.1.Dgain [AXIS_1]D_GAIN
  88. setp pid.1.FF0 [AXIS_1]FF0
  89. setp pid.1.FF1 [AXIS_1]FF1
  90. setp pid.1.FF2 [AXIS_1]FF2
  91.  
  92. net y-axis-enable pid.1.enable <= axis.1.amp-enable-out
  93. net y-axis-fb axis.1.motor-pos-fb <= hm2_5i25.0.encoder.01.position
  94. net y-axis-fb pid.1.feedback <= hm2_5i25.0.encoder.01.position
  95. net y-axis-fb axis.1.motor-pos-fb
  96. net y-axis-pos-cmd axis.1.motor-pos-cmd => pid.1.command
  97. net y-axis-command pid.1.output => hm2_5i25.0.7i77.0.1.analogout1
  98.  
  99. net y-jog-select axis.1.jog-enable <= hm2_5i25.0.7i77.0.0.input-01
  100. net y-limits <= hm2_5i25.0.7i77.0.0.input-10-not
  101. net y-limits => axis.1.pos-lim-sw-in axis.1.neg-lim-sw-in
  102. net y-limits => axis.1.home-sw-in
  103.  
  104. # Z Axis
  105. setp hm2_5i25.0.encoder.02.scale -32000
  106. setp pid.2.Pgain [AXIS_2]P_GAIN
  107. setp pid.2.Igain [AXIS_2]I_GAIN
  108. setp pid.2.Dgain [AXIS_2]D_GAIN
  109. setp pid.2.FF0 [AXIS_2]FF0
  110. setp pid.2.FF1 [AXIS_2]FF1
  111. setp pid.2.FF2 [AXIS_2]FF2
  112.  
  113. net z-axis-enable pid.2.enable <= axis.2.amp-enable-out
  114. net z-axis-fb axis.2.motor-pos-fb <= hm2_5i25.0.encoder.02.position
  115. net z-axis-fb pid.2.feedback <= hm2_5i25.0.encoder.02.position
  116. net z-axis-fb axis.2.motor-pos-fb
  117. net z-axis-pos-cmd axis.2.motor-pos-cmd => pid.2.command
  118. net z-axis-command pid.2.output => hm2_5i25.0.7i77.0.1.analogout2
  119.  
  120. net z-jog-select axis.2.jog-enable <= hm2_5i25.0.7i77.0.0.input-02
  121. net z-limits <= hm2_5i25.0.7i77.0.0.input-11-not
  122. net z-limits => axis.2.pos-lim-sw-in axis.2.neg-lim-sw-in
  123. net z-limits => axis.2.home-sw-in
  124.  
  125. # estop chain
  126. net estop-out <= iocontrol.0.user-enable-out
  127. net estop-out => iocontrol.0.emc-enable-in
  128.  
  129. # Spindle Drive
  130. loadusr -Wn spindle-vfd gs2_vfd -s 2 -p none -n spindle-vfd -v
  131. # connect the spindle direction pin to the GS2
  132. net gs2-fwd spindle-vfd.spindle-fwd <= motion.spindle-forward
  133. # connect the spindle on pin to the GS2
  134. net gs2-run spindle-vfd.spindle-on <= motion.spindle-on
  135. # connect the GS2 at speed to the motion at speed
  136. net gs2-at-speed motion.spindle-at-speed <= spindle-vfd.at-speed
  137. # connect the spindle RPM to the GS2
  138. net gs2-RPM spindle-vfd.speed-command <= motion.spindle-speed-out
  139. #vfd panel fan
  140. net gs2-run => hm2_5i25.0.7i77.0.0.output-03
  141.  
  142. # Lube Pump
  143. loadrt comp
  144. addf comp.0 servo-thread
  145. setp comp.0.in0 0.0001
  146. net motion-test comp.0.in1 <= motion.current-vel
  147. net in-motion hm2_5i25.0.7i77.0.0.output-02 <= comp.0.out
  148. net in-motion hm2_5i25.0.7i77.0.0.output-04
  149.  
  150. # External Program Run Button
  151. loadrt and2 count=2
  152. addf and2.0 servo-thread
  153. addf and2.1 servo-thread
  154. net program-run-btn halui.mode.auto <= hm2_5i25.0.7i77.0.0.input-08
  155. net program-run-btn and2.0.in0
  156. net program-is-auto and2.0.in1 <= halui.mode.is-auto
  157. net remote-prg-run halui.program.run <= and2.0.out
  158.  
  159. # External Program Pause/Resume Button
  160. #net pause-resume-btn and2.3.in0 and2.4.in0 <= hm2_5i20.0.gpio.029.in_not
  161. #net pause-on toggle2nist.0.is-on and2.3.in1 <= halui.program.is-paused
  162. #net run-status and2.4.in1 <= halui.program.is-running
  163. #net pause-sig or2.5.in0 <= and2.3.out
  164. #net resume-sig or2.5.in1 <= and2.4.out
  165. #net toggle-ok toggle.0.in < or2.5.out
  166. #net togglesig toggle2nist.0.in <= toggle.0.out
  167. #net toggleon halui.program.pause <= toggle2nist.0.on
  168. #net toggleoff halui.program.resume <= toggle2nist.0.off
  169.  
  170.  
  171. # manual tool change
  172. loadusr -W hal_manualtoolchange
  173. net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
  174. net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
  175. net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
  176. net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement