Not quite correct. There are various parts that compose what we call EMC. We have : 1. interpreter (userlevel), 2. task controller (userlevel), 3. io controller (userlevel, although using HAL), 4. GUI (userlevel), 5. motion controller (realtime).
#1 and #2 are actually linked together, but that's a sideissue. What you want to do is look at emccanon.cc and canon.hh (located in emc2/src/emc/task and emc2/src/emc/nml_intf if my memory serves me right). Those are the canonical calls that get called after the interpreter analyzed the g-code. It is around there that you want to translate those calls into commands to your USB device. So you'll send things like STRAIGHT_TRAVERSE or LINEAR_FEED to the microcontroller. >From there it's up to you what you do with the commands received. The problems you'll have (which can be fixed of course given enough time and nerve) are the following: - you need at least from time to time feedback from the motion controller (machine hit a limit, various error things, etc) - the USB side needs to buffer the commands that come from task (they can be quite many on programs with small segments, etc) - you need to implement the "motion controller" on the USB device (which you'll have to do no matter what approach you take, be it emc or something else). It might be that the current buildsystem is scary for newcomers, but it wouldn't be _that_ hard to remove all realtime stuff from it (for example emc2 builds for non-RT systems using --enable-simulator). That might be a good place to start. I'll try to reply now to your message. > I don't think we need to discuss the basics of USB as i have built several > USB devices and have also written kernel drivers and libusb based user > space > drivers for linux, windows and macos. So this all isn't a problem. I agree (this is your problem :) > The problem is that EMC just doesn't seem to be built to drive something > like > this. If i understand you correctly, EMC is tightly coupled to the real > time kernel > which basically means that EMC isn't very modular. I was hoping that > there's > some tiny real-time hardware layer under EMC and that i could just replace > this. not quite true, see my description above, and I can provide more indepth info if you need it. > EMC seems to be designed tightly around its main control functionality. > The > PC incl. EMC and the motor controller forms one big control loop. And now > you > and the others are suggesting to integrate the USB into this loop and keep > the > real time setup the way it currently is. it's not a control loop in the traditional way, but there are things which are supposed to go back and forth. for example the motion controller reports the current position, which gets displayed in the GUI. > IMHO this doesn't make sense at all. If you want to keep the real time > kernel you > can also stick to the printer port solutions. There's no real use for USB > here, > it will just add another layer of complexity and will cause additional > trouble. I was > hoping for a solution where i can move the entire main processing loop > into > the usb device ... but i think you already understood that. well, the problem with EMC is that it's not a single loop, there are various interconnected ones, so it won't be a 2-hour hack job to make it work. The most likely loop you want to embed is inside emc2/src/emc/motion (of course stripping half of what is there, that you don't need). > Are there other linux cnc driver programs? Perhaps more simple ones? I > really > don't think that USB would be an advantage for the current EMC design you > describe. Using USB would in fact make things worse. that depends how you implement it. If you want to implement the motion capabilities inside de USB controller, und use the remaining EMC for the interpreter, GUI and IO control, then I think it's fine.. Regards, Alex ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers