Need help with toolchanger comp short way around
- Mr. Technical
- Offline
- Premium Member
-
Less
More
- Posts: 80
- Thank you received: 1
15 Jul 2014 05:01 #48782
by Mr. Technical
Need help with toolchanger comp short way around was created by Mr. Technical
Hi Guys,
I have got my 12 position lathe toolchanger component working for the most part, but am having a hard time getting it to know which way is the short way around. Sometimes it gets the right answer, sometimes not. Here are some examples:
1 to 3 goes CCW. (bad)
3 to 5 goes CCW. (bad)
2 to 1 goes CCW (good)
5 to 7 goes CW (good)
12 to 1 goes CCW (bad)
Here's what the section that decides the short way looks like.
Note:
CW on my lathe means that the tool numbers increment, while CCW means they decrement.
toolprepnum means the tool that has been called (the tool pocket it goes to)
position means the current tool number (before the change)
if (ls26 == 1) { //turret_is_unclamped
int n_inc = toolprepnum - position; // desired - actual = # of locations to increment
if (n_inc < 0) n_inc += 12.0; // take care of wrap around (1 <-> 12)
// choose shortest direction for rotation
if (n_inc >= ((12.0)/2.0))
status = eRotateCW;
else
status = eRotateCCW;
} else {
}
break;
Can someone please point out what I'm doing wrong? Thanks in advance,
Mr. Technical
I have got my 12 position lathe toolchanger component working for the most part, but am having a hard time getting it to know which way is the short way around. Sometimes it gets the right answer, sometimes not. Here are some examples:
1 to 3 goes CCW. (bad)
3 to 5 goes CCW. (bad)
2 to 1 goes CCW (good)
5 to 7 goes CW (good)
12 to 1 goes CCW (bad)
Here's what the section that decides the short way looks like.
Note:
CW on my lathe means that the tool numbers increment, while CCW means they decrement.
toolprepnum means the tool that has been called (the tool pocket it goes to)
position means the current tool number (before the change)
if (ls26 == 1) { //turret_is_unclamped
int n_inc = toolprepnum - position; // desired - actual = # of locations to increment
if (n_inc < 0) n_inc += 12.0; // take care of wrap around (1 <-> 12)
// choose shortest direction for rotation
if (n_inc >= ((12.0)/2.0))
status = eRotateCW;
else
status = eRotateCCW;
} else {
}
break;
Can someone please point out what I'm doing wrong? Thanks in advance,
Mr. Technical
Please Log in or Create an account to join the conversation.
15 Jul 2014 13:43 #48794
by ArcEye
Replied by ArcEye on topic Need help with toolchanger comp short way around
Hi
Your logic is defective unfortunately.
You are calculating the number of forward moves to reach the tool position required.
But you are using that figure for backward moves too.
Also your selection logic is reversed.
Try something like
eg. Pos = 2 Cmd = 10 so n_inc = 8
12 - 8 = 4 reverse moves to position required
regards
Your logic is defective unfortunately.
You are calculating the number of forward moves to reach the tool position required.
But you are using that figure for backward moves too.
Also your selection logic is reversed.
Try something like
if (n_inc > 6 )
{
n_inc = 12 - n_inc;
status = eRotateCCW;
}
else
status = eRotateCW;
eg. Pos = 2 Cmd = 10 so n_inc = 8
12 - 8 = 4 reverse moves to position required
regards
Please Log in or Create an account to join the conversation.
27 Jul 2014 21:32 #49186
by tkamsker
Replied by tkamsker on topic Need help with toolchanger comp short way around
Hi
i di write similar component for an 12 Tool turret changer (bridgeport 412) ,..
it simply integrates and needs an left or right relays for the motor and it uses 2 switches one is a click per tool 2nd is the click for first tool .
it works ok
i now Finnish the NGC files and put in the safety
means in 2 weeks i should be ready and on the machine.
i wrote it to also use it on my lathe so it may be of use for you as well ,..
i of course inter to do it open source if it is some use for the people
i di write similar component for an 12 Tool turret changer (bridgeport 412) ,..
it simply integrates and needs an left or right relays for the motor and it uses 2 switches one is a click per tool 2nd is the click for first tool .
it works ok
i now Finnish the NGC files and put in the safety
means in 2 weeks i should be ready and on the machine.
i wrote it to also use it on my lathe so it may be of use for you as well ,..
i of course inter to do it open source if it is some use for the people
Please Log in or Create an account to join the conversation.
Time to create page: 0.121 seconds