I would use a completely different approach; it wouldn't be HAL based. I would provide signals that could be output from gcode to HAL and those that could be read by gcode from HAL. They would be used to sense microswitches, command relays, etc. Reading a switch would be done like probing already is -- it would be done synchronously. I would also add (it might already be there) the ability to access the current state of the system -- current X, current Y, feed rate, etc, by storing them in special parameters.
Then I would do all of the commanding and control by writing gcode. That code could save the current state, do the appropriate motions, restore the current state, and continue. If we were worried about the user "accidently" messing with this special gcode, we could provide the ability to allow only gcode subroutines that were loaded at startup to have the ability to access this I/O. Ken [EMAIL PROTECTED] Mark Kenny Products Company, LLC 55 Main Street Voice: (203)426-7166 Newtown, CT 06470 Fax: (203)426-9138 http://www.MarkKenny.com -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Jeff Epler Sent: Monday, January 29, 2007 4:40 PM To: emc-developers@lists.sourceforge.net Subject: [Emc-developers] Proposal for HAL-based motion control Is this the way we should approach sequences of motions for toolchanging and the like? Comments, please. HAL-BASED MOTION CONTROL ======================== Often, it's desirable to command a sequence of motions outside of g-code. For instance, a number of movements may be required during a tool change. The modifications proposed below allow for this kind of control, and make 'halstreamer' an example component capable of exercising this control. (It is anticipated that special-purpose HAL components, rather than 'halstreamer', would command the tool change motion in actual systems. It is up to an integrator to write an appropriate component) Motions in the external-position mode are performed in "exact stop" mode (suitable for tool-change motions but probably not for machining), and respect the machine's velocity and acceleration limits. It is hoped that the implementation can re-use the so-called "free planner" which is used in jogging. NEW PINS ON THE MOTION CONTROLLER ================================= motion.external-position-command BIT IN When TRUE, the machine's position is controlled by the external-position-<AXIS> pins. On the transition from TRUE to FALSE, the machine returns at "traverse" speed to the position it was in before this pin was asserted. motion.external-position-<AXIS> FLOAT IN (<AXIS> is one of X, Y, Z, A, B or C) Drive with the requested position in machine coordinates motion.position-<AXIS> FLOAT OUT Driven with the current commanded position of the axis motion.external-position-velocity FLOAT IN Drive with the requested velocity. motion.external-position-control BIT I/O When the external position is reached, motion sets this pin TRUE. CHANGES TO HALSTREAMER ====================== If the first letter of the streamer configuration string (cfg=) is '+', then the new pin is created on a 'streamer' instance. Otherwise, the 'streamer' outputs one sample per invocation, as it does now. streamer.<N>.next-sample BIT I/O When this pin is TRUE, streamer outputs the next sample and sets this pin FALSE COMMANDING MOVEMENTS WITH HALSTREAMER ===================================== The following illustrate how halstreamer can make a series of coordinated movements, drawing a 2-unit square at 1 unit above the machine origin at 5 units per minute. To begin the sequence, drive the signal 'external-control' TRUE (for instance, with a 'halcmd setp'). # Additional HAL configuration loadrt streamer depth=4 cfg=+bffff net external-command motion.external-position-command streamer.0.pin.0 net external-x motion.external-position-x streamer.0.pin.1 net external-y motion.external-position-y streamer.0.pin.2 net external-z motion.external-position-z streamer.0.pin.3 net external-a motion.external-position-a motion.position-a net external-b motion.external-position-b motion.position-b net external-c motion.external-position-c motion.position-c net external-vel motion.external-position-velocity streamer.0.pin.4 net external-control motion.external-position-control streamer.0.next-sample # Sampler input file # X Y Z vel (unit/sec) 1 -1.0 -1.0 1.1 10000.0 1 -1.0 1.0 1.0 0.08333 1 1.0 1.0 1.0 0.08333 1 1.0 -1.0 1.0 0.08333 1 -1.0 -1.0 1.0 0.08333 1 -1.0 -1.0 1.1 10000.0 0 0.0 0.0 0.0 0.0 OPEN QUESTIONS ============== Q. Should feed override, adaptive feed, or feed-hold apply to these motions? ------------------------------------------------------------------------- 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-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers ------------------------------------------------------------------------- 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-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers