Advertisement
Guest User

Untitled

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