Run linuxcnc from python interface without axis gui

More
05 Feb 2020 09:32 #156566 by prochj51
Hi,
I am new to the linuxcnc and I have been trying to search for solution on
my own but was not successful.

I am playing with python interface on VirtualBox and
I want to start ordinary routine like this

import sys
import linuxcnc
try:
s = linuxcnc.stat() # create a connection to the status channel
s.poll() # get current values
except linuxcnc.error, detail:
print "error", detail
sys.exit(1)

when I first run axis GUI and then I run this script everything is fine.
But when I do not run axis GUI first, the line s.poll() gives me
an error emcStatusBuffer invalid err=3, apparently because linuxcnc is not initialized with ini file.

I would rather not have axis GUI on background, since I want to control from just from my custom python interface.

So my question is, how can run and initialize linuxcnc without starting axis GUI first.

I saw somewhere using subprocess like this
subprocess.Popen(["path/halshow.tcl", "-- -ini " + "myfile.ini"])
but it does not work fork and do not know if it is relevant.

Thank you for the answer and a bit of explanation in advance
Regards
Jiri

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

More
05 Feb 2020 10:43 #156582 by phillc54
The following user(s) said Thank You: prochj51

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

More
05 Feb 2020 10:51 #156583 by cmorley
If I recall correctly...

In the INI file
Change the DISPLAY =axis

To DISPLAY= python YOURGUINAME.py

Your gu must be in the appropriate location to load.

Also you can load AXIS and your gui at the same time by loafing your gui with HAL commands in the INI under the HAl section ..something like halcmd= loadusr python YOURGUINAME.py
The following user(s) said Thank You: prochj51

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

More
05 Feb 2020 15:43 #156599 by prochj51
Thanks for replies.

The change from
DISPLAY = axis to DISPLAY = halui
works.

But I also had to delete line at
[HAL]
HALUI = halui
I guess there was ambiguity.

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

Time to create page: 0.052 seconds
Powered by Kunena Forum