Welcome, Guest. Please login or register.
Did you miss your activation email?
December 03, 2008, 10:42:26 PM
Home Help Search Calendar Login Register
News: Any Problems or Experience with Industrial Robots ?
Register and place your Question to worldwide Robotexperts right here !

+  Robotforum | Support for Robotprogrammer and Users
|-+  Robot Help and Discussion Center
| |-+  KUKA Robots (Moderators: Werner Hampel, kai_n, MartinH)
| | |-+  Task Handling
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Task Handling  (Read 341 times)
jseger
Jr. Member
**
Offline Offline

Posts: 94



« on: September 25, 2008, 05:16:47 PM »

I need help.    

I need to load two machines(HAAS CNC) with one robot(KRC2).  The machines need attention at different rates.  Also what if there is an error on one of the tasks.  Depending on the error the robot should abandon that task and stay on the other task.  A task should not be started if certain criteria aren't met like a closed door or something.

I thought this would be fairly easy, but I'm getting a hedache trying to make this idiot proof.     I basically limited to digital i/o and not a lot of them either.

So if anyone has any ideas as how to go about this that would be great.  Thanks a lot.
Logged
mookie
Full Member
***
Offline Offline

Posts: 111


« Reply #1 on: September 25, 2008, 07:01:35 PM »

arent you simply just loading a machine if it is ready to be loaded?

if (machine_one_Ready)
 Load_Machine(1)
end if

if (Machine_Two_Ready)
 Load_Machine(2)
End if

you need to know the status state of the machine and base everything upon there i would think.
Logged
jseger
Jr. Member
**
Offline Offline

Posts: 94



« Reply #2 on: September 25, 2008, 08:04:04 PM »

So are you talking about just writing an infinate loop and when a signal goes high it would enter the sub program.  That's a good idea.

What if the signal turns on while it's in the other sub program?  Would the machine just hold it on until it got a response from the robot and then the machine would turn it off?

I can't think anymore right now.  My brain is fried.    
Logged
mookie
Full Member
***
Offline Offline

Posts: 111


« Reply #3 on: September 26, 2008, 01:58:38 AM »

well maybe im missing something but i would think it would all come from the main level

when the robot is at its inital state of ready and is awaiting a command, you then look to see what machine is ready to load.
what is the process of what it is your looking to do more in detail?

Logged
asimo
Full Member
***
Offline Offline

Posts: 174


« Reply #4 on: September 26, 2008, 02:08:45 AM »

Yes it will if you program it that way. The code provided by mookie will work if machine_one_ready is a signal from an input:

;--------8<--------
LOOP
  IF (machine_one_Ready)
    Load_Machine(1)
  ENDIF

  IF (Machine_Two_Ready)
    Load_Machine(2)
  ENDIF
ENDLOOP
;--------8<--------

While the program will be inside Load_Machine(1), it will execute it without being disturb. Once it is finished, it will look at your machine_two_ready variable (which is an input, like $IN[99]). If it is TRUE, it will do the other job. And it will go on and on.

If you want to control also all the errors, it can be very complex depending on the level of "idiot proof" you want. Depending on how you load your machines (the moves done) and the space you have around, it can be hard for example to move the robot out of the way and not crash on something.

As for the doors, etc. you simply have to check those value before executing the sub, something like:

;--------8<--------
  IF (machine_one_Ready)
    IF NOT door_is_open OR ... THEN
      Load_Machine(1)
    ENDIF
  ENDIF
;--------8<--------

If you have a lot of things to check before executing a sub, you could create a function which checks everything and return TRUE or FALSE.

Don't forget to turn off the signal at the end of loading a machine so that it doesn't try to load it if it's not necessary.

Good luck and let us know if you need more help.
Logged
mookie
Full Member
***
Offline Offline

Posts: 111


« Reply #5 on: September 26, 2008, 12:43:49 PM »

yeah i didnt mean to be short, thats simply why i just asked more about your actual process. giving you direction and help is a little unclear when we dont understand how the tool works
Logged
jseger
Jr. Member
**
Offline Offline

Posts: 94



« Reply #6 on: September 26, 2008, 02:06:49 PM »

you guys are great help.  thank you very much.

one question i have is my programs have int variables declared in their dat files.  the variables get initalized in the src and then every time the src gets ran it reduces or increase the varialbe by a specified value.

now these prgrams will be subprograms.  will the values of the variables be remembered? 

when it jumps to the subprogram it starts at the top and that where the variable is initalized so the variable will always be reset.

it seems like i'll have to initalize the variables in the top level program and declare them in the top level dat.
Logged
jseger
Jr. Member
**
Offline Offline

Posts: 94



« Reply #7 on: September 26, 2008, 03:14:09 PM »

Ok. another question.  How do I make the subprogram call a variable?  Like say I don't want to call Load_Machine() every time.  I want to be able to call a specific sub program.  Or do I have to do a bunch of IF statements to drill down the to program I want to call?
Logged
mookie
Full Member
***
Offline Offline

Posts: 111


« Reply #8 on: September 26, 2008, 07:40:40 PM »

your making my head hurt :)

if the variable is local to the actual .dat for the src. program and needs to be there then you can keep it there, you just cant refer to it outside of the program which can be frustrating.

the variable value in the dat file will stay the same way you left it as long as you leave a reference to it.


Logged
asimo
Full Member
***
Offline Offline

Posts: 174


« Reply #9 on: September 26, 2008, 08:11:59 PM »

If you declare your variable as GLOBAL, it will be visible everywhere. You can also put a variable inside the $config.dat file in the user section and it will be visible to every program also. Another option is to put the functions inside the same file, so the functions will be "local" to your program and will be able to access the variables in the DAT file. Yet another option to keep track for your variables is to pass them by reference with a parameter of your function(:OUT).

I don't understand your second question: how do a program call a variable? If you're talking about dynamically calling a function based on some variables, like the name of the function to call is inside a variable, I don't think you can do that (dynamic languages like Python). You can use, like you said, the plain old IF or the SWITCH statement (SWITCH would be more appropriate if it's based on a single variable I think).
Logged
jseger
Jr. Member
**
Offline Offline

Posts: 94



« Reply #10 on: September 26, 2008, 08:49:11 PM »

yeah that's pretty much what i was getting at.  thank you for your help.  i'll probably post some more questions as i get into it more. 

i think i'm getting sick and my brain isn't working right.   
Logged
jseger
Jr. Member
**
Offline Offline

Posts: 94



« Reply #11 on: October 02, 2008, 07:32:36 PM »

 $TOOL=NULL

 TOOLCHANGE= TOOL_NO NOT CURNTTOOL_NO      ;Check to see if tool change is required

 IF TOOLCHANGE== TRUE THEN                 ;Check to see if tool change is required
   PTP TOOLSAFE                            ;Safe Move
     SWITCH CURNTTOOL_NO                   ;Deposit Tool
      CASE 1
          TOOLDEPOSIT_1()
      CASE 2
          TOOLDEPOSIT_2()
      CASE 3
          TOOLDEPOSIT_3()
     ENDSWITCH
     SWITCH TOOL_NO                       ;Grab Tool
       CASE 1
          TOOLGRAB_1()
       CASE 2
          TOOLGRAB_2()
       CASE 3
          TOOLGRAB_3()
     ENDSWITCH
  PTP TOOLSAFE

 B= TOOL_NO = CURNTTOOL_NO          ;Confirm correct tool
   IF B== FALSE THEN
     HALT                           ;HALT Robot
   ENDIF
 ENDIF


END                          ;End of Tool change Program






Can I do that??  Two switch loops in a row?  Am I gaurenteed that it will execute the first switch loop before the second??
Logged
asimo
Full Member
***
Offline Offline

Posts: 174


« Reply #12 on: October 02, 2008, 07:45:49 PM »

Of course you can. You can put as much as you want. As you said, it will do the first one and then the other one. You could even add the "default" statement to grab some errors, i.e.:
;--------8<--------
     SWITCH CURNTTOOL_NO                   ;Deposit Tool
      CASE 1
          TOOLDEPOSIT_1()
      CASE 2
          TOOLDEPOSIT_2()
      CASE 3
          TOOLDEPOSIT_3()
      DEFAULT
          ; Do something here to grab other cases.
     ENDSWITCH
;--------8<--------
Logged
jseger
Jr. Member
**
Offline Offline

Posts: 94



« Reply #13 on: October 02, 2008, 08:42:31 PM »

 

Thanks forr the super fast reply.

I think maybe this is a cleaner program??  I'm up for any critism at all.  If any of you experts would be so kind as to tell me if there is a better way please do so.  Thanks.



DEF TOOLCHANGE(TOOL_NO:IN)                       ;Global SP  Calls TOOL_NO variable from main program
                                                                          :TOOL_NO is the requested Tool
(----------DECLARATION SECTION-----------)

DECL AXIS TOOLSAFE
DECL E6POS Tool_Home_Pos, Tool_Dep_Pos, Tool_Grab_Pos
DECL INT A

(----------INITIALIZATION SECTION--------)

bas (#initmov,0)

TOOLSAFE={AXIS:A1 -90,A2 -140,A3 136,A4 0,A5 90,A6 90}

INT TOOL_NO
SIGNAL CURNTTOOL_NO $IN[6] TO $IN[8]           ;Robot recieves digital input when a tool is mounted


(---------MAIN SECTION------------------)
 $TOOL=NULL
 $BASE=TOOLRACK

 IF TOOL_NO NOT CURNTTOOL_NO THEN          ;Check to see if tool change is required
   PTP TOOLSAFE                            ;Safe Move
      TOOLDEPOSIT()                        ;Deposit Tool
      TOOLGRAB()                           ;Grab specified tool
   PTP TOOLSAFE

   IF TOOL_NO NOT CURNTTOOL_NO THEN        ;Confirm correct tool
    HALT                                   ;HALT Robot
   ENDIF
 ENDIF
END                                        ;End of Tool change Program

DEF TOOLDEPOSIT()       ;Tool deposit subprogram local
A=CURNTTOOL_NO
TOOLPOS()
 PTP Tool_Dep_Pos
 $VEL_CP= .1 m/s
 LIN Tool_Home_Pos
 $OUT_C[5]= TRUE
 WAIT 1 sec
 LIN_REL {Y 150}
END

DEF TOOLGRAB()                       ;Tool grab subprogram local
A=TOOL_NO
TOOLPOS()
 PTP Tool_Grab_Pos
 $VEL_CP= .1 m/s
 LIN Tool_Home_Pos
 $OUT_C[5]= TRUE
 WAIT 1 sec
 LIN_REL {Z 200}
END


DEF TOOLPOS()       ;Loads correct tool locations

 SWITCH A
   CASE 1
    Tool_Home_Pos= {X 0,Y 0,Z 0,A 0, B 0,C 0,S 0,T 0}
    Tool_Dep_Pos= Tool_Home_Pos
    Tool_Dep_Pos.Z= Tool_Safe_Pos.Z + 200
    Tool_Grab_Pos= Tool_Home_Pos
    Tool_Grab_Pos.Y= Tool_Grab_Pos.Y - 75
   CASE 2
    Tool_Home_Pos= {X 178,Y 0,Z 0,A 0, B 0,C 0,S 0,T 0}
    Tool_Dep_Pos= Tool_Home_Pos
    Tool_Dep_Pos.Z= Tool_Safe_Pos.Z + 200
    Tool_Grab_Pos= Tool_Home_Pos
    Tool_Grab_Pos.Y= Tool_Grab_Pos.Y - 75
   CASE 3
    Tool_Home_Pos= {X 356,Y 0,Z 0,A 0, B 0,C 0,S 0,T 0}
    Tool_Dep_Pos= Tool_Home_Pos
    Tool_Dep_Pos.Z= Tool_Safe_Pos.Z + 200
    Tool_Grab_Pos= Tool_Home_Pos
    Tool_Grab_Pos.Y= Tool_Grab_Pos.Y - 75
   DEFUALT
    HALT
END

 6
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!