Machsupport Forum

Mach Discussion => Brains Development => Topic started by: CUTMORE on October 04, 2007, 01:24:09 PM

Title: Mach with Brains, smart enough for closed loop?
Post by: CUTMORE on October 04, 2007, 01:24:09 PM
I just watched the videos on the new brains,
So... My brain wants me to ask all your brains if they think programming with Mach's brains could do closed loop with this.

Someone has recently been working with EMC2 and reportedly has closed loop with steppers & 2 parallel ports working.
Thanks for any answers,
Cutmore
Title: Re: Mach with Brains, smart enough for closed loop?
Post by: vmax549 on October 04, 2007, 01:38:32 PM
I don't think so, But I have been wrong before(;-) In general to do a real closed loop at the software level it would have to be able to run in real time. The inputs from the servos/steppers would have to be on a realtime loop within mach and I don't think you can do it in MACH3. Quatium? Maybe(;-)

(;-) TP
Title: Re: Mach with Brains, smart enough for closed loop?
Post by: jlmjvm on October 08, 2007, 07:46:43 PM
As fate would have it im the guy that did the stepper with encoder setup with emc2 and 2 parallel ports.i just learned about mach brain last night.I have downloaded the latest version and presently working on getting a brain to stop the software if it gets out of position.This has already been done in mach with a macro pump,and more recently with a plugin for the rogers encoder board.I dont see why it cant be done with a brain.Vmax is correct in the fact that to be real closed loop at the software level it needs to be realtime,however this would still be a tremendous safety advantage,allow you to use the encoders as a dro when the motors are off,and help to avoid needlessly scrapping a part.Unfortunately I dont know how long it will take,im new to brains,any input is welcome.I have a machine here to test a brain if anyone has any ideas.

Thanks,Joe
Title: Re: Mach with Brains, smart enough for closed loop?
Post by: Chaoticone on October 08, 2007, 08:31:52 PM
Hey Joe, have you looked at the latest video for Brains, MPG?

Brett
Title: Re: Mach with Brains, smart enough for closed loop?
Post by: jlmjvm on October 08, 2007, 09:06:43 PM
Brett,

Just watched it,im trying to do a compare of the encoder dro to the g53 position,can get it to turn on an output when it exceeds a set value,ex:output 2 comes on if the difference is greater than .005,but cant get it to estop mach yet.


Joe
Title: Re: Mach with Brains, smart enough for closed loop?
Post by: Hood on October 09, 2007, 02:08:24 AM
Does it not work if you put the termination as a button press rather than an output?
Hood
Title: Re: Mach with Brains, smart enough for closed loop?
Post by: CUTMORE on October 09, 2007, 12:37:41 PM
Hi Joe,
How well does the closed loop work with EMC2? Is it a realtime closed loop or similar to Mach with brains?
I think if someone can get Mach to do closed loop or even just perform an e-stop if out of position that would be reallly helpful.
Thanks,
Cutmore
Title: Re: Mach with Brains, smart enough for closed loop?
Post by: Hood on October 09, 2007, 02:44:05 PM
Quote
I think if someone can get Mach to do closed loop or even just perform an e-stop if out of position that would be reallly helpful.

Cutmore, Mach does that already, If you have servos and the drives fault out because the axis are out of position then (If you have it set up) Mach will fault out. You can also do the same with steppers if you have encoders and Ron Rogers encoder Interface board.

Hood
Title: Re: Mach with Brains, smart enough for closed loop?
Post by: jlmjvm on October 09, 2007, 04:36:40 PM
Hood,

How would you setup a gecko g320 to estop mach if the drive faults?

Thanks,Joe.
Title: Re: Mach with Brains, smart enough for closed loop?
Post by: Hood on October 09, 2007, 04:49:19 PM
I use Industrial style drives with configurable I/O so I use that to input to Mach. I am not sure about the G320 drives but I think they have a fault terminal on them. If so then you can hook this up to Input 1 in Mach and then go to the general  config page and check the program lockout box. I also have a Brain looking at the drive enable signals so that it will stop the possibility of jogging/MPg if the drive is in fault
Title: Re: Mach with Brains, smart enough for closed loop?
Post by: CUTMORE on October 10, 2007, 07:01:22 AM
So If I am correct, and I think this is what Joe said He is working on, You could have a brain comparing your encoders to the g53 position also in the brain specify your following error allowance, and if it is exceeded trigger an e-stop? Wow, now I am getting ahead of my self But.. then maybe instead of an e-stop, you could do a modified adaptive feedrate!
Do you need the rogers board to interface with encoders or just a 2nd bi-directional parallel port?
Thanks for any replies,
Cutmore
Title: Re: Mach with Brains, smart enough for closed loop?
Post by: Hood on October 10, 2007, 02:42:44 PM
Not sure on the adaptive feedrate, Brian or Art would have to answer that one but yes it should be easy enough to look at the DROs and compare. A simple formula to compare your DROs and see if they differ by a set amount then if they do press the Reset button.

I think you can imput encoders through a parallel port so dont think you really need the board from Ron if that is all you are doing.

Hood
Title: Re: Mach with Brains, smart enough for closed loop?
Post by: rcrabb on October 10, 2007, 09:06:59 PM
I would think the question is how fast is the brains logic. Will it compare positions and stop the axis fast enough to save the part. I would think yes. Second question is can a reliable encoder be setup on a second parralel port. I would think yes again. About the feed rate. I would ask why change the feedrate if your axis position is off. I would think at that point you would want to stop and rehome sence your never going to get the position error back. Just my two cents.
Title: Re: Mach with Brains, smart enough for closed loop?
Post by: Jeff_Birt on October 10, 2007, 11:57:36 PM
Writing closed loop code is more complicated than how fast the Brain might or LPT might be. When you are comparing fast signals its not only important to be able to read them fast but you have to read them consistently (meaning the same time delay between each loop, i.e. hard real time). You are always dealing with signals after the fact, that is after the event already occurred. If your LPT (your encoder signals) latches with a different/inconsistent time delay and/or the DRO signals have an inconsistent time of update than the information garnered would not be very accurate. As I understand it Mach runs in a quasi hard real time, using a hardware timer on the mobo. This works great 99.999% of the time, but things can decide to grab large amounts of processor time (like stupid QuickTime services) and then Mach can/will loose steps. EMC works differently, they use a Real Time kernel extension that gives EMC top billing over everything else.

With external stepper/servo controllers (Galil, NCpod, G100) you get the best of both worlds. You have a hardware driver whose only job is to control the motor (the loop is closed in the drivers) and that leaves the whole PC available to Mach to calculate the next moves to be taken, update the display, and monitor the keyboard (etc).