Hi,

I am putting up some first thoughts on something that will be able to take
a stream of gcode commands over the net and do something useful to drive a
CNC machine. I welcome all thoughts and opinions on what is useful in what
we are looking at and ways to get the job done. If people decide it's
useful, I have no problems sharing it but will promise there is no support
beyond our own needs at this point. (This isn't to say that a good idea
won't be done if it isn't in our critical path, but if, when and how are
unknown.)

thanks in advance,
jerry


Thoughts for remote gcode execution python script

Our goal is to be able to run the CNC machine being driven from software
running on a different computer. It's more of a robot than a manufacturing
machine. This is very different than the design a part, generate gcode,
load the gcode onto the machine and run it model.

At the same time, I figure this may be useful to others if we get the
requirements right. One example is the ability to make smarter user
interfaces by having particular places in the gcode where the driving
software knows to check for state or errors and give specific guidance to
the user.

The key point is that I don't require but kind of expect the thing on the
other end to be smarter than a file copy.

It seems that the easiest way to do this is to put together a python
program using the python interface to linuxcnc.


 Basic idea

   -

   everything that is sent is either gcode or a comment
   -

   comments are denoted with “;”
   -

   comments that have only white space before ; and the next non-white
   character is “!” is an executor command
   -

   There are two modes: run and debug
   -

   simplest communications first: commands on standard input of the script,
   remote access is external to script
   -

   there is a lock file so only 1 script can run at a time
   -

   single threaded for simplicity, can do parallel error checking in the
   future


 Modes

   -

   run mode
   -

      default mode
      -

      start by opening the command and error channels, wait for ready
      -

      main loop
      -

         read a line
         -

         eliminate “;” comment lines, process executor commands
         -

         feed the rest as mdi commands
         -

         wait_complete
         -

         check for error
         -

            errors messages sent back on stderr
             -

      exit on M1/M30
       -

   debug mode
   -

      add a prompt response after each command
      -

         Maybe use “>” for good response, “@” for error as default
         -

         errors and prompts on stdout
         -

         executor commands produce different prompts

Executor commands

   -

   mode
   -

      1 arg: run/debug
       -

   status
   -

      arg: list of keywords
      -

         example: current_position, current_velocity
          -

      validate list of keywords
      -

         error if unknown
          -

      return each keyword and value(s) one per line in list order
      -

         unless someone objects, these will be sent in json format
          -

   timeout
   -

      1 arg: integer seconds
       -

   prompts
   -

      args: list of keyword=x where x is a single character
      -

         example exec_error=&
          -

   exit
   -

      no arg


-- 
Jerry Scharf
FINsix IT
650.285.6361 w
650.279.7017 m
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to