Hello,
This is the first time using RAPID and I am missing something. I want to define a home position and set an output when I am in that position and the output should turn off when I am not in that position. I copied the example out of the help and modified it slightly. Here is my code.
MODULE user (SYSMODULE) ! Predefined user data !********************* ! Declaration of numeric registers reg1…reg5
VAR num reg1 := 0;
VAR num reg2 := 0;
VAR num reg3 := 0;
VAR num reg4 := 0;
VAR num reg5 := 0;
! Declaration of stopwatch clock1 VAR clock clock1;
! Template for declaration of workobject wobj1
!TASK PERS wobjdata wobj1 := [FALSE, TRUE, “”, [[0, 0, 0],[1, 0, 0, 0]],[[0, 0, 0],[1, 0, 0, 0]]];
VAR wzstationary home;
PROC Home_Output()
VAR shapedata joint_space;
CONST jointtarget home_pos := [ [ 0, 0, 0, 0, 0, -45], [ 0, 9E9, 9E9, 9E9, 9E9, 9E9] ]; CONST jointtarget delta_pos := [ [ 2, 2, 2, 2, 2, 2], [ 5, 9E9, 9E9, 9E9, 9E9, 9E9] ]; WZHomeJointDef Inside, joint_space, home_pos, delta_pos;
WZDOSetStat, homeInside, joint_space, At_Home, 1;
ENDPROC
ENDMODULE
Is “CONST jointtarget home _pos” my position that will turn on the output? What is the second set of coordinates?
Can this be a “P”?
“CONST jointtarget delta_pos” is the position tolerance?
I always want this to be active and to initalize on power up.
I found another thread that related to this but I need a couple pieces of information to put it all together.
Thanks.