Input an external couple of x-y in GCode
- gfxx
- Topic Author
- Visitor
I Define custom M100 code. -> M100 launch mypythonprogram.py
(mypitonprogram.py bringh a couple of coordinates from vision system and rewrite a custom gcode mysubroutines.ngc files)
When start my GCode program (myGCode.ngc) ->
myGCode.ngc program call mysubroutines.ngc ->
myGCode.ngc execution is ok ->
a custom myfile.hal start again (with hal timer) myGCode.ngc program.
It's all ok but I want to change the coordinates in to mysubroutines.ngc without restart myGCode.ngc program.
It is possible these in linuxcnc?? with or without python??
Please Log in or Create an account to join the conversation.
The reason a re-load is necessary is because the interpreter reads ahead and stores the code.
Unless you restart, you will get the values that were present when it last read the code.
That goes for sub-routines too, it does not differentiate, just follows the trail wherever it goes.
Passing a value to a running Linuxcnc is very tricky.
If it is not running you can update the value of parameters via MDI and use those parameters in your sub instead of fixed values.
But if it is not running you can just reload, which is what you appear to be doing.
There may be some python method to change parameter values on the fly, you can certainly fetch them, but I am not really into python.
Someone else may be able to assist
regards
Please Log in or Create an account to join the conversation.
- gfxx
- Topic Author
- Visitor
Tryky or not is not a problem .... the question is: is it possible?
I read that I can pass value from cable pin of analog input, there is some other alternatives? .... using linuxcncrsh may be .... but I dont understand if is possible using linuxcncrsh with axis or some other gui.... is possible?
there are some other triks?
For example is possible set value on encoder input in hal using some c/c++ component?
other ideas?
Please Log in or Create an account to join the conversation.
I used to do whole operations on the MDI line, often stacking up several pending moves and just walking away for a bit until it got near finishing the last one before checking all was well and entering a few more.
There was talk of doing away with this on safety grounds, but thankfully does not seem to have happened
If your principle input is external you could write a program to fed the moves necessary, substituting variables for actual data as required.
You can run linuxcncrsh with an instance of Axis running, but normally best not to and of course Axis is required for axis-remote
regards
Please Log in or Create an account to join the conversation.
- gfxx
- Topic Author
- Visitor
tanks a lot ..... other information .... the best solution is axis-remote or linuxcncrsh ??
Please Log in or Create an account to join the conversation.
tanks a lot ..... other information .... the best solution is axis-remote or linuxcncrsh ??
The simplest to start with, which does not require telnet or similar, is axis-remote.
Start axis in one terminal, take it out of estop, home it etc
Then in another terminal run axis-remote --mdi 'G0 X20 Y20 Z20'
The MDI tab in Axis will open and the command will be pasted in and run
You can then quite simply use system("axis-remote --mdi 'G0 X20 Y20 Z20'") from a C program to do the same
If what you want to do could be done on a MDI line, that is possibly as technical as you need to get
regards
Please Log in or Create an account to join the conversation.
- gfxx
- Topic Author
- Visitor
QString command;
command = "axis-remote --mdi 'G0 X20 Y20 Z20'";
system(command.toStdString().c_str());
command = "axis-remote --mdi 'G0 X120 Y120 Z20'";
system(command.toStdString().c_str());
work perfect but axis return these error...
unknown parameter instead of a unary operation ......
You know why?
tanks a lot
Please Log in or Create an account to join the conversation.
unknown parameter instead of a unary operation ......
It is telling you there is a character in the string it does not like.
Could be the single quote marks, which tell bash the arguments are a single string, try without.
In the past I have had to use a char buffer to pass arguments to system(), the output from a QString is not always as required.
If removing the quotes does not work, try that
regards
Please Log in or Create an account to join the conversation.
- gfxx
- Topic Author
- Visitor
Tanks a lot ArcEye....
I use QString because is the value that step with my signal from my funtion to thread ... function read from soket x -y couple an pass these signal to QTharead. QThread execute system axis-remote statment with QString command. .....
I have a doubt: this approach does not allow you to perform the individual rows one at a time, as in reality LinuxCNC run everything in the buffer ..... the buffer is loaded with strings of commands without LinuxCNC can tell if it's done or not previous command. is that correct?
I need to create custom M1xx command that tell at my c++ program when previous mdi command is terminate? or I can lauch some custom c/c++/puthon program from hal custom component when every mdi command finish?
The second idea seems better, do you have any suggestion to study to accomplish this?
Please Log in or Create an account to join the conversation.
I use QString because is the value that step with my signal from my funtion to thread
I use Qt a lot, and thus QString. There are occassions when interfacing with C code which requires a char*, where no matter how you cast the QString, it does not work properly.
I have a doubt: this approach does not allow you to perform the individual rows one at a time, as in reality LinuxCNC run everything in the buffer ..... the buffer is loaded with strings of commands without LinuxCNC can tell if it's done or not previous command. is that correct?
I am not quite sure what you mean.
MDI commands are queued and will be executed in sequence that they were input, until the last one is finished.
If you need to know when a MDI command has finished before doing something else, you could just send 2 lines each time, the first being the command and the second being a M code which executes a program that flags up that the command has finished
eg
system("G01 X23 Y45");
system("M101");
Trying to determine programatically through a component when a MDI command has finished might be quite complicated, the above is simple because M101 will only be executed when the preceding line is finished.
regards
Please Log in or Create an account to join the conversation.