python hal interface

More
29 Mar 2024 22:18 #297153 by MarkoPolo
I have this problem.
In the python script I want to set the signal value like this
"hal.set_s("lenght_tool", value)" but it doesn't work.

The pin value setting works in the same file
"hal.set_p("ini.z.min_limit", val)" , but hal.set_s doesn't work.

I dealt with this problem this way:
cmd = ("halcmd sets length_tool " + tool)
subprocess.check_output(cmd, shell = True)
, but if possible I would prefer to avoid subprocess.

2. The second question is how to set the z-axis offset from the python script.
I need to make a macro that, after measuring the tool, will position g53 z0 in the A-axis rotation axis, as in the screenshot. ?

Marek
Attachments:

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

More
30 Mar 2024 07:30 #297198 by cmorley
Replied by cmorley on topic python hal interface
There is no set_s command. It was never added.
If you remove the signal, can you just set the bare pin?

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

More
30 Mar 2024 18:37 #297225 by MarkoPolo
Replied by MarkoPolo on topic python hal interface
I used signal because I can't create a new pin to be able to read and change its value. How is it done? , but I'm more concerned about problem number 2.
How to set the Z axis offset from the script.
Where are the offset values stored? In halcmd show no pin displays these values.

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

More
31 Mar 2024 00:24 #297251 by cmorley
Replied by cmorley on topic python hal interface
I meant just set the pin directly with no signal or other pin connected.
If you mean set the origin for Z then you must use the linuxcnc python module to call an MDI command.

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

More
31 Mar 2024 12:02 #297273 by MarkoPolo
Replied by MarkoPolo on topic python hal interface
I have no problem calling the MDI command from a python script.
I need to do exactly as in the screenshot, only from the script.
I don't know if I need to change the value of some pin or signal, or something else.
Attachments:

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

More
31 Mar 2024 12:59 #297278 by Aciera
Replied by Aciera on topic python hal interface
To set the G54 offset values from MDI try:

G10 L2 P1 Z-23

To set the currently active offset value from MDI try:

G10 L2 P0 Z-23
The following user(s) said Thank You: MarkoPolo

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

More
31 Mar 2024 13:16 #297280 by MarkoPolo
Replied by MarkoPolo on topic python hal interface
Just what I needed, it works. Thanks
I still don't know the gcodes very well.
The following user(s) said Thank You: cmorley

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

Time to create page: 0.095 seconds
Powered by Kunena Forum