Does anyone know if there is a way to programmatically test for the existence of an argument?
Determining if there is an argument present in TP
-
Nation -
January 6, 2013 at 4:38 PM -
Thread is Resolved
-
-
Not really sure what your asking.
-
Say I call a program as follows:
and inside of SUBCALL I have:
It will run fine.
But if I call the SUBCALL program without any arguments, like so:
It will fault on the if statement with an INTP-288 error. (Parameter does not exist)
CodeIF AR[1]=1, JMP LBL[100] ; <--INTP-288 FAULT !Do stuff... END ; LBL[100] ; !Do other stuff... END ;
I want to know if there is anyway to test for the existence of an argument passed to the SUBCALL program.
-
As far as I know there is not a way to check for the existence of a parameter in a TP program.
But you can do it using Karel.
You can use this instruction ( Syntax : GET_TPE_PRM(param_no, data_type, int_value, real_value, str_value, status)
To determine if the parameter exist and paste the result on a flag or register and check for that on your TP program.
You need to have the Karel option loaded in your controller in order to be download any Karel program.
Also you need to have the olpc-pro to compile the file on you pc.
I would like to know if there is another way more simple. -
Unfortunately, the job I am working on, the customer did not buy any options whatsoever. So no karel for me. Also, you no longer get a free pass on karel for the R30-iB.
Its starting to sound like that there isn't a way to do it. I really wish I could do something like this:
-
Still not sure I understand what your wanting to do. where you have CALL SUBTEST you need to have a variable for the argument, CALL SUBTEST(1), thats why you are getting that alarm.
-
I want that variable to be optional. Similar to how the Present() function works in ABBs.
-
Well, if Karel is not an option,
Then you will need to have that argument in all your calls. Probably use a negative value when the argument shouldn't exist.IF AR[1]<>-1, JMP LBL[10] ;
IF AR[1]=1, JMP LBL[100] ;
LBL[10] ;
!Do default stuff...
END ;
LBL[100] ;
!Do other special stuff...
END ;Yeap! I can't think on something different. I know... It is too bad and I guess Fanuc guys believe that programmers don't need that option using TP programs... As I said in Karel it is possible.
-
Well, if Karel is not an option,
Then you will need to have that argument in all your calls. Probably use a negative value when the argument shouldn't exist.IF AR[1]<>-1, JMP LBL[10] ;
IF AR[1]=1, JMP LBL[100] ;
LBL[10] ;
!Do default stuff...
END ;
LBL[100] ;
!Do other special stuff...
END ;Yeap! I can't think on something different. I know... It is too bad and I guess Fanuc guys believe that programmers don't need that option using TP programs... As I said in Karel it is possible.
I was thinking of something like this too.
-
I decided to go with a register as the solution.
The call:
Code89: !Advance the slide for gripper 1 ; 90: !and ignore switch. ; 91: R[192:Enb Quick Exit]=1 ; 92: CALL G1ADVANCE ;
How I use it:
Code
Display More/PROG G1ADVANCE Macro /ATTR COMMENT = "G1 Advance Slide"; /MN 1: JMP LBL[1] ; 2: !******************************** ; 6: ! ; 7: !Program Name: G1ADVANCE ; 8: ! ; 9: !Program description: ; 10: !Advances the slide for gripper 1 ; 11: ! ; 12: !Revision History: ; 13: !v1.0 - 11/7/12 ; 14: !v1.1 - 1/6/13 ; 15: ! ; 16: !Revision Description: ; 17: !v1.0 - Initial release ; 18: !v1.1 - Added Quick Exit logic ; 19: ! ; 20: !******************************** ; 21: LBL[1:Begin] ; 22: ; 23: DO[482:Return Gripper1]=OFF ; 24: DO[481:Advance Gripper1]=ON ; 25: ; 26: !Exit early if told to do so. ; 27: IF R[192:Enb Quick Exit]<>0,JMP LBL[32766] ; 28: ; 29: !Wait for slide advanced input ; 30: $WAITTMOUT=200 ; 31: WAIT DI[481:Gripper1 Advanced]=ON TIMEOUT,LBL[9001] ; 32: ; 33: !Make sure return switch is off. ; 34: IF DI[482:Gripper1 Returned]=ON,JMP LBL[9005] ; 35: ; 36: !Gripper slide advanced. ; 37: END ; 38: ; 39: ; 40: !******************************** ; 41: !Fault area ; 42: !******************************** ; 43: ; 44: !The slide failed to advance. ; 45: LBL[9001:Advance Err] ; 46: CALL FAULT(1) ; 47: JMP LBL[9999] ; 48: ; 49: !Both switches on. ; 50: LBL[9005:Bth swtch on Err] ; 51: CALL FAULT(5) ; 52: JMP LBL[9999] ; 53: ; 54: !Go Home and abort. ; 55: LBL[9999:Recovery] ; 56: DO[481:Advance Gripper1]=OFF ; 57: DO[482:Return Gripper1]=ON ; 58: WAIT .50(sec) ; 59: CALL RECOVERY ; 60: CALL ABORTIT ; 61: LBL[32766:End of program] ; 62: R[192:Enb Quick Exit]=0 ; /POS /END
Maybe sometime in the future we will get this functionality. Seeing as how it took until about 2007 for Fanuc to implement program names longer than 8 characters, I bet we should have something like what I want around 2025 or so.
-
Maybe sometime in the future we will get this functionality. Seeing as how it took until about 2007 for Fanuc to implement program names longer than 8 characters, I bet we should have something like what I want around 2025 or so.
Darn, I guess I'm still 4 years too early looking for this same functionality...
-
Darn, I guess I'm still 4 years too early looking for this same functionality...
only 3 more years!
-
One more year hopefully. lol
-
:fingerscrossed: !
-
This would be really helpful right about now...c'mon FANUC anytime now...
-
Still waiting...
-
Given the R50iA comes out next year, and it supports python snippets, I might be correct!
It will be interesting to find out.
-
That sounds really ground breaking for Fanuc ecosystem.
-
Given the R50iA comes out next year, and it supports python snippets, I might be correct!
It will be interesting to find out.
Nation, I had no idea about this until I saw your comment. Besides being about to use Python, it looks like the R-50iA also has "Integration with Visual Studio Code". Do you know any specifics, or have any idea as to what FANUC means when they say that the R-50iA has "Integration with Visual Studio Code"? Very curious about that. 🤔
-
Check the below link for some official information about the capabilities of the new R-50iA controller.
ROBOT New product: Robot Controller R-50iA - New Product - Products - FANUC CORPORATION
According to my sales rep, the official product release is planned for October 2024 (at least in Europe/Germany). I have also asked for some detailed information but so far I didn't receive more details.
-