how to load parameters from other aplication?

More
18 Jul 2016 19:21 #77609 by stenly71
Hi ,
I want to load coordinates in closed loop cycle from other aplication.
I try to load it with subprogram with external file - O <external _file> call without success.
Any idea?

Please Log in or Create an account to join the conversation.

More
18 Jul 2016 21:39 #77618 by andypugh
What is the external program language?

I think that an O-CALL needs to be to a G-code subroutine rather than an arbitrary executable. Perhaps a custom M-code will work better:

linuxcnc.org/docs/2.7/html/gcode/m-code.html#mcode:m100-m199

Please Log in or Create an account to join the conversation.

More
19 Jul 2016 18:58 #77668 by stenly71
I try to connect robot epson scara working with linuxcnc with other software to locate small parts and orient the arm to catch them.
We locate the parts and need to send coordinates X,Y and C into the program already started in axis.
Is it possible to write directly into patameters 5221 ,5222 and 5226 for g55 coordinate system?
Is it possible already started program to read parameters from external file and this file to be changed in real time?
I am open to any ideas.

Please Log in or Create an account to join the conversation.

More
19 Jul 2016 22:42 - 20 Jul 2016 22:58 #77673 by andypugh
Not elegant, but if the external routine is a shell script then

halcmd setp motion.analog-in-00 123.456

Will give a value that G-code can read with M66.

There is a Python interface that has the capability to write to G-code parameters. I think you would still need a G10 command to load the values into the coordinate system. Python can run G-code through an MDI interface, but I don't think it can do so during program execution.

linuxcnc.org/docs/html/config/python-interface.html

That doesn't document setting G-code parameters, but there is code here that does it:
github.com/LinuxCNC/linuxcnc/blob/master...n-stdglue/stdglue.py

I think it requires:
from interpreter import*
self.params[5200] = 123.456

But some experimentation will be needed to get the incantations right.
Last edit: 20 Jul 2016 22:58 by andypugh.

Please Log in or Create an account to join the conversation.

More
20 Jul 2016 22:54 #77746 by andypugh
I have done some experiments, and have determined that my ideas above probably won't work.

Setting G-code analogue inputs will work, but can hardly be called elegant.

I think your best bet is a remapped Python routine, but one of the more advanced ones:

linuxcnc.org/docs/2.7/html/remap/remap.h...onfiguring_remapping
(look at "Advanced example: Remapped codes in pure Python" )

From what I can gather you probably want to use the Python code to send a
emccanon.SET_G5X_OFFSET
command, but I would need to do some more experimenting myself to work out exaclty what is required to do that.

Please Log in or Create an account to join the conversation.

More
21 Jul 2016 10:22 #77762 by andypugh
Sternly: Are you still reading this? I am prepared to try to sort this out, but there is no point if you are no longer reading.

Please Log in or Create an account to join the conversation.

More
21 Jul 2016 11:16 #77764 by stenly71
Hi,
sorry ,but several days no time to turn on the computer .
I try to do some experiments next weekend too.

In fact all I need is to find a way to change 3 parameters in already running program in AUTO mode.
I think the program started in AXIS will be for example:

.....................

o101 while [#1 LT 10]
G1 X#1000 Y#1001 C#1005
#1 = [#1+1] (increment the test counter)
o101 endwhile

...............................

and the parameters 1000,1002 and 1005 must be changed from other application running on the same machine in real time.
the other application will find and locate the current coordinate by visual control and will send the position to AXIS.

regards

Please Log in or Create an account to join the conversation.

More
21 Jul 2016 11:27 #77765 by andypugh
If that is _all_ that the G-code does, then perhaps you could consider not running a G-code program at all.

It is relatively easy to put a Python program in charge and that could send movement commands through the MDI interface.

A HAL component (probably user-space) could be created with 3 HAL pins that could be net-ed to the motion.analog-in-00 / 01 / 12 pins to be read-in with M66.
linuxcnc.org/docs/2.7/html/hal/halmodule.html

Maybe the trick is to start from the other end. What measures the required positions?

Please Log in or Create an account to join the conversation.

More
24 Jul 2016 05:53 #77900 by Niko
Hi all,
since I'll be working with Stenly on this I believe I can chime in .
The code will probably have to do more than just the G01 .
I've been thinking about this a bit and wonder if the G codes can be remapped to take parameters from the outside .
At least that would be the simpler solution .
A much more elegant but labor intensive one would be to make a custom GUI but then I'd still need remapped G codes for that .

Right now we're looking for a simpler solution to prove a concept .

Cheers

Please Log in or Create an account to join the conversation.

More
24 Jul 2016 11:03 #77904 by andypugh

I've been thinking about this a bit and wonder if the G codes can be remapped to take parameters from the outside .


Yes, this would be a neat way to do it. Probably using Python for ease of integration.
Using remapping you also get access to the emccanon library, which lets you do lots of potentially useful things.
It isn't well documented, but you can use all the things here:
github.com/LinuxCNC/linuxcnc/blob/master...74ngc/canonmodule.cc
I think you also get to use the stuff here:
linuxcnc.org/docs/2.7/html/config/python-interface.html but I am not 100% sure about that.

A much more elegant but labor intensive one would be to make a custom GUI but then I'd still need remapped G codes for that

For a cartesian machine you could do everything in HAL and simply send joint positions directly from a GUI to stepgens or PID components. (ie, no G-code and not much of LinuxCNC). For a SCARA you need kinematics, though. You almost certainly can access kins without having G-code and Motion, but it's probably too much trouble,

Please Log in or Create an account to join the conversation.

Time to create page: 0.109 seconds
Powered by Kunena Forum