Passing parameters to routine
mandolas
✭
hi...
I'm having a hard time understanding something... If anyone can clarify I would be very grateful.
I'm developing an application where I have a routine for heating the robot's axes (PROC RobotHeating(INOUT robtarget pathsR{*}, bool isSetHeatingPositionsP).
In the application I have the following code (which gives an error) ...
PERS robtarget p1:=[[1244.93,-1188.63,726.76],[0.687838,0.00599827,0.725834,0.00287952],[-1,-1,0,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; PERS robtarget p2:=[[31.68,-1328.93,2622.03],[0.745578,0.250734,0.210509,-0.580458],[-1,-2,1,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; PERS robtarget p3:=[[-749.23,-100.65,659.10],[0.234719,0.917676,0.157006,-0.279511],[-2,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; PERS robtarget p4:=[[-53.82,593.00,1064.94],[0.492398,-0.492584,0.507578,0.507218],[1,2,-3,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; PERS robtarget p5:=[[1060.64,561.04,438.51],[0.0737323,0.425606,-0.792688,0.430197],[0,1,-2,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; PROC main() RobotHeating [p1,p2,p3,p4,p5],TRUE; ENDPROC PROC RobotHeating(INOUT robtarget pathsR{*},bool isSetHeatingPositionsP) ... CODE ENDPROC4600-802640/RAPID/T_ROB1/ModuleMain(884,22): Argument error(5): The argument for INOUT parameter pathsR is not a variable or persistent reference, or it is read-only. 03/07/2023 16:54:34 General
PERS robtarget p1:=[[1244.93,-1188.63,726.76],[0.687838,0.00599827,0.725834,0.00287952],[-1,-1,0,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; PERS robtarget p2:=[[31.68,-1328.93,2622.03],[0.745578,0.250734,0.210509,-0.580458],[-1,-2,1,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; PERS robtarget p3:=[[-749.23,-100.65,659.10],[0.234719,0.917676,0.157006,-0.279511],[-2,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; PERS robtarget p4:=[[-53.82,593.00,1064.94],[0.492398,-0.492584,0.507578,0.507218],[1,2,-3,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; PERS robtarget p5:=[[1060.64,561.04,438.51],[0.0737323,0.425606,-0.792688,0.430197],[0,1,-2,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; PERS robtarget pathsG{5}; PROC main() pathsG:=[p1,p2,p3,p4,p5]; RobotHeating pathsG,TRUE;<br>ENDPROC PROC RobotHeating(INOUT robtarget pathsR{*},bool isSetHeatingPositionsP) ... CODE ENDPROCChecked: 4600-802640/RAPID/T_ROB1: No errors. 03/07/2023 17:04:20 General
Does anyone know why?
thanks.
Tagged:
0
Comments
-
Why have you made the parameter INOUT in the first place?Lee Justice0
-
Why have you made the parameter INOUT in the first place?Good morning lemster68 ...I usually use it first, but I don't have it as a rule. I like parameters that indicate references first whenever possible."It gets more organized", my opinion, but why, is there any restriction?
Thanks.0 -
The INOUT parameter is for use when you need to modify a data object in some way and have that modifed value written to the data permanently. So, often times it is not really needed.Lee Justice0
-
OK.In this case this is the idea, I need to permanently modify values of p1, p2,... that are seen in other routines.That's why my question, because it can't be done directly using the PERS attribute chain, I have to create a PERS vector, pass the attributes to it and then I can modify, as in the example and in addition to duplicate data in the program, p1,p2 ... are not the same points I have in pathsG{1}, pathsG{2} ...I don't want to keep using pathsG{1} in the movement instructions, but p1, p2 ...thanks.0
-
mandolas said:OK.In this case this is the idea, I need to permanently modify values of p1, p2,... that are seen in other routines.That's why my question, because it can't be done directly using the PERS attribute chain, I have to create a PERS vector, pass the attributes to it and then I can modify, as in the example and in addition to duplicate data in the program, p1,p2 ... are not the same points I have in pathsG{1}, pathsG{2} ...I don't want to keep using pathsG{1} in the movement instructions, but p1, p2 ...thanks.
p1:=pathsG{1}.
0 -
Have you tried writing it as a function? Also, one thing that comes to mind is to put the robtargets of interest into an array declaration.Lee Justice0
-
lemster68 said:Have you tried writing it as a function? Also, one thing that comes to mind is to put the robtargets of interest into an array declaration.I didn't understand how the function would help.In the case of putting the robtargets of interest in an array declaration, I have the problem of having to call "pathsG{1}" in my movements.I will try to put my situation in another way, maybe it will help to understand my problem ...I have a routine where the user executes a series of movements and each movement can set this position via ModPos. At this time another part of the program uses this position to perform another task.When declared p1, it will always be p1, in the case of the position of the vector it will be depending on what the programmer wanted to understand, so pathsG{1} can be p3 and I won't know.In programming languages (java, c++,...) there are parameter passes by value and/or reference. INOUT should work as a reference, so p1,p2,... should be able to be passed and changed, but apparently that doesn't work.Am I correct?0
-
No, it should work. It is just something in the way you are trying to make it work. When working with arrays, often times a FOR NEXT loop is a compact way of cycling through the data.Lee Justice0
-
PERS robtarget p1:=[[1244.93,-1188.63,726.76],[0.687838,0.00599827,0.725834,0.00287952],[-1,-1,0,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; PERS robtarget pathsG{1}; ! I am not doing anything out of the ordinary. PROC main() ! Ok ... pathsG{1}:=p1;
RobotHeating pathsG,TRUE; !NOk ... What's the difference? RobotHeating [p1],TRUE; ENDPROC PROC RobotHeating (INOUT robtarget pathsR{*},bool isSetHeatingPositionsP) MoveL paths{1},v600,fine,tool0\WObj:=wobj0; Stop; ENDPROC0 -
mandolas said:
PROC RobotHeating (INOUT robtarget pathsR{*},bool isSetHeatingPositionsP) MoveL paths{1},v600,fine,tool0\WObj:=wobj0; Stop; ENDPROC
Lee Justice2 -
OK...So it's not what I expected...Thank you for your collaboration.0
-
You are welcome.Lee Justice0
Categories
- All Categories
- 5.5K RobotStudio
- 394 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 309 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings