On 07/10/2015 08:04 PM, Jerry Scharf wrote:
> We have a cnc router (probotix) that we are using to automate electronic
> parts testing (replacing the router with a vacuum picker assembly.) We will
> have code on a different computer that runs the tests. A piece of that code
> will get requests as to which part to get and where to put it. The result
> of that is to generate gcode that we then want to execute on the linuxcnc
> machine and get success or error for each command. To start with, we will
> want to send single gcode commands and wait for the machine to complete
> them before going on. There are other actions that need to interspersed
> with the cnc motion, so just sending a program isn't what we need right now.
> 
> Has anyone written something that can do this? We're fairly flexible on how
> this works. If the best way is to ssh into the linuxcnc machine and run
> some command that takes input from standard in, that would be great. A
> separate tcp/ip listener would be fine as well.

I like your idea of sshing in to the linuxcnc computer and running the
gcode "on demand" from the top level controller on the main computer.

Assuming linuxcnc is running, you could run the python interpreter,
import the "linuxcnc" module, and provide input on its standard in:

Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import linuxcnc
>>> c = linuxcnc.command()
>>> c.state(linuxcnc.STATE_ESTOP_RESET)
>>> c.state(linuxcnc.STATE_ON)
>>> c.home(-1)
>>> c.wait_complete()
1
>>> c.mode(linuxcnc.MODE_MDI)
>>> c.mdi('g0 x5 z1')

The linuxcnc python module lets you do everything any other LinuxCNC
user interface can do, but unfortunately it does not have great
documentation.  (If you wanted to contribute documentation for the
module it would be very welcome!)  It is used in several places in our
test suite, that may be a good place to see it in action (grep for
"import linuxcnc" in tests/).


Another alternative would be to use the user interface program called
"linuxcncrsh", the linuxcnc remote shell.  It accepts network
connections and receives commands over TCP.  It's probably a worse
solution than "ssh python", but it has better docs...  It's also used in
our test suite so you can see examples there.


-- 
Sebastian Kuzminsky

------------------------------------------------------------------------------
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