CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > LinuxCNC (formerly EMC2)


LinuxCNC (formerly EMC2) Discuss LinuxCNC (formerly EMC2) Controlers here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 09-13-2007, 10:36 AM
 
Join Date: Jul 2003
Location: Holmen, WI
Posts: 1,081
samco is on a distinguished road
EMC2 + Steppers + Encoders = following error detection (so far) :)

There is this guy - you see - that has encoders hooked up to the back of his stepping motors. He thought 'Hmmm I would like to see if I can set emc2 up so that if I start missing steps, Emc will throw a following error - and estop'. He is reading the encoder back thru the printer port. You can see how flexable emc2 is. I think this is the first time it has been tested. (It has been talked about a lot - there may still be bugs in the theory) But is seems to be working. Here is an edited IRC chat with the emc gurus from here.

Gives an idea of the thought proccess.
http://www.linuxcnc.org/irc/irc.free...2007-09-12.txt

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
18:47:29 wanting to get ferror
18:48:02 jlmjvm: search the configs for the component encoder
18:48:17 you need to loadrt encoder num_chan=1 (if my memory serves me right)
18:48:32 then add the 2 functions of encoder to base_thread and to servo_thread
18:48:40 you need to get the scale right
18:48:59 and the output from encoder needs to get connected to the axis feedback position
18:51:37 configs?do you mean where the hal and ini file is?dont have encoder component in my configs,
18:52:15 may not be looking in the right place
18:54:31 jlmjvm: look at the etch-servo hal for a starting point for setting up the encoder module
18:54:43 will do
18:57:50 looks like what i need to get started,thanks
19:24:25 heres my hal file,crashes when emc starts
19:24:30 http://pastebin.ca/694392
19:25:33 im only using 1 encoder right now,and the a and b pins are right
19:25:43 uh what's the error?
19:26:03 HAL:20:error message here
19:26:06 (20 is the line number)
19:26:30 want me to paste error msg
19:26:36 encoder.2 is wrong
19:26:42 you need encoder.0
19:26:55 and loadrt encoder num_chan=1 is enough for now
19:27:24 if you want encoder.2.* then you need num_chan=3 (0,1 and 2)
19:27:59 my z axis is number 2
19:28:09 encoder on z axis
19:31:43 jlmjvm: 'Z axis' doesn't mean you automatically put .2. everywhere
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
19:32:34 just tried it with 0
19:33:01 still no go
19:33:13 yeah but the error is almost certainly different now :-P
19:33:27 prolly so
19:33:42 want me to post it
19:34:26 well that's the only way anybody here is going to be able to help you
19:47:37 http://pastebin.ca/694421,thats the changes i made
19:47:59 how do you send an error,cant copy
19:53:59 jlmjvm: start emc from a terminal
19:54:06 then you can select and copy the error
19:54:36 jlmjvm: but the error is probably :
19:54:42 newsig Zpos-fb float
19:54:46 ahhh
19:54:47 that one should already be defined
19:55:04 jlmjvm: the linksp should be enough
19:55:36 adam2: http://groups.yahoo.com/group/CAD_CAM_EDM_DRO/
20:04:51 http://pastebin.ca/694451
20:05:01 finally got the error msg
20:05:31 jlmjvm: don't see the actual error
20:06:22 k,on the way,that was the dmesg
20:09:04 http://pastebin.ca/694459
20:09:15 that should be the error
20:09:46 jlmjvm: I already told you that you need to remove the newsig
20:10:18 gives another error when i did
20:10:39 jlmjvm: what's the error?
20:10:42 already has a writer?
20:11:17 lemme remove the newsig and resend error
20:11:26 jlmjvm: no need
20:11:31 remove the newsig
20:11:38 then open core_stepper.hal in the same dir
20:11:46 and look for the following line 'linksp Zpos-fb <= stepgen.2.position-fb
20:11:53 and comment that line out
20:13:36 k,will give it a try
20:15:06 your going to have to scale the encoder module correctly to work correctly with you input scale
20:16:01 I think I could have squeezed another 'correctly' into that sentence
20:16:40 that worked
20:17:20 emc came on and if i turn the motor the numbers change
20:17:28 Sweet
20:17:31 motor poer is off
20:17:36 power
20:17:54 where do i set the cpr amount at?
20:18:18 1024cpr quadrature
20:18:27 20480 counts per inch
20:21:33 scale I think
20:22:09 it's up to you actually
20:22:10 setp encoder.0.position-scale
20:22:21 you can stick a line like that in the .hal file
20:22:22 setp encoder.0.position-scale 20480
20:22:40 you can use any name you want in the ini file, and reference that in the .hal file
20:22:44 I ment scale pin on the encoder.
20:22:48 yes
20:23:01 so setp encoder...scale 20480 is one way
20:23:03 SWPadnos: he is doing steppers with encoders.
20:23:08 rigth
20:23:10 right
20:23:19 right
20:23:30 so he has the scale in the ini for the stepper which will be different than his encoder scale.
20:23:42 * skunkworks is thinking out loud
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
20:23:55 really - cool
20:24:03 so you can add a section called [MY_STEPPER_ENCODER_FEEDBACK]
20:24:04 really? - cool
20:24:29 and a variable in it called THE_NUMBER_OF_COUNTS_PER_INCH_ON_THE_X_AXIS
20:24:45 so add that setp line to my hal file?
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
20:25:08 setp encoder.0.position-scale 20480
20:25:21 that'll work too, of course
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?
20:30:22 changed the hal file,still have joint error,was i supposed to put something in the ini file also?
20:30:48 what is the error? following error?
20:30:55 yep
20:31:19 encoder is doing its job already
20:32:18 with it off - does the readout count correctly? like 20 turns equal an inch on the readout?
20:32:35 are they going in the same direction?
20:32:39 i can check
20:33:40 SWPadnos: did you read what I wrote above about stepgen?
20:33:58 yes. that could be a problem, I don't know
20:38:34 counting correctly
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?
20:42:05 when i start to move
20:42:18 so when you start to jog - it will error?
20:42:24 yes
20:42:27 I would negate the scale on the encoder
20:42:51 jlmjvm, you may need to fiddle with the stepgen accel and vel limits
20:43:11 setp encoder.0.position-scale -20480 - or does it count the right direction?
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
20:43:40 jepler: what? systematic aproach? bah
20:43:41 yes
20:43:41
20:44:40 jlmjvm: yes what?
20:44:57 yes its reading the right way
20:45:25 ah - ok. Jepler really has the correct way to see what is going on. use halscope.
20:45:32 and my rapids are slow right now,60 ipm
20:45:47 try moving much much slower than that
20:45:49 what if you jog slow - like 1ipm or such
20:45:56 same thing
20:46:04 tried that
20:46:13 use MDI to do something like G1X1F10
20:46:46 was doing this same thing yesterday on mach and it could read at 100 ipm
20:46:48 jlmjvm: what is your following errir set to in the ini?
20:46:57 lemmee see
20:47:56 ferror=.050 minferror=.010
20:48:19 I would think that would be more than enough.
20:48:28 ferror that is.
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
20:49:04 halscope is probably the best tool at the moment, because at the moment, nobody knows exactly what's going on
20:49:18 and without knowing what's happening, it's hard to fix it
20:49:58 wasnt i supposed to add something to the ini file to point to the encoder scale?
20:50:07 jlmjvm, not necessary
20:50:20 but you should make sure the scale is correct before going on
20:50:38 it seems by your account - it is working correctly - 20 turns of the leadscrew is 1 inch.
20:50:47 in the display
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
20:51:21 its doing that
20:51:29 does it go the right way?
20:51:32 yes
20:51:47 ok, and if you don't use the encoder feedback, but use the stepgen feedback, can you jog?
20:51:57 and when you do that, does it jog in the correct direction?
20:52:19 yes,was moving it yesterday
20:52:20 you can experiment a little by setting ferror very large - like 1 inch
20:53:08 are you sure software counting can keep up with your encoder rate?
20:53:10 will try,but was i supposed to add something to the ini file?
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?
20:53:25 yes
20:53:33 ok - just had to check
20:53:38 no prob
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
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
20:53:53 k
20:54:10 just wanted to make sure
20:54:23 lemmee open up the ferror setting
20:55:54 open up both of them.
21:01:38 its working
21:01:56 some big dummy had the pins backwards
21:02:16 heh
21:02:32 i swear when the power was off the motors it was reading right
21:02:47 it has to be right, and also it has to match the motor
21:03:00 it's more important for it to match the motor
21:03:11 (as far as following errors go)
21:03:14 swapped the a and b pin # and its working
21:03:30 ok. you could also have negated the scale as skunkworks suggested
21:03:37 jlmjvm: negating the encoder scale I think would have done the same thing..
21:03:38
21:04:01 * skunkworks thinks now jlmjvm should now play with adaptive feed controll....
21:04:28 lets rock n roll,lol
21:04:34 * SWPadnos thinkd skunkworks needs to take his meds
21:04:41 err - thinks
21:04:43 i really appreciate the help from everyone
21:05:06 any time. just remember to put it on the wiki if you discover anything major about steppers+encoders
21:05:15 jlmjvm: you really need to post this on cnczone. This is always brought up.
21:05:16 im the only guy on the block with encoders on his steppers
21:05:25 really
21:05:42 So - now if you stall - do you get a following error?
21:05:49 yall can have a copy of my hal and ini if you want
21:06:00 no thanks. I'd rather have you put it on the wiki
21:06:07 im sure it will
21:06:09 hint hint
21:06:29 lemmee give it a big accel and stall it
21:06:32 brb
21:06:48 me,on the wiki
21:07:04 just set the axis vel limit to 1000IPM and try G1X10F500
21:07:15 but set the ferror back down first
21:07:49 he should be able to measure the following error - and as it increases slow the feed rate down using adaptive feedrate.. I think it would be a cool experiment..
21:12:55 oh yeah,jacked the acceleratio up from 6 to 60 and it gives an immediate joint following error,doesnt even move
21:13:41 thats gotta be working
21:14:42 plus its showing up when i home out the axis,-.0002,.0001 etc
21:15:21 i think this is gonna really help
21:15:25 cool
21:15:51 im ready to have a keg party now,this was magor to me
21:16:18 what base period are you running?
21:16:22 10000
21:17:17 its reading at 60 ipm no problem
21:17:41 yah - you should be able to do 150ipm no problem
21:17:41 should be able to get 100 ipm like i did in mach yesterday
21:17:58 150 would be awesome
21:18:08 what is your input scale.
21:18:11 ?
21:18:22 remember - you can output at least twice as many steps as you can read
21:18:23 the cool thing is i had these encoders all along
21:18:29 10000
21:18:35 the encoder counting is going to be your real limmit
21:19:01 you probably won't be able to count past ~90 IPM reliably
21:19:03 SWPadnos: explain? you mean doing doublefreQ?
21:19:09 yes,they were higher count than i wanted,but they were on the motors i bought
21:19:13 yes, doublefreq is part of it
21:19:36 but you need some margin for reading quadrature that isn't needed for step generation
21:19:42 and they were 250.00 encoders,wish they had an index
21:19:48 AH - but he should be able to count at 50khz shouldn't he? with base period set to 10000?
21:20:02 at most
21:20:09 atleast
21:20:16 oh - I think I had an extra factor of two in my head
21:20:18 so that is 146ipm
21:20:21 100 is prolly all i will go
21:20:21 lerneaen_hydra has joined #emc
21:20:52 no, at most. if latency is 0 and the encoder has perfect 90 degree phases, then 50 KHz is doable
21:21:34 and at 60Hz?
21:21:34 if latency isn't zero, then the least time the encoder needs to be at one state is 10000 + latency to guarantee that the software sees it
21:21:52 oh, nm didn't see the K
21:21:53 if the encoder isn't perfect, then that restriction is on the shortest phase
21:23:06 so if it's got a "short pulse" in one quadrature state - say only 75 electrical degrees instead of 90, then that short state needs to be BASE_PERIOD + latency_max long to be noticed
21:23:55 in that example, 75 degrees is ~1/5 of a full cycle, so a cycle of 4 counts = 5 *(base_period+lat_max)
21:24:03 huh
21:24:08 heh
21:24:20 so it works great, until you start looking at the fact that nothing is perfect
21:24:33 heh
21:24:48 alright lets get started on that adaptive feedrate,lol
21:24:52 heh
21:25:00 just kidding
21:25:03 opk - time for me to get back to paying work!
21:25:30 thanks for the help
21:25:35 I could have swarn though that I was counting encoders close to base period... but I don't know for sure..
21:25:45 sworn
21:26:04 but that is an argument for another time..
21:26:05 you could have been
21:26:10 thats how we say it down south
21:26:20 ahh coulda swahn
21:26:33 lol
21:27:16 SWPadnos: this is all I have http://www.electronicsam.com/images/...astermouse.png
21:28:53 jlmjvm: atleast get a wiki up and I will post it on cnczone
21:29:01 btw,couldnt this same scenario be used with a gecko g320 setup by also connecting the a and b encoder wires to a 2nd breakout board also
21:30:15 how do you get a wiki up,never done 1,and no smart remarks,lol
21:30:34 never posted before
21:30:54 still in intense learning mode
21:34:38 back in a bit,gotta eat supper
21:39:24 jlmjvm: glad it works
21:39:48 thank alex
21:39:54 thanks
21:40:04 jlmjvm: the wiki is pretty straightforward
21:40:21 gonna check it out
21:40:33 first thing read & try to follow this page: http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?BasicSteps
21:40:52 i think this is an awesome safety feature
21:40:57 will do
21:41:28 once set up right, you can have unstallable steppers :P
21:41:48 basicly if the stepper starts to lag behind, you adjust the feedrate to go slower
21:41:53 just like marris is doing
21:41:58 yup
21:42:03 sweet
21:42:21 if you prove it working
21:42:32 that would be awesome
21:42:45 we all think it should, but so far no one bothered enough to try it out *blush*
21:43:05 i will try it
21:43:48 gotta get my 2nd paraport installed tomorrow
21:44:38 then i can wire it all correctly,was outta inputs,had to disable y limit switch
21:45:37 2 ports,many inputs
21:46:18 I would personally try to get my hands on some hardware counter for the encoders
21:46:42 I'd trust one a bit more than software counting
21:47:25 may look in to that later
21:48:17 just glad its working
21:49:56 alex joni:shouldnt i be able to do this with gecko servos also,run a and b to gecko and second parport?
Next his mission it to see if when measuring following error within emc - have emc start slowing down as the folloing error gets larger. 'adaptive feedrate'

Cool stuff - great work!!.

sam
Reply With Quote

  #2   Ban this user!
Old 09-13-2007, 09:37 PM
 
Join Date: May 2006
Location: Australia
Age: 40
Posts: 2,205
epineh is on a distinguished road
Buy me a Beer?

That is so cool !

I can't wait to start playing with EMC, I was going to ask which IRC server you guys use but I decided not to be lazy and found out myself

Will be interesting to follow this.

Cheers.

Russell.
Reply With Quote

  #3   Ban this user!
Old 09-14-2007, 12:15 PM
 
Join Date: Jul 2003
Location: Holmen, WI
Posts: 1,081
samco is on a distinguished road

forgot to mention it is a cnc bridgeort,older boss mill.

He put aftermarket steppers on it - I will try to get the model.

edit - He just got a second printer port working - so he is sending step/dir out of one and reading encoders in the other.

sam
Reply With Quote

  #4   Ban this user!
Old 09-16-2007, 12:59 AM
 
Join Date: Feb 2007
Location: USA
Posts: 531
skullworks is on a distinguished road
Smile #EMC IRC chats

I have to quit sleeping thru all the really interesting subjects...
Reply With Quote

  #5   Ban this user!
Old 09-21-2007, 06:00 AM
 
Join Date: Jul 2005
Location: usa
Posts: 409
cut more is on a distinguished road

Wow,
I have been wondering if this could be done. Does anyone know what is being used for drives?
Has a wiki been posted on this? I looked & had no luck.
Thanks,
Cutmore
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 09-21-2007, 07:27 AM
 
Join Date: Jul 2003
Location: Holmen, WI
Posts: 1,081
samco is on a distinguished road

IIRC they are gecko vampires running directly from the printer port.

He is planning on settting up a wiki page for it.

sam
Reply With Quote

  #7   Ban this user!
Old 09-28-2007, 12:14 PM
 
Join Date: Jul 2005
Location: usa
Posts: 409
cut more is on a distinguished road
EMC+ steppers closed loop

Any new info on this?

Thanks,
Cutmore
Reply With Quote

  #8   Ban this user!
Old 09-30-2007, 08:01 PM
 
Join Date: May 2007
Location: USA
Posts: 717
sansbury is on a distinguished road

What about using a linear encoder to measure the actual motion of the axis, as opposed to just the turns of the motor?
Reply With Quote

  #9   Ban this user!
Old 09-13-2008, 11:00 PM
 
Join Date: May 2008
Location: Australia
Posts: 1
nd55 is on a distinguished road

[Warning: Noob in the area]

> What about using a linear encoder to measure the actual motion of the axis, as opposed to just the turns of the motor?

This is OK for the initial acceleration and traverse, but as the machine gets towards the target area, backlash limits the ability to accurately locate the machine location and the controller ends up 'hunting' back and forwards across the desired location.

Effectively, destroying the motors in short order.

Some controllers use a 'dual closed-loop', one the motor shaft encoder and two the linear glass scales on the machine, but that is a more complicated/expensive solution which would better be solved using higher quality components in the first place.

on a side note, Yaskawa 1540 have the capabilty to use dual-closed loop feedback. Anybody tried it?

Nick.
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
steppers with encoders? rolveram Stepper Motors and Drives 10 08-05-2007 10:59 PM
Encoders-steppers.- Following error. granado Mach Wizards, Macros, & Addons 2 07-26-2007 01:44 PM
Steppers & Encoders widgitmaster Mach Software (ArtSoft software) 2 08-03-2005 12:06 PM
Steppers & Encoders widgitmaster Stepper Motors and Drives 0 08-03-2005 08:53 AM
encoders with steppers turmite General Electronics Discussion 2 01-31-2004 08:44 PM




All times are GMT -5. The time now is 02:54 PM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361