Program never enters my error handler
I have a function where I do a searchL operation just to see if a certain part is missing or not. If the searchL fails I just want to return FALSE else return TRUE. But the problem I'm having is that the program never enters my error handler at all. The code is as follows:
MODULE program
PROC program()
PERS BOOL contact;
contact:=TRUE;
PERS BOOL contact;
contact:=TRUE;
contact:=contact_func();
IF contact=TRUE THEN
weld something...
ELSE
dont weld, just continue to the end...
ENDIF
ENDPROC
FUNC BOOL contact_func()
VAR BOOL value;
value:=TRUE;
value:=TRUE;
MoveJ
FRO_SearchL
RETURN value;
RETURN value;
ERROR
IF ERRNO=ERR_WHLSEARCH THEN
value:=FALSE;
TRYNEXT;
ENDIF
ENDFUNC
ENDMODULE
When the searchL fails the robot just stops and gives me the error "80001 part is missing" but I want to continue from that state. Any ideas what I'm doing wrong?
When the searchL fails the robot just stops and gives me the error "80001 part is missing" but I want to continue from that state. Any ideas what I'm doing wrong?
Tagged:
0
Best Answer
-
Here is an example of how it could look.Systemintegrator - Web / C# / Rapid / Robotstudio
If I helped, please press Vote Up
☑️2024 - RobotStudio® User Group0
Answers
-
I do not see a search instruction there (unless you have abbreviated it with FRO_SearchL). Or is that a procedure call which actually does the search?Lee Justice0
-
You cant declare
PERS BOOL contact;
within a procSystemintegrator - Web / C# / Rapid / Robotstudio
If I helped, please press Vote Up
☑️2024 - RobotStudio® User Group0 -
True, it should be like this:
MODULE programPERS BOOL contact:=TRUE;
PROC program()Lee Justice0 -
My bad, I don't have the PERS BOOL in the proc.
FRO_search does the search. I'm new to this and trying to learn as much as possible, could someone give me an example code of a FUNC like mine that actually works so I might see what I'm doing wrong.
0 -
Marcus_D said:My bad, I don't have the PERS BOOL in the proc.
FRO_search does the search. I'm new to this and trying to learn as much as possible, could someone give me an example code of a FUNC like mine that actually works so I might see what I'm doing wrong.
Like lemster68 said there is no search function in your proc.Systemintegrator - Web / C# / Rapid / Robotstudio
If I helped, please press Vote Up
☑️2024 - RobotStudio® User Group0 -
Sorry, for that, I tried to only post the relevant parts. Obviously, I failed.
The FUNC looks like this:FUNC BOOL contact_func()VAR BOOL value;
value:=TRUE;MoveJ [[x,x,x],[x,x,x,x],[x,x,x,x],[x,x,x,x,x]],v1000,fine,tWeldGun\WObj:=obSide1;!Set doFr1FeedRetract;!WaitTime 1;!Reset doFr1FeedRetract;ResetSearch;FRO_SearchL [[x,x,x],[x,x,x,x],[x,x,x,x],[x,x,x,x,x,x]],[[x,x,x],[x,x,x,x],[x,x,x,x],[x,x,x,x,x,x]],45,25,v300,v20,10,tWeldGun\WObj:=obSide1;MoveL [[-289.41,580.85,802.01],[0.360314,0.551548,0.710097,0.248456],[-1,-2,1,0],[9E+09,51.8991,-86.2131,9E+09,9E+09,9E+09]],v300,z50,tWeldGun\WObj:=obSide1;!FRO_SearchL [[x,x,x],[x,x,x,x],[x,x,x,x],[x,x,x,x,x,x]], [[x,x,x],[x,x,x,x],[x,x,x,x],[x,x,x,x,x,x]], 30, 25, v300, v20, 10, tWeldGun\WObj:=obSide1;!pdisp17 := C_PROGDISP;ResetSearch;MoveJ [[x,x,x],[x,x,x,x],[x,x,x,x],[x,x,x,x,x,x]],v1000,z100,tWeldGun\WObj:=obSide1;!Stop;RETURN value;ERRORIF ERRNO=ERR_WHLSEARCH THENvalue:=FALSE;TRYNEXT;ENDIFENDFUNC
I inherited the code from old coworkers and I just know that the FRO_SearchL does the search but there's no PROC in the module with that name so I actually don't know how that works, I just use the code and trying to add an error handler so we don't have to manually handle it all the time.
And thanks for that example tompanhuhu, I will try to do it like that.0 -
Marcus_D said:Sorry, for that, I tried to only post the relevant parts. Obviously, I failed.
The FUNC looks like this:
I inherited the code from old coworkers and I just know that the FRO_SearchL does the search but there's no PROC in the module with that name so I actually don't know how that works, I just use the code and trying to add an error handler so we don't have to manually handle it all the time.
And thanks for that example tompanhuhu, I will try to do it like that.
In that case you won't have much luck trying to error handle it because the ERR_WHLSEARCH will most likely only be triggered within FRO_SearchL and not be raised to your func.
Maybe you can rework it with a regular SearchL to get the extra functionality.
Good luck!Systemintegrator - Web / C# / Rapid / Robotstudio
If I helped, please press Vote Up
☑️2024 - RobotStudio® User Group0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 798 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings