Cannot use Python Interface
16 May 2022 13:20 #243080
by EdisonBin
Cannot use Python Interface was created by EdisonBin
Hi, brothers
I have a Linux CNC program. The ". Ini" file and ". Hal" file have been configured.
Now I want to write a python API to talk to Linux CNC. Get the status of Linux CNC through Python API
I found the instructions on the official website:
“ linuxcnc.org/docs/stable/html/config/pyt....html#python:reading -ini-values”
I wrote the python API file according to the instructions and loaded it into the ". Hal" file.
I run linuxcnc and find that all the printed ones are 0. Why?
I only get three basic attributes in the python API, which are:
joints , task_ state , cycle_ time
These three values can't be 0. Is there something wrong with my program?
I'll put my Python API, the ". Hal" file and the basic attribute pictures I use below
Thank you
I have a Linux CNC program. The ". Ini" file and ". Hal" file have been configured.
Now I want to write a python API to talk to Linux CNC. Get the status of Linux CNC through Python API
I found the instructions on the official website:
“ linuxcnc.org/docs/stable/html/config/pyt....html#python:reading -ini-values”
I wrote the python API file according to the instructions and loaded it into the ". Hal" file.
I run linuxcnc and find that all the printed ones are 0. Why?
I only get three basic attributes in the python API, which are:
joints , task_ state , cycle_ time
These three values can't be 0. Is there something wrong with my program?
I'll put my Python API, the ". Hal" file and the basic attribute pictures I use below
Thank you
Please Log in or Create an account to join the conversation.
16 May 2022 13:49 #243081
by andypugh
Replied by andypugh on topic Cannot use Python Interface
You need
s.poll()
In your loop to update the values.
(it needs to be in the loop, to run every cycle and update the values)
s.poll()
In your loop to update the values.
(it needs to be in the loop, to run every cycle and update the values)
The following user(s) said Thank You: EdisonBin
Please Log in or Create an account to join the conversation.
18 May 2022 02:30 #243243
by EdisonBin
Replied by EdisonBin on topic Cannot use Python Interface
Thank you very much,andypugh!
You solved the problem that bothered me easily!
Thank you
You solved the problem that bothered me easily!
Thank you
Please Log in or Create an account to join the conversation.
Time to create page: 0.093 seconds