Interfacing to Linuxcncrsh from another PC
- ultrasmurf
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 2
20 Jun 2022 03:53 #245469
by ultrasmurf
Interfacing to Linuxcncrsh from another PC was created by ultrasmurf
Hi guys,
Would like to get some pointer and howto for linuxcncrsh.
Background:
I installed linuxcnc on orangepi using this allwincnc.github.io/
Machine is actually a pick and place machine rather than machining machine. Configured linuxcnc to control 4 axis (XYZA, I declare A as linear axis eventhough it's actually a rotation axis, and just record the required number to rotate it to where I want it to go)
Everything moved, and runs as expected using gcode.
I need to control this machine from another computer with a GUI to do an automatic pick and place based on a vision system feedback on what object is detected.
I am currently using linuxcncrsh to get the control running and communicate through network using telnet protocol. My code in the GUI wil call a gcode program in the orangepi to do the robot movement, to pick and place it object in the correct station. Currently program is running fine as long as there is no error (e.g. vacuum failed to pick up object, robot moved in the wrong direction and crash, some object blocking the insertion path, etc)
My problem:
My program is fairly blind. The way I talk to linuxcncrsh and check if the robot is moving correctly is by detecting the program status. If the program is in paused state, it is indicating that there is error, e.g. vacuum switch is not detecting the object being picked up. In the gcode program I will be detecting all the required sensor detection using M66 and checking #5399 for required pin, and if there is timeout or the pin did not go as expected I will pause the program. The problem is I would rather have direct checking of the input pin in the linuxcnc so I can have a better error explanation rather than just a robot error (current code will throw a robot error if it sees the program status as paused).
My question :
What wil be the easiest way to talk to linuxcnc to check the pin status ?
Thanks for any pointer....
Would like to get some pointer and howto for linuxcncrsh.
Background:
I installed linuxcnc on orangepi using this allwincnc.github.io/
Machine is actually a pick and place machine rather than machining machine. Configured linuxcnc to control 4 axis (XYZA, I declare A as linear axis eventhough it's actually a rotation axis, and just record the required number to rotate it to where I want it to go)
Everything moved, and runs as expected using gcode.
I need to control this machine from another computer with a GUI to do an automatic pick and place based on a vision system feedback on what object is detected.
I am currently using linuxcncrsh to get the control running and communicate through network using telnet protocol. My code in the GUI wil call a gcode program in the orangepi to do the robot movement, to pick and place it object in the correct station. Currently program is running fine as long as there is no error (e.g. vacuum failed to pick up object, robot moved in the wrong direction and crash, some object blocking the insertion path, etc)
My problem:
My program is fairly blind. The way I talk to linuxcncrsh and check if the robot is moving correctly is by detecting the program status. If the program is in paused state, it is indicating that there is error, e.g. vacuum switch is not detecting the object being picked up. In the gcode program I will be detecting all the required sensor detection using M66 and checking #5399 for required pin, and if there is timeout or the pin did not go as expected I will pause the program. The problem is I would rather have direct checking of the input pin in the linuxcnc so I can have a better error explanation rather than just a robot error (current code will throw a robot error if it sees the program status as paused).
My question :
What wil be the easiest way to talk to linuxcnc to check the pin status ?
Thanks for any pointer....
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23170
- Thank you received: 4860
21 Jun 2022 23:21 - 21 Jun 2022 23:22 #245566
by andypugh
Replied by andypugh on topic Interfacing to Linuxcncrsh from another PC
It doesn't seem that the interface supports querying pin state. Which is a shame and feels like an oversight.
is "get error" any use to you?
note that program-line is zero when paused or stopped, which might be useful.
If you were wondering, this is the source file for linuxcncrsh:
github.com/LinuxCNC/linuxcnc/blob/master...c/usr_intf/emcrsh.cc
is "get error" any use to you?
note that program-line is zero when paused or stopped, which might be useful.
If you were wondering, this is the source file for linuxcncrsh:
github.com/LinuxCNC/linuxcnc/blob/master...c/usr_intf/emcrsh.cc
Last edit: 21 Jun 2022 23:22 by andypugh.
Please Log in or Create an account to join the conversation.
- ultrasmurf
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 2
24 Jun 2022 01:23 #245748
by ultrasmurf
Replied by ultrasmurf on topic Interfacing to Linuxcncrsh from another PC
I tried get error, get operator_text and get operator_display, all of them always reply with ok, no matter what print or debug msg i tried to put in the g code. Btw i used linuxcncrsh in the background while axis is running to have visual feedback for me to confirm that gcode is running and axes are moving properly. So it could be causing the get error etc to not seeing the text. Will start and try to run only linuxcncrsh.
Please Log in or Create an account to join the conversation.
- ultrasmurf
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 2
27 Jun 2022 06:47 - 27 Jun 2022 07:07 #245984
by ultrasmurf
Replied by ultrasmurf on topic Interfacing to Linuxcncrsh from another PC
So... running linuxcncrsh stand alone, i.e. without axis interface allows me to send text back to PC in a form of operator_display. Put a (debug, things to send to pc) in the gcode and pausing the program allows the pc to interact with the linuxcncrsh and have some sort of idea of which gcode line is running. Coupled with set open, set run programline, and set abort, it's good enough for me to pretty much be able to interact and check the pin status.
Take note, the operator_display is buffered, and if it's not cleared, it will display the earlier operator_display and not the latest one.
Another thread for reference to read or set hal pin value :
www.forum.linuxcnc.org/38-general-linuxc...l-pin-while-in-gcode
forum.linuxcnc.org/47-hal-examples/33270...n-from-gcode?start=0
Take note, the operator_display is buffered, and if it's not cleared, it will display the earlier operator_display and not the latest one.
Another thread for reference to read or set hal pin value :
www.forum.linuxcnc.org/38-general-linuxc...l-pin-while-in-gcode
forum.linuxcnc.org/47-hal-examples/33270...n-from-gcode?start=0
Last edit: 27 Jun 2022 07:07 by ultrasmurf.
The following user(s) said Thank You: tommylight, Aciera
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23170
- Thank you received: 4860
29 Jun 2022 20:26 #246201
by andypugh
Replied by andypugh on topic Interfacing to Linuxcncrsh from another PC
As you have noticed, the first thing to see an error message and display it prevents any other interface from seeing it.
I have seen a suggestion somewhere that this is an issue in need of a fix, but haven't seen anyone attempt it yet.
I have seen a suggestion somewhere that this is an issue in need of a fix, but haven't seen anyone attempt it yet.
Please Log in or Create an account to join the conversation.
Time to create page: 0.055 seconds