Advertisement
jtektool

OG irc steppers/encoders chat

May 11th, 2011
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.57 KB | None | 0 0
  1. 18:47:13 alex joni: i have an encoder on my z axis and its hooked up to my breakout board with a and b channel,is there a place on the wiki that deals with adding an encoder
  2. 18:47:29 wanting to get ferror
  3. 18:48:02 jlmjvm: search the configs for the component encoder
  4. 18:48:17 you need to loadrt encoder num_chan=1 (if my memory serves me right)
  5. 18:48:32 then add the 2 functions of encoder to base_thread and to servo_thread
  6. 18:48:40 you need to get the scale right
  7. 18:48:59 and the output from encoder needs to get connected to the axis feedback position
  8. 18:51:37 configs?do you mean where the hal and ini file is?dont have encoder component in my configs,
  9. 18:52:15 may not be looking in the right place
  10. 18:54:31 jlmjvm: look at the etch-servo hal for a starting point for setting up the encoder module
  11. 18:54:43 will do
  12. 18:57:50 looks like what i need to get started,thanks
  13. 19:24:25 heres my hal file,crashes when emc starts
  14. 19:24:30 http://pastebin.ca/694392
  15. 19:25:33 im only using 1 encoder right now,and the a and b pins are right
  16. 19:25:43 uh what's the error?
  17. 19:26:03 HAL:20:error message here
  18. 19:26:06 (20 is the line number)
  19. 19:26:30 want me to paste error msg
  20. 19:26:36 encoder.2 is wrong
  21. 19:26:42 you need encoder.0
  22. 19:26:55 and loadrt encoder num_chan=1 is enough for now
  23. 19:27:24 if you want encoder.2.* then you need num_chan=3 (0,1 and 2)
  24. 19:27:59 my z axis is number 2
  25. 19:28:09 encoder on z axis
  26. 19:31:43 jlmjvm: 'Z axis' doesn't mean you automatically put .2. everywhere
  27. 19:32:07 jlmjvm: in this case, this is the first and only thing you are hooking up to 'encoder', so you use encoder.0
  28. 19:32:34 just tried it with 0
  29. 19:33:01 still no go
  30. 19:33:13 yeah but the error is almost certainly different now :-P
  31. 19:33:27 prolly so
  32. 19:33:42 want me to post it
  33. 19:34:26 well that's the only way anybody here is going to be able to help you
  34. 19:47:37 http://pastebin.ca/694421,thats the changes i made
  35. 19:47:59 how do you send an error,cant copy
  36. 19:53:59 jlmjvm: start emc from a terminal
  37. 19:54:06 then you can select and copy the error
  38. 19:54:36 jlmjvm: but the error is probably :
  39. 19:54:42 newsig Zpos-fb float
  40. 19:54:46 ahhh
  41. 19:54:47 that one should already be defined
  42. 19:55:04 jlmjvm: the linksp should be enough
  43. 19:55:36 adam2: http://groups.yahoo.com/group/CAD_CAM_EDM_DRO/
  44. 20:04:51 http://pastebin.ca/694451
  45. 20:05:01 finally got the error msg
  46. 20:05:31 jlmjvm: don't see the actual error
  47. 20:06:22 k,on the way,that was the dmesg
  48. 20:09:04 http://pastebin.ca/694459
  49. 20:09:15 that should be the error
  50. 20:09:46 jlmjvm: I already told you that you need to remove the newsig
  51. 20:10:18 gives another error when i did
  52. 20:10:39 jlmjvm: what's the error?
  53. 20:10:42 already has a writer?
  54. 20:11:17 lemme remove the newsig and resend error
  55. 20:11:26 jlmjvm: no need
  56. 20:11:31 remove the newsig
  57. 20:11:38 then open core_stepper.hal in the same dir
  58. 20:11:46 and look for the following line 'linksp Zpos-fb <= stepgen.2.position-fb
  59. 20:11:53 and comment that line out
  60. 20:13:36 k,will give it a try
  61. 20:15:06 your going to have to scale the encoder module correctly to work correctly with you input scale
  62. 20:16:01 I think I could have squeezed another 'correctly' into that sentence
  63. 20:16:40 that worked
  64. 20:17:20 emc came on and if i turn the motor the numbers change
  65. 20:17:28 Sweet
  66. 20:17:31 motor poer is off
  67. 20:17:36 power
  68. 20:17:54 where do i set the cpr amount at?
  69. 20:18:18 1024cpr quadrature
  70. 20:18:27 20480 counts per inch
  71. 20:21:33 scale I think
  72. 20:22:09 it's up to you actually
  73. 20:22:10 setp encoder.0.position-scale
  74. 20:22:21 you can stick a line like that in the .hal file
  75. 20:22:22 setp encoder.0.position-scale 20480
  76. 20:22:40 you can use any name you want in the ini file, and reference that in the .hal file
  77. 20:22:44 I ment scale pin on the encoder.
  78. 20:22:48 yes
  79. 20:23:01 so setp encoder...scale 20480 is one way
  80. 20:23:03 SWPadnos: he is doing steppers with encoders.
  81. 20:23:08 rigth
  82. 20:23:10 right
  83. 20:23:19 right
  84. 20:23:30 so he has the scale in the ini for the stepper which will be different than his encoder scale.
  85. 20:23:42 * skunkworks is thinking out loud
  86. 20:23:45 you can add any variables you want to the ini, and reference tem in the HAL file, so it really depends on how you want to set it up
  87. 20:23:55 really - cool
  88. 20:24:03 so you can add a section called [MY_STEPPER_ENCODER_FEEDBACK]
  89. 20:24:04 really? - cool
  90. 20:24:29 and a variable in it called THE_NUMBER_OF_COUNTS_PER_INCH_ON_THE_X_AXIS
  91. 20:24:45 so add that setp line to my hal file?
  92. 20:25:01 and you can set that by using "setp encoder.0.scale [MY_STEPPER_ENCODER_FEEDBACK]THE_NUMBER_OF_COUNTS_PER_INCH_ON_THE_X_AXIS" in the hal file
  93. 20:25:08 setp encoder.0.position-scale 20480
  94. 20:25:21 that'll work too, of course
  95. 20:30:16 hmm - wasn't there an issue with the stepgen with using encoders as feedback - like it doesn't reset it position to the 'encoders' position after an estop or something like that?
  96. 20:30:22 changed the hal file,still have joint error,was i supposed to put something in the ini file also?
  97. 20:30:48 what is the error? following error?
  98. 20:30:55 yep
  99. 20:31:19 encoder is doing its job already
  100. 20:32:18 with it off - does the readout count correctly? like 20 turns equal an inch on the readout?
  101. 20:32:35 are they going in the same direction?
  102. 20:32:39 i can check
  103. 20:33:40 SWPadnos: did you read what I wrote above about stepgen?
  104. 20:33:58 yes. that could be a problem, I don't know
  105. 20:38:34 counting correctly
  106. 20:41:26 jlmjvm: so the second you turn the machine on - you get a following error - or is it when you start to move?
  107. 20:42:05 when i start to move
  108. 20:42:18 so when you start to jog - it will error?
  109. 20:42:24 yes
  110. 20:42:27 I would negate the scale on the encoder
  111. 20:42:51 jlmjvm, you may need to fiddle with the stepgen accel and vel limits
  112. 20:43:11 setp encoder.0.position-scale -20480 - or does it count the right direction?
  113. 20:43:11 or use halscope to display what is happening with commanded & feedback positions during the short time you try to move -- that will give you a better idea what is going on
  114. 20:43:40 jepler: what? systematic aproach? bah
  115. 20:43:41 yes
  116. 20:43:41
  117. 20:44:40 jlmjvm: yes what?
  118. 20:44:57 yes its reading the right way
  119. 20:45:25 ah - ok. Jepler really has the correct way to see what is going on. use halscope.
  120. 20:45:32 and my rapids are slow right now,60 ipm
  121. 20:45:47 try moving much much slower than that
  122. 20:45:49 what if you jog slow - like 1ipm or such
  123. 20:45:56 same thing
  124. 20:46:04 tried that
  125. 20:46:13 use MDI to do something like G1X1F10
  126. 20:46:46 was doing this same thing yesterday on mach and it could read at 100 ipm
  127. 20:46:48 jlmjvm: what is your following errir set to in the ini?
  128. 20:46:57 lemmee see
  129. 20:47:56 ferror=.050 minferror=.010
  130. 20:48:19 I would think that would be more than enough.
  131. 20:48:28 ferror that is.
  132. 20:48:37 jlmjvm, you have a setup error, and you'll need to use the diagnostic tools to figure out what that error is
  133. 20:49:04 halscope is probably the best tool at the moment, because at the moment, nobody knows exactly what's going on
  134. 20:49:18 and without knowing what's happening, it's hard to fix it
  135. 20:49:58 wasnt i supposed to add something to the ini file to point to the encoder scale?
  136. 20:50:07 jlmjvm, not necessary
  137. 20:50:20 but you should make sure the scale is correct before going on
  138. 20:50:38 it seems by your account - it is working correctly - 20 turns of the leadscrew is 1 inch.
  139. 20:50:47 in the display
  140. 20:50:59 ie, manually turn the motor shaft/screw to move the table 1 inch, and verify that the display shows 1 inch of movement
  141. 20:51:21 its doing that
  142. 20:51:29 does it go the right way?
  143. 20:51:32 yes
  144. 20:51:47 ok, and if you don't use the encoder feedback, but use the stepgen feedback, can you jog?
  145. 20:51:57 and when you do that, does it jog in the correct direction?
  146. 20:52:19 yes,was moving it yesterday
  147. 20:52:20 you can experiment a little by setting ferror very large - like 1 inch
  148. 20:53:08 are you sure software counting can keep up with your encoder rate?
  149. 20:53:10 will try,but was i supposed to add something to the ini file?
  150. 20:53:13 just to be sure, you are exiting from EMC and restarting every time you change anything in the hal or ini files, right?
  151. 20:53:25 yes
  152. 20:53:33 ok - just had to check
  153. 20:53:38 no prob
  154. 20:53:43 jlmjvm: no, you did not need to modify the .ini file if you put the encoder scale explicitly in the .hal file
  155. 20:53:53 you have the option of using an ini file setting for the scale (or anything else), but it's not required to use one
  156. 20:53:53 k
  157. 20:54:10 just wanted to make sure
  158. 20:54:23 lemmee open up the ferror setting
  159. 20:55:54 open up both of them.
  160. 21:01:38 its working
  161. 21:01:56 some big dummy had the pins backwards
  162. 21:02:16 heh
  163. 21:02:32 i swear when the power was off the motors it was reading right
  164. 21:02:47 it has to be right, and also it has to match the motor
  165. 21:03:00 it's more important for it to match the motor
  166. 21:03:11 (as far as following errors go)
  167. 21:03:14 swapped the a and b pin # and its working
  168. 21:03:30 ok. you could also have negated the scale as skunkworks suggested
  169. 21:03:37 jlmjvm: negating the encoder scale I think would have done the same thing..
  170. 21:03:38
  171. 21:04:01 * skunkworks thinks now jlmjvm should now play with adaptive feed controll....
  172. 21:04:28 lets rock n roll,lol
  173. 21:04:34 * SWPadnos thinkd skunkworks needs to take his meds
  174. 21:04:41 err - thinks
  175. 21:04:43 i really appreciate the help from everyone
  176. 21:05:06 any time. just remember to put it on the wiki if you discover anything major about steppers+encoders
  177. 21:05:15 jlmjvm: you really need to post this on cnczone. This is always brought up.
  178. 21:05:16 im the only guy on the block with encoders on his steppers
  179. 21:05:25 really
  180. 21:05:42
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement