Advertisement
Guest User

Untitled

a guest
Apr 5th, 2014
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. # Spindle handler
  2. loadrt abs names=spindle-abs
  3. loadrt pid names=velocity-pid position-pid
  4. loadrt mux2 names=mode-switch-mux
  5. loadrt or2 names=orient-enable-or
  6. loadrt orient names=orient
  7. loadrt not names=orient-not
  8.  
  9. #NOTE that this HAL file uses "names=" for all functions. The means that, for example
  10. #the orient comp pins are orient.position rather than orient.0.position.
  11. #Just in acse you were wondering.
  12.  
  13. addf orient servo-thread
  14. addf orient-enable-or servo-thread
  15. addf orient-not servo-thread
  16. addf mode-switch-mux servo-thread
  17. addf velocity-pid servo-thread
  18. addf position-pid servo-thread
  19. addf spindle-abs servo-thread
  20.  
  21. #Adjust this value to align the spindle encoder index to the toolchanger orientation
  22. setp orient.angle 45
  23.  
  24. #A block of things to configure for a specific hardware setup
  25. net spindle-cmd-final hm2_5i25.0.7i77.0.0.analogout.04
  26. net spindle-fwd hm2_5i25.0.7i77.0.0.digout00
  27. net spindle-rev hm2_5i25.0.7i77.0.0.digout01
  28. net spindle-pos-fb hm2_5i25.0.encoder.04.position
  29. net spindle-speed-rps-fb hm2_5i25.0.encoder.04.velocity
  30.  
  31. #Normal spindly stuffs
  32. net spindle-speed-rps-fb motion.spindle-speed-in
  33. net spindle-pos-fb motion.spindle-revs
  34.  
  35. # Two ways to make orient happen
  36. net orient-from-M19 motion.spindle-orient align-enable-or.in1
  37. # net the orient-for-tool signal to something from your toolchanger, possibly even tool-change-req
  38. net orient-for-tool align-enable-or.in0
  39. net orient-enable orient-enable-or.out orient.enable
  40. net orient-enable mode-switch-mux.sel position-pid.enable orient-not.in
  41. #A PID shouln't be left running when it isn't active, they take time to settle
  42. net vel-enable velocity-pid.enable orient-not.out
  43.  
  44. #spindle speed commands can come from either the velocity pid or the orient pid
  45. net velocity-mode-cmd velocity-pid.out mode-switch-mux.in0
  46. net position-mode-cmd position-pid.out mode-switch-mux.in1
  47.  
  48. #For simplicity the velocity PID is set up as inactive, just passing a scaled
  49. #value. I have assumed 10V = 5000rpm But this example works in RPS
  50. setp velocity-pid.FF0 0.12
  51. setp velocity-pid.Pgain 0
  52. setp velocity-pid.Igain 0
  53. setp velocity-pid.Dgain 0
  54. net spindle-speed-cmd motion.spindle-speed-out-rps velocity-pid.command
  55. net spindle-speed-rps-fb velocity-pid.feedback
  56.  
  57. #The postion PID needs more work. I can't even guess the numbers needed
  58. setp velocity-pid.FF0 0
  59. setp velocity-pid.Pgain 0.01
  60. setp velocity-pid.Igain 0.001
  61. setp velocity-pid.Dgain 0
  62. net spindle-pos-cmd orient.position position-pid.command
  63. net spindle-pos-fb position-pid.feedback
  64.  
  65. #Output stage
  66. net raw-spindle mode-switch-mux.out spindle-abs.in
  67. net spindle-cmd-final spindle-abs.out
  68. net spindle-fwd spindle-abs.is-positive
  69. net spindle-rev spindle-abs.is-negative
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement