RobotStudio event

can I use a procedure to output a selected parameter?

Options
suffq
suffq
edited March 2023 in RobotStudio
Hi there,

I'm trying to create a procedure that from a few parameters can crunch some numbers and then modify/ update a position variable. which can be used throughout with different parameters.  

here's an example to give an idea of what I mean:

VAR pos Input:=[3,2,1]
VAR pos Output:=[0,0,0]

PROC main()
PosOutput input, output;
ENDPROC

PROC PosOutput(pos pos1, pos pos2)

pos2:= [pos1.x*2, pos2.y, pos2.z];

ENDPROC

When I run such a program the Output variable doesn't seem to update. is there a way to update the Output that's being called through the procedure?

regards,
Quin

Answers

  • lemster68
    lemster68 ✭✭✭
    edited March 2023
    Options
    I think that you will see that the value for pos2 has the value stored in it.  Just because you name a parameter "Output" does not make it behave in the way you want it to.  Make the parameter for pos2 an INOUT parameter and you should see the value changing.
    Lee Justice
  • Tompanhuhu
    Options
    Like this

    PROC PosOutput(pos pos1, INOUT pos pos2)

    pos2:= [pos1.x*2, pos2.y, pos2.z];

    ENDPROC
    Systemintegrator - Web / C# / Rapid / Robotstudio

    If I helped, please press Vote Up  :smile:
  • suffq
    Options
    Thankyou the INOUT parameter has solved my issue