Am 22.10.2012 um 21:23 schrieb David Raila:
David, > > I am trying to accomplish the following, using 2.6.0-pre. > I have a basic 3-axis machine that has a sensor mounted, and I > am pretty darn close to having linuxcnc do the position and capture from > it, but could use a little help. I have remapped M200 - initialize the > sensor software, M201 - store data from the sensor, and M202 - close it > down. It looks like what you are trying to do is a Python procedure executed synchronized with motion. This is currently not possible in a supported manner with remapped codes. The reason is as follows: A remapped code behaves like any other code wrt execution; that is, a large - or maybe the whole program is parsed, and motion codes generated before the machine might make its first move. This is called 'readahead time execution' - that means: also your Python functions are executed well before the machine moves. So remapping currently is not the right tool for this purpose - take a M100-M199 code and wrap your Python procedures behind them. The M100-M199 codes are motion-synchronized. I did a proof-of-concept of such motion-synchronized Python functions and they would do what you want; I hope to have that in a later version of the interpreter. - Michael ps: The concept of readahead is explained in section 17: http://www.linuxcnc.org/docs/devel/html/remap/structure.html#_a_short_survey_of_emc_program_execution > > I have the following remappings: > REMAP=M200 python=m200 modalgroup=10 > REMAP=M201 python=m201 argspec=p modalgroup=10 > REMAP=M202 python=m202 modalgroup=10 > > Gcode to move/process/move/process..... looks like > > M200 > G0 X 6.000 Y 2.000 > M201 > G0 X 8.800 Y 2.000 > M201 > ... > > And the python code, which is running, starts as: > def m201(self, **words): > > global _images, _camera > if not self.task: > return INTERP_OK > for (word,value) in words.items(): > MESSAGE("M201: %s: %s" % (word, value)) > > Question 1: If I do "M201 P3" I don't see the P3 come through. Is > there some other initialization that is required or am I making a > different mistake? I reused configs/sim/remap/getting-started. I added the 'REMAP=M201 python=m201 argspec=p modalgroup=10' to demo.ini I added the m201 Python function to python/remap.py I _do_ see P3 come through - the screen message says 'M201: P: 3.0' if I type M201p3 in the MDI window. > Question 2: The "if not self.task" successfully stops my code from > doing anything for axis preview. However, when I start my program > linuxcnc seems to > run through the code with self.task set before it starts any machine > motion, and then does the motion afterwards, rather than in-line as I > was expecting. > I've tried a number of alternatives, short dwells, etc. but no luck. > The question I suppose really is what is the proper gcode to > move/process/move/process. I suspect that I don't fully understand > code and modal groups. > > Thanks in advance for any advice. > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Emc-developers mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/emc-developers ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ Emc-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-developers
