Hi all,
I’ve noticed a strange behaviour in my RAPID program: I have 2 parallel normal tasks (at the same level, no backgroung task) that share a robtarget variable. The variable is defined in this way:
TASK 1
PERS robtarget setPick := [[535.384,110.907,-22.9616],[0,0.7196,0.694388,0],[0,-1,0,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
…
PROC main()
…
ENDPROC
TASK2
PERS robtarget SetPick;
PROC main()
…
ENDPROC
I’ve read that to share a variable in both tasks you have to initialize it in the main one and to just declare it in the others (like I did); but actually in Task 2 I see it at 0. I’ve solved the problem defining another variable (pickpos) without initializing it in both tasks and passing the value of setPick to the new variable:
TASK 1
PERS robtarget pickpos;
PERS robtarget setPick := [[535.384,110.907,-22.9616],[0,0.7196,0.694388,0],[0,-1,0,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
PROC main()
…
pickpos := setPick;
…
ENDPROC
TASK 2
PERS robtarget pickpos;
PROC main()
…
ENDPROC
So my question is: why is it working like this? Shouldn’t it work with the first solution?
Thank you!
