RobotStudio event

StorePath while SearchL error.

Options
Audrius
Audrius
edited May 6 in RAPID Programming
Hello,
I have TRAP function which moves robot to safe heigh, then moves to safe pont, then moves to home point, and after this function I resseting pointer to main. This funtion is called from PLC when operator sees that something might go wrong. TRAP funtion required to have StorePath which I dont need, because I'm not restoring path. Everything works well, but sometimes operator might call this function while searchL in progress, and then I'm getting error that SorePath cannnot be executed while SearchL in progress. And I dont know how to solve it.

And another problem with this TRAP functions is as follows:
When operator sees that something will go wrong, he stops the robot program execution and hits "Park robot" button. When this button is on, it sets trap input to high, turns on robot motors and starts program execution, but before trap is activated robot for a while(~1 sec) continues its last move, and in some cases there can be collision in that move

Maybe I'm using bad approch with this function? I have not much experience with this.

RAPID code:

    TRAP ParkRobot
       IF getDeviationFromHome() > maxDeaviationFromHome 
           THEN
               DoParkRobot;
           ELSE
               Reset Local_IO_0_DO3;
               Reset Local_IO_0_DO4;
               MoveL Offs(trg_product_prepickup,0,-100,0), v100, fine, tool1;
               MoveL trg_product_prepickup, v100, fine, tool1;
       ENDIF
       SetDO A_Delta_DO9, 1;
       WaitTime 1;
       SetDO A_delta_DO9, 0;
       WaitTime 1;
       Reset A_delta_DO16;  !Komanda nebevykdoma
       Stop;
   ENDTRAP 

    PROC DoParkRobot()
       CONST robtarget trg_drop_boxes:=[[1780,1320,-245],[0,-0.689808,0.723992,0],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
       CONST robtarget trg_droped_boxes:=[[1780,1320,600],[0,-0.689808,0.723992,0],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
       VAR robtarget currRobT;
       parks:= parks + 1;
       StopMove;
       StorePath;
       currRobT := CRobT();
       SetDO Local_IO_0_DO5, 0;
       SetDO Local_IO_0_DO9, 0;
       currRobT.trans.z := 1850;
       MoveL currRobT, v200, z50, tool1;
       MoveJ trg_transit, v200, z50, tool1;
       MoveL trg_drop_boxes, v200, fine, tool1;
       WaitRob \ZeroSpeed;
       ReleaseBoxes;
       PullClaws;
       WaitForClawsPulled;
       MoveL trg_droped_boxes, v200, z50, tool1;
       MoveL trg_product_prepickup, v200, fine, tool1;
       WaitRob \ZeroSpeed;
    ENDPROC

Answers

  • lemster68
    lemster68 ✭✭✭
    Options
    I hate to say it because I personally don't like the StartMain system input, but you might be well off to use that system input.  Put your Park routine at the top of the main program and don't use the trap at all.
    Lee Justice