Gerry Chu wrote: > Thanks everyone for your help with the motor controller question. It > cleared up a lot of confusion. > > Since I'm not using EMC for CNC, I'll have to program it to do what I > want. I looked at Galil, and they had a whole set of (arcane) commands > to say "move this many encoder counts at this velocity" and things like > that. What's the EMC equivalent to this? I looked over the user manual > pdf and couldn't find any information. > > To give you guys more context...I'm trying to build a haptic mouse > scrollwheel. Suppose you're trying to find some text in an 100 page > document, and the program finds 20 occurrences. You start scrolling, and > the motor attached to the scrollwheel makes you feel a bump each time > you pass an occurrence of the word. > > Maybe you might want to have feel different "textures" for different > documents. This might help the blind. I want to scroll at a constant > velocity, so I give the scrollwheel a flick and the scrollwheel turns at > that velocity indefinitely. Also a mode like a spring would be cool: the > scrollwheel "wants" to be at a certain position, and the more you > displace it from that position, the more force it exerts to get itself > back to that position. > > Any advice on where/how to start? Can I do this all in g-code or would I > have to be lower-level? > > Thanks, > > Gerry
I don't think you want to use g-code for that. You can use much of the low level infrastructure from EMC though. HAL provides PID loops, for example, and you can use software PWM and a parport to drive a motor, or you can go with much more elaborate (and expensive) hardware. Several people have done closed loop position control using the cheap approach. The G-code equivalent to "move this many encoder counts at this velocity" is a G01 command (straight line move with feedrate). But again, doing it in g-code isn't what you want. You can get the same result (for a single axis) with the hal "limit3" component. It takes a position command (it can be in counts, or you can use scaling and make it in whatever units you want. "limit3" makes its output match its input, but the output will obey position, velocity, and acceleration constraints (set by HAL parameters). That will give you the traditional trapezoidal move. Regarding the "bump when you pass a keyword" idea - Jeff Epler experimented with "soft detents" by attaching a motor and a knob to an encoder, and telling the motor to produce a weak force toward certain knob positions. Not to different from what you are trying to do. He used HAL blocks to do this. (I hope he will comment in more detail.) If I recall correctly, he was using geared motors, and I think the gearing made the "feel" not quite what he was aiming for. I think you will find HAL to be a good set of building blocks to experiment with. You might want to peruse the main HAL documentation at http://linuxcnc.org/docs/HAL_Documentation.pdf If you need HAL components beyond those already supplied, there are several possibilities. You can write user space ones using C or Python, and you can write realtime ones using C. In addition, there is 'comp', a preprocessor that simplifies some of the boilerplate needed to write a component. Chapter 9 in the HAL manual above covers comp in some detail. Regards, John Kasunich ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
