PathPilot Lathe with 6 place turret

More
03 Apr 2017 00:46 #90784 by brianTruck
Copied a new timing delay into PP rtlib,now timing delay works.

Turret needs to stay on a little longer to get past lock. Here is a video.





Brian

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

More
03 Apr 2017 09:35 #90791 by andypugh

Copied a new timing delay into PP rtlib,now timing delay works.

Turret needs to stay on a little longer to get past lock


would waiting for the index to go false be more reliable than a delay?

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

More
03 Apr 2017 10:18 #90792 by brianTruck
Yes that would be the best way. I'm also really having a hard time getting the opto sensor's perfectly aligned. So it would be great if it would look for the first transition ,keep track of all transitions and not make a decision on what tool it saw until the last opto goes false.
I'll have to study the oracchanger code to see how to tweak it.


Brian

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

More
03 Apr 2017 12:34 - 03 Apr 2017 12:39 #90794 by brianTruck
I'm thinking something like this might work.

If (opto1 or opto2 or opto3)
-- if(opto1 = 1 and set1 = 0)
---- set1 =1;
-- if(opto2 =1 and set2 = 0)
---- set2 =1;
-- if(opto3 = 1 and set3 = 0)
--- set3 =1;
else
---- Break;

#decode set 1,2,3 to see what tool

I had to add minus lines to hold "if" hierarchy.

Brian
Last edit: 03 Apr 2017 12:39 by brianTruck. Reason: add minus lines

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

More
03 Apr 2017 14:03 - 03 Apr 2017 14:04 #90799 by andypugh
Generally this sort of thing would be done as a state machine:
switch (state){
case 0:
  Waiting for action
  if (toolchange) {
     motor=forwards
     state = 1
case 1:
   Waiting for the right tool
   if (tool inputs == toolnumber && index){
       state = 2
case 2:
   Waiting for overshoot
    if (index == 0){
       state = 3
       timer = 300000
       motor = reverse
case 3: 
    Fixed-time reverse
    if (timer -= fperiod < 0){
        tool_changed = TRUE
        motor = stopped
        state = 0
Last edit: 03 Apr 2017 14:04 by andypugh.

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

More
04 Apr 2017 00:26 #90837 by brianTruck
Andy,
The oracchanger changer code I'm using is written as a state machine. I just need a little code to compensate for the slight variation in opto timing. Honestly It probably exists in all gray scale tool changers to some degree. The testing I've done tells me that after seeing the first opto that a half of rotation of the stepper will result in all of the opto's being inline.

Brian

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

More
04 Apr 2017 00:40 #90838 by andypugh

Andy,
The oracchanger changer code I'm using is written as a state machine.


I thought it probably was, but was too lazy to check.

You should probably add your refinements as extra states rather than as conditions within states. It's easier to analyse when you can see the state in Halscope,

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

More
12 Apr 2017 02:03 - 12 Apr 2017 02:04 #91221 by brianTruck
I've tried customizing the oracchanger code to look for opto disc and not to make a tool decision until the opto was clear. This is about the 50th version and the turret quits turning as soon as it gets into the look at opto's while loop.

Brian

File Attachment:

File Name: dynachanger.comp
File Size:12 KB
Attachments:
Last edit: 12 Apr 2017 02:04 by brianTruck.

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

More
12 Apr 2017 09:22 #91228 by andypugh
I would expect _everything_ to quit in the while loop.

You can't do a wait-loop in a realtime component. If the wait it longer than 1mS then the entire servo thread will come to a halt.

You need to enter a specific state of the state-machine that checks the condition and then runs to completion either setting a new state or not doing so.
The following user(s) said Thank You: brianTruck

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

More
12 Apr 2017 12:25 #91241 by brianTruck
Andy,
I have tried this code ,but it never see's the tool and the turret keeps turning. I know that PathPilot is reading the opto's because I "wired" them to the spindle encoder leds on the status screen. I can watch the leds change as each tools passes by. They are normally on and shut off when opening in disk passes by.


File Attachment:

File Name: dynachange...-12.comp
File Size:12 KB


Thanks'
Brian
Attachments:

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

Moderators: cncbasher
Time to create page: 0.105 seconds
Powered by Kunena Forum