SHARE
TWEET

machine.hal

a guest May 5th, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #***** BASE SYSTEM *****************************************************
  3. loadrt [KINS]KINEMATICS
  4. loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
  5. addf motion-command-handler servo-thread
  6. addf motion-controller      servo-thread
  7.  
  8. setp iocontrol.0.emc-enable-in 1
  9.  
  10. # *************************
  11. # Load Core HAL Components
  12. # *************************
  13. loadrt hostmot2
  14. loadrt hm2_pci config="num_encoders=1 num_stepgens=5 sserial_port_0=0XXX"
  15. loadrt debounce cfg=4
  16.  
  17. #############################
  18. #---Functions and Threads---
  19. #############################
  20. addf hm2_5i25.0.read         servo-thread
  21. addf hm2_5i25.0.write        servo-thread
  22.  
  23. ##############################
  24. #---Home and Limit signals---
  25. ##############################
  26. net x-home <= hm2_5i25.0.7i76.0.0.input-00-not
  27. net y-home <= hm2_5i25.0.7i76.0.0.input-01-not
  28. net z-home <= hm2_5i25.0.7i76.0.0.input-02-not
  29.  
  30. #***** X-AXIS **********************************************************
  31. net xpos    joint.0.motor-pos-cmd   => joint.0.motor-pos-fb => hm2_5i25.0.stepgen.00.position-cmd
  32. net x-home  => joint.0.home-sw-in
  33.  
  34. #*************************
  35. # ---Axis Enable Chain---
  36. #*************************
  37. newsig emcmot.00.enable bit
  38. sets emcmot.00.enable FALSE
  39. net x-enable  <= joint.0.amp-enable-out
  40. net x-enable  => hm2_5i25.0.stepgen.00.enable
  41.  
  42. #**************************
  43. # ---Timing Parameters---
  44. # ---X Axis MOTOR---
  45. #**************************
  46. setp hm2_5i25.0.stepgen.00.dirsetup        [JOINT_0]DIRSETUP
  47. setp hm2_5i25.0.stepgen.00.dirhold         [JOINT_0]DIRHOLD
  48. setp hm2_5i25.0.stepgen.00.steplen         [JOINT_0]STEPLEN
  49. setp hm2_5i25.0.stepgen.00.stepspace       [JOINT_0]STEPSPACE
  50. setp hm2_5i25.0.stepgen.00.position-scale -[JOINT_0]SCALE
  51. setp hm2_5i25.0.stepgen.00.maxvel          [JOINT_0]STEPGEN_MAXVEL
  52. setp hm2_5i25.0.stepgen.00.maxaccel        [JOINT_0]STEPGEN_MAXACCEL
  53. setp hm2_5i25.0.stepgen.00.step_type       0
  54. setp hm2_5i25.0.stepgen.00.control-type    0
  55.  
  56. #***** Y1-AXIS *********************************************************
  57. net y1pos   joint.1.motor-pos-cmd   => joint.1.motor-pos-fb => hm2_5i25.0.stepgen.01.position-cmd hm2_5i25.0.stepgen.02.position-cmd
  58. net y-home  => joint.1.home-sw-in
  59.  
  60. #*************************
  61. # ---Axis Enable Chain---
  62. #*************************
  63. newsig emcmot.01.enable bit
  64. sets emcmot.01.enable FALSE
  65. net emcmot.01.enable <= joint.1.amp-enable-out
  66. net emcmot.01.enable => hm2_5i25.0.stepgen.01.enable hm2_5i25.0.stepgen.02.enable
  67.  
  68. #*************************
  69. # ---Timing Parameters---
  70. #   ---Y1 Axis MOTOR---
  71. #*************************
  72. setp hm2_5i25.0.stepgen.01.dirsetup        [JOINT_1]DIRSETUP
  73. setp hm2_5i25.0.stepgen.01.dirhold         [JOINT_1]DIRHOLD
  74. setp hm2_5i25.0.stepgen.01.steplen         [JOINT_1]STEPLEN
  75. setp hm2_5i25.0.stepgen.01.stepspace       [JOINT_1]STEPSPACE
  76. setp hm2_5i25.0.stepgen.01.position-scale -[JOINT_1]SCALE
  77. setp hm2_5i25.0.stepgen.01.maxvel          [JOINT_1]STEPGEN_MAXVEL
  78. setp hm2_5i25.0.stepgen.01.maxaccel        [JOINT_1]STEPGEN_MAXACCEL
  79. setp hm2_5i25.0.stepgen.01.step_type       0
  80. setp hm2_5i25.0.stepgen.01.control-type    0
  81.  
  82. #*************************
  83. # ---Timing Parameters---
  84. #   ---Y2 Axis MOTOR---
  85. #*************************
  86. setp hm2_5i25.0.stepgen.02.dirsetup        [JOINT_1]DIRSETUP
  87. setp hm2_5i25.0.stepgen.02.dirhold         [JOINT_1]DIRHOLD
  88. setp hm2_5i25.0.stepgen.02.steplen         [JOINT_1]STEPLEN
  89. setp hm2_5i25.0.stepgen.02.stepspace       [JOINT_1]STEPSPACE
  90. setp hm2_5i25.0.stepgen.02.position-scale  [JOINT_1]SCALE
  91. setp hm2_5i25.0.stepgen.02.maxvel          [JOINT_1]STEPGEN_MAXVEL
  92. setp hm2_5i25.0.stepgen.02.maxaccel        [JOINT_1]STEPGEN_MAXACCEL
  93. setp hm2_5i25.0.stepgen.02.step_type       0
  94. setp hm2_5i25.0.stepgen.02.control-type    0
  95.  
  96. #***** Z-AXIS **********************************************************
  97. net zpos    joint.2.motor-pos-cmd   => joint.2.motor-pos-fb => hm2_5i25.0.stepgen.03.position-cmd => hm2_5i25.0.stepgen.04.position-cmd
  98. #net zpos    joint.2.pos-cmd   => joint.2.motor-pos-fb
  99. net z-home  => joint.2.home-sw-in
  100.  
  101. #*************************
  102. # ---Axis Enable Chain---
  103. #*************************
  104. newsig emcmot.02.enable bit
  105. sets emcmot.02.enable FALSE
  106. net emcmot.02.enable <= joint.2.amp-enable-out
  107. net emcmot.02.enable => hm2_5i25.0.stepgen.03.enable hm2_5i25.0.stepgen.04.enable
  108.  
  109. #*************************
  110. # ---Timing Parameters---
  111. #*************************
  112. setp hm2_5i25.0.stepgen.03.dirsetup        [JOINT_2]DIRSETUP
  113. setp hm2_5i25.0.stepgen.03.dirhold         [JOINT_2]DIRHOLD
  114. setp hm2_5i25.0.stepgen.03.steplen         [JOINT_2]STEPLEN
  115. setp hm2_5i25.0.stepgen.03.stepspace       [JOINT_2]STEPSPACE
  116. setp hm2_5i25.0.stepgen.03.position-scale  [JOINT_2]SCALE
  117. setp hm2_5i25.0.stepgen.03.maxvel          [JOINT_2]STEPGEN_MAXVEL
  118. setp hm2_5i25.0.stepgen.03.maxaccel        [JOINT_2]STEPGEN_MAXACCEL
  119. setp hm2_5i25.0.stepgen.03.step_type       0
  120. setp hm2_5i25.0.stepgen.03.control-type    0
  121.  
  122. #*************************
  123. # ---Timing Parameters---
  124. # ---Z2 Axis NORTH MOTOR---
  125. #*************************
  126. setp hm2_5i25.0.stepgen.04.dirsetup        [JOINT_2]DIRSETUP
  127. setp hm2_5i25.0.stepgen.04.dirhold         [JOINT_2]DIRHOLD
  128. setp hm2_5i25.0.stepgen.04.steplen         [JOINT_2]STEPLEN
  129. setp hm2_5i25.0.stepgen.04.stepspace       [JOINT_2]STEPSPACE
  130. setp hm2_5i25.0.stepgen.04.position-scale  [JOINT_2]SCALE
  131. setp hm2_5i25.0.stepgen.04.maxvel          [JOINT_2]STEPGEN_MAXVEL
  132. setp hm2_5i25.0.stepgen.04.maxaccel        [JOINT_2]STEPGEN_MAXACCEL
  133. setp hm2_5i25.0.stepgen.04.step_type       0
  134. setp hm2_5i25.0.stepgen.04.control-type    0
  135.  
  136. #  ---HALUI signals---
  137. net machine-is-on  halui.machine.is-on
  138. net MDI-mode halui.mode.is-mdi
  139.  
  140. # #######
  141. # Standard I/O Block - EStop, Etc
  142.  
  143. # create a signal for the estop loopback
  144. net estop-loop iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in
  145.  
  146. # create signals for tool loading loopback
  147. net tool-prep-loop iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
  148. net tool-change-loop iocontrol.0.tool-change => iocontrol.0.tool-changed
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top