Live tool wear compensation
I can write function in C++ in the HAL file?
Well, sort-of. Comp (which is more like C) and in a HAL component.
linuxcnc.org/docs/html/hal_comp.html
Please Log in or Create an account to join the conversation.
- grandixximo
- Topic Author
- Offline
- Premium Member
- Posts: 132
- Thank you received: 5
I have read your post countless times, i still don't understand some things, you say to program a G10 L1 after every G1, but it's an error to write a G10 L1 while tool compensation on, so there is no recalculation unless i exit compensation and re enter it for each and every move.
Wouldn't it be simpler to have a custom Mcode that set a pin to the wear value (managed with the cam according to the working distance), having this pin change gradually with limit.2, and then send it inside an hal component with the working direction from the kinematics, to calculate X and Y offsets.
Or might be even better having the wear as axis W with acceleration, always managed the same way, if my CAM could send me a calculated wear on each line, this implementation should be simpler right?
The diameter can be set with G10L1 after the compensation is finished, so the next compensated job will start from compensation 0 again.
Please Log in or Create an account to join the conversation.
I thought that you were trying to compensate something like a cylindrical grinder, where tool length is what needs to be compensated, not tool diameter. I that case I think you could continually update the tool length, though it would interrupt motion blending.I have read your post countless times, i still don't understand some things, you say to program a G10 L1 after every G1, but it's an error to write a G10 L1 while tool compensation on, so there is no recalculation unless i exit compensation and re enter it for each and every move.
Yes, this would be simpler, and there is actually no need for it to be an M-code. You could use a G-code analogue output into a HAL component.Wouldn't it be simpler to have a custom Mcode that set a pin to the wear value (managed with the cam according to the working distance), having this pin change gradually with limit.2, and then send it inside an hal component with the working direction from the kinematics, to calculate X and Y offsets.
The HAL component could track X and Y positions and calculate distance of cut, and then output offsets to be applied to the joint positions.
There is no way to do this at a lower level. The G-code is converted into a sequence of linear moves that are added to the motion queue and consumed by the real-time part of the motion system. A long straight move might be calculated once in the first microseconds of runtime, and then the actual move could last hours. Tool offsets are applied before the move gets to the queue and the tool offsets are not looked at again until the system hits a queue-buster such as toolchange (or, in fact, G10)
At least, I _think_ that is how it works, and it is likely to become more, not less, like that in the future.
Please Log in or Create an account to join the conversation.
- grandixximo
- Topic Author
- Offline
- Premium Member
- Posts: 132
- Thank you received: 5
But with M68 or a custom Mcode M100 -199 like i was thinking would both still break the axis motion, and not having a nice G64 continuos speed on my cotour will ruin the polish.
from the docs
M68 output happen immediately as they are received by the motion controller.
They are not synchronized with movement, and they will break blending.
M100 Execution of the G code file pauses until the external program exits
So i think axis W should be the way to go, it won't brake motion at least, it will be interpolated as axis W.
Please Log in or Create an account to join the conversation.
When you say G-code analogue output, i think you mean M68, right?
No, M67. That gets inserted into the motion queue and doesn't break blending.
Please Log in or Create an account to join the conversation.
- grandixximo
- Topic Author
- Offline
- Premium Member
- Posts: 132
- Thank you received: 5
I see it now
Please Log in or Create an account to join the conversation.
- grandixximo
- Topic Author
- Offline
- Premium Member
- Posts: 132
- Thank you received: 5
Please Log in or Create an account to join the conversation.
any suggestions on how should i get the direction pin out of the kinematics?
You could have a look at tangentkins: www.linuxcnc.org/index.php/german/forum/...t-to-path-xy?start=6
I will point out that it doesn't work perfectly. In an ideal world there would be a HAL pin directly driven by the motion planner.
Please Log in or Create an account to join the conversation.
- grandixximo
- Topic Author
- Offline
- Premium Member
- Posts: 132
- Thank you received: 5
How should i go at creating pins showing G41 or G42, can i do this in kinematics module also?
You wrote i should export this from kinematcs in an old post, but i really don't see how.
Please Log in or Create an account to join the conversation.
How should i go at creating pins showing G41 or G42, can i do this in kinematics module also?.
I don't think kinematics is the natural place to do that.
In the development branch the current compensation mode is available to G-code as #<_comp> though that might not be any help to you:
www.linuxcnc.org/docs/devel/html/gcode/o....html#sec:parameters
I don't have access to the git repository at the moment, so I can't see the source code to work out if the required HAL pin already exists somewhere, though I think that the natural home for such a pin would be in halui
www.linuxcnc.org/docs/devel/html/man/man1/halui.1.html
Please Log in or Create an account to join the conversation.