[LinuxCNC/linuxcnc Issue#400] M6 Remap does not handle pockets correct!

未分类 bolang 5个月前 (10-15) 22次浏览

Issue #400 | 状态: 已关闭 | 作者: gmoccapy | 创建时间: 2018-01-20

标签: tooltable


If you do remap M6 code, according to the stdglue.py file it should transfer as parameters

self.params[“toolinspindle”]
self.params[“selected_tool”]
self.params[“current_pocket”]
self.params[“selected_pocket”]

But LinuxCNC does not handle the pocket relation correct.
Just place tool 3 in pocket 8 and call T3 M6, that should return pocket 8 but does return pocket 3 instead!

Any hint would be appreciated to solve this.

Norbert


评论 (12)

#1 – andypugh 于 2018-01-20

On 20 January 2018 at 21:18, Norbert Schechner
wrote:

> But LinuxCNC does not handle the pocket relation correct.
>
> Just place tool 3 in pocket 8 and call T3 M6, that should return pocket 8
> but does return pocket 3 instead!
>
It might work better if you turn on random tool changer.

The stdglue.py does say that the result is probably nonsense:
https://github.com/LinuxCNC/linuxcnc/blob/master/ncfiles/remaplib/python-stdglue/stdglue.py#L163

The problem is that the tool table version passed about in NML does not
contain pocket info, and what you actually get (on a non-random changer) is
the index of the tool array.

It was one of the things I tried to fix in
https://github.com/LinuxCNC/linuxcnc/tree/andypugh/tooltable but I was
never brave enough to merge that without somebody else testing it, and
nobody ever did.


atp


#2 – gmoccapy 于 2018-01-22

I haved looked at your branch, that would be great to be impemented, but until than, we should find a inbetween solution.

I do not use a random tool chnager, but imagine the following:
You have a tool changer with 10 pockets, but you have 30 tools availible and measured, all tools are in the tool table.

Now you need 8 tools for a job, ie. Tools 1,2,3,4,6,10,25,26
To use them you need to put them in the changer, lets say you use pocket 1 to 8.
Placing them in the changer is quickly done, but now you need to edit your tool file, putting them in the correct pockets and giving them the correct tool numbers.

Shit, your cam software has also included the 30 tools and does not know about pockets!
This will be a big disaster from now on.

I have written a small glade panel with a little python code. To take a tool out of the pocket I just click on that tool and the python script changes the pocket number automatically by adding 100, so taking tool 3 out, will edit the tool file to be pocket 103. So now I click on the empty pocket and a window will pop up asking me witch tool I want to place in that pocket, I enter 25 and the tool will be moved from pocket 25 to pocket 3. I do not even touch the tool editor!

All that works as expected, but if I start a program and the interpreter finds T25 M6 he tries to get that tool from pocket 25 instead of pocket 3. So I do need to do a lot of editing of files prior of using any gcode file.

IMHO that is not acceptable!

So I took a look at tool_parse.cc
What about adding here something like

toolTable[pocket].pocketno = pocket

and in interp_find.cc
in findtoolpocket change
*pocket = i;
to be
*pocket = tool_table[i].pocketno

Unfortunately, I am just with the first steps on C++ and I do not feel brave enough to make such changes, as I do not know if the code need to be touch on any other place.

I can share my python code If that would help, as I do use a dictionary to handle all the above mentioned tool file modifications and that code does return the correct pocket number.

Norbert


#3 – gmoccapy 于 2018-01-23

I played a little bit with the code and pushed my changes as:

newbynobi_mastertool_pockets

I reached a state, that the pockets are reported correct at the remap module, but now the iocontrol pin are wrong :-(

As mentioned I am completely new to C++ so I may produce rubbish, but I am trying hard and Rene_dev told me I must learn C++, so here I am learning.

So could someone push me in the right direction?

Norbert

P.S. I added two configs (axis and gmoccapy) both containing a diagnostics and a rack tool changer tab. (axis is not so beautiful to embed the rack changer but does work after extending the screen.

To use the python tool changer just click on the open button to open the changer cover, after that you can click on an image to load or unload a tool (like you would do on a real machine)
Watch the tool file to see the pockets changing by 100 places.


#4 – rene-dev 于 2018-01-23

The code he is talking about is here: https://github.com/LinuxCNC/linuxcnc/compare/newbynobimastertool_pockets#diff-22efa6c95bb01316fb5517cec373f87dL25
hmm, iocontrol takes the numbers from emcstatus https://github.com/LinuxCNC/linuxcnc/blob/master/src/emc/iotask/ioControl.cc#L876


#5 – gmoccapy 于 2018-02-18

Hallo Andy,

I just tried your branch, nut that one is based on 2.6.
I tried to merge master into that one, but than my configs does not start, may be it is related to the new Joint Axis handling :-(

Norbert


#6 – gmoccapy 于 2018-02-22

OK, after sebs last commit, iocontrol does report the correct pocket and toolno, but remap still shows very strange numbers.

Please open /sim/axis/remap/rack-toolchange/racktoolchange
Open tooltable and place T3 in pocket 5, T5 in pocket 6 and T6 in pocket4
Apply changes
Open hal show and watch iocontrol pin
Open /ncsubroutines/racktoolchange.ngc and uncomment the print statements
Save file
Get out of estop / home machine, goto MDI
enter T1
enter M6
Tool will be picked from pocket 1, as it should, reporting in terminal is OK
enter T6
enter M6
Tool will be picket from pocket 6 instedt of pocket 4

Where is that handled?

Norbert


#7 – rene-dev 于 2018-02-22

I think @SebKuzminsky would really like a test for this.
what you see is most likely the index number. this can be converted by looking it up in the fms array.
in iocontrol this is done here with fms[p]:
https://github.com/LinuxCNC/linuxcnc/blob/master/src/emc/iotask/ioControl.cc#L869
but I dont know where the remap is called…


#8 – gmoccapy 于 2018-02-22

And we need also a working param[current_pocket], that one is also not handled correctly. Otherwise the remap would not know where to put back the tool in spindle.

But unfortunately I do not know easer where to look for that :-(

Norbert


#9 – gmoccapy 于 2018-02-22

See also issue 239, it is related to this one


#10 – rene-dev 于 2018-02-25

@gmoccapy if you write the numbers like this #239 the issues are referenced.

I think part of the problem is, that pocket numbers for non random toolchangers where never intended to be used like this:

https://github.com/LinuxCNC/linuxcnc/blob/15a4d11ffe8e190c7ba088be2de6650e9f0b0ccc/docs/src/code/code-notes.txt#L1442-L1444


#11 – rene-dev 于 2018-03-04

https://github.com/LinuxCNC/linuxcnc/pull/415


#12 – rene-dev 于 2020-04-20

fixed in 2.8 and master by dab2a051b30e600ef95fbe911053386ef44631d0


原始Issue: https://github.com/LinuxCNC/linuxcnc/issues/400

喜欢 (0)