toolchange problem

More
13 Sep 2024 05:58 #310048 by rockcnc
toolchange problem was created by rockcnc
Hello everyone
I'm creating a toolchange with stm and I just can't solve this problem.
I have remapped the M6 so when it's reached, python will send tool number to my stm with serial and z will go to tool change position
Now I have to turn the spindle to correct position and stop it 
Then I have to move z up a bit in a precise moment when tool is about to release(its when stm send "z up" to python)
Then again I have to move back Z to its previous position
Theses are the tasks must be done through linuxcnc
So I thought I could easily use
c.mdi
command and sent some gcodes but it didn't work during toolchange
So I use
self.Execute("G53 G0 Z85.0") #z to start position
  and it worked well
But the other commands must wait for serial command.
I start writing a while loop so the code always get new serial and Execute the right command in its price moment, but when I write a while anywhere in python self.execute will not work and nothing happens
 
Attachments:

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

More
13 Sep 2024 11:55 #310063 by Aciera
Replied by Aciera on topic toolchange problem
For
self.Execute("G53 G0 Z85.0") #z to start position
to actually execute before the remap code is done you would have to have a quebuster like this right after it
yield INTERP_EXECUTE_FINISH

However due to internal limitations we cannot call 'self.execute()' again after having used ' yield INTERP_EXECUTE_FINISH' so your current approach won't work.

My usual workaround is to call the python remap code through an ngc wrapper and split the python code into multiple functions. With this approach you have much more freedom in inserting queuebuster commands in the python remap and in the ngc wrapper (eg M66 E0 L0).

So in your example:
I would remove 'self.Execute("G53 G0 Z85.0") #z to start position' and instead of directly calling 'M6_Remap_BiesseRover346' I would call an ngc routine like this:
G53 G0 Z85
M66 E0 L0
<call the python remap here> 
The following user(s) said Thank You: rockcnc

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

More
13 Sep 2024 12:56 #310069 by rockcnc
Replied by rockcnc on topic toolchange problem
I appreciate your attention
I send "z_up" with stm with serial and in exact moment I need z axis to go up
I'm confused how I'm supposed to do it based on your statement.
It's likely because I'm a novice so Please be considerate and lend me a hand.

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

More
13 Sep 2024 13:07 #310073 by Aciera
Replied by Aciera on topic toolchange problem

I send "z_up" with stm with serial and in exact moment I need z axis to go up

Python does not run in real time so for timing critical things a python remap is not really what you want to use in the first place. You would be much better off using a compiled real time component (ie .c or .comp) that could export stm state as hal pins.
The following user(s) said Thank You: rockcnc

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

More
13 Sep 2024 13:56 #310079 by Aciera
Replied by Aciera on topic toolchange problem
Some thoughts.

As for getting data to/from your STM, here is a project using STM, that may (or may not) give you some ideas:
github.com/scottalford75/Remora

Also with the 'external offset' feature you could move your Z axis without using Gcode but entirely from HAL.
linuxcnc.org/docs/stable/html/motion/external-offsets.html
The following user(s) said Thank You: rockcnc

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

More
13 Sep 2024 14:00 #310080 by zz912
Replied by zz912 on topic toolchange problem
First question.
Why do you use stm?

Have you considered using Modbus RTU?
The following user(s) said Thank You: rockcnc

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

More
13 Sep 2024 14:21 #310082 by rockcnc
Replied by rockcnc on topic toolchange problem
That's exactly what I need!!
The idea you mentioned on Github caught my attention.
Your support means a lot to me

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

More
13 Sep 2024 14:23 #310083 by rockcnc
Replied by rockcnc on topic toolchange problem
The protocol is not important to me.
All I want is to move the z axis during the remapped toolchange.

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

More
13 Sep 2024 14:28 #310085 by rockcnc
Replied by rockcnc on topic toolchange problem
I'll test the ideas, thank-you all

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

Time to create page: 0.169 seconds
Powered by Kunena Forum