getting spindle speed in python

More
15 Sep 2024 11:12 #310191 by rockcnc
getting spindle speed in python was created by rockcnc
Hello everyone
I want to read spindle speed in Python, but it's giving me some errors and not lunching linuxcnc
I tried it as the documentary said but don't know why it isn't working 
I'm reading some other states at the same time, but whenever I add  spindle_speed(returns float) - spindle speed value, rpm, > 0: clockwise, < 0: counterclockwise. its giving me errors

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

More
15 Sep 2024 11:54 - 15 Sep 2024 11:56 #310194 by Aciera
Replied by Aciera on topic getting spindle speed in python

it's giving me some errors


so what errors do you get?


[edit]
Sharing your python code might also be helpful.
Last edit: 15 Sep 2024 11:56 by Aciera.

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

More
15 Sep 2024 12:09 #310198 by rockcnc
Replied by rockcnc on topic getting spindle speed in python
 
import linuxcnc s = linuxcnc.stat() s.poll() sp_speed = s.spindle_speed
Am i writing the wrong command?
Attachments:

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

More
15 Sep 2024 12:16 - 15 Sep 2024 13:30 #310199 by Aciera
Replied by Aciera on topic getting spindle speed in python

but whenever I add spindle_speed(returns float)


Not sure what version of linuxcnc you are running but you may be referring to old docs as the current attribute is 'speed' inside the 'spindle' dictionary
linuxcnc.org/docs/stable/html/config/pyt...e-spindle-dictionary

So to access the speed of spindle 0:
s = linuxcnc.stat()
s.poll()
spindle_speed = s.spindle[0]['speed']
Last edit: 15 Sep 2024 13:30 by Aciera. Reason: Remove bracket from code

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

More
15 Sep 2024 12:20 #310200 by Aciera
Replied by Aciera on topic getting spindle speed in python
So you are running 2.8.x:
linuxcnc.org/docs/2.8/html/config/python...e-spindle-dictionary

The code I posted above should work.

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

Time to create page: 0.082 seconds
Powered by Kunena Forum