RobotStudio event

Motion Supervision value

Martin_Greve
edited December 2020 in RAPID Programming
Hello

As the title says, is there a way to read the current value of MotionSup into a variable?

Throughout my rapid program I use different MotionSup values, depending on where the robot is.

Then in my error handler i set the MotionSup value higher, in order to get the robot free, if it has collided. 

Thanks in advance

Martin Greve

Here is my error handler: 

ERROR
        TEST ERRNO
        CASE ERR_COLL_STOP:
            IF ERRNO=ERR_COLL_STOP THEN
                ClearPath;
                StorePath;

                !!!Here I would like to record the current MotionSup value, and write it to a variable!!!

                rtErr01:=CRobT(\Tool:=tGripper_R1\WObj:=wPlaceStation_Pos_008);
                rtErr01.trans.Z:=rtErr01.trans.z+nPlasticBoxHight01;
                MoveL rtErr01,vReject,fine,tGripper_R1\WObj:=wPlaceStation_Pos_008;
                uError:=[2,1,0];
                ErrWriteFlexPendant;
                TEST Answer
                CASE 1:
                    MotionSup\On\TuneValue:=nMotionSup_Max;
                    WaitTime 0.2;
                    RestoPath;
                    StartMove;
                    rtErr01:=CRobT(\Tool:=tGripper_R1\WObj:=wPlaceStation_Pos_008);
                    rtErr01.trans.z:=rtErr01.trans.z+10;
                    MoveL rtErr01,vReject,fine,tGripper_R1\WObj:=wPlaceStation_Pos_008;

                    !!!Here I would like set the MotionSup value to whatever i wrote in the variable earlier!!!

                    Retry;
                DEFAULT:
                    ExitCycle;
                ENDTEST
            else
                Stop;
            ENDIF
        CASE ERR_WAIT_MAXTIME:
            IF ERRNO=ERR_WAIT_MAXTIME THEN
                ErrWriteFlexPendant;
                TEST Answer
                CASE 1:
                    RETRY;
                CASE 5:
                    TRYNEXT;
                DEFAULT:
                    ExitCycle;
                ENDTEST
            else
                Stop;
            ENDIF
        DEFAULT:
        ENDTEST

    ENDPROC


   

Martin Greve
Denmark

Best Answer

Answers

  • Martin_Greve
    edited December 2020
    Try nMyCurrentSupVal:=C_MOTSET.tunevalue;
    That seem to have done the trick. 

    Thanks
    Martin Greve
    Denmark