RobotStudio event

How to use FitCircle?

Hello. I'm trying to make a circle with the FitCircle instruction in RAPID, but I can't do it. I have taken the example that appears in the help, but it does not give any errors, but the robot does not move.

MODULE Module1
    VAR pos points{3}:=[[500,-100,600],[577,130,600],[552,226,600]];
    VAR num radius;
    VAR pos center;
    VAR pos normal;
 
    !***********************************************************
    PROC main()
        center:=[700,-200,600];
        radius:=6;
        normal:=[0,0,1];
        FitCircle points,center,radius,normal;

    ENDPROC

ENDMODULE

Answers

  • Fit circle does not result in robot motion, but just does calculations. If you are trying to get the robot to move, use a MoveC like below. For future reference, you are assigning values manually to center, radius, and normal, however, fit circle overwrites the values you have in there. Fit circle does the calculations to give you the center, radius, and normal based on the points you have given it.

        VAR pos points{3}:=[[500,-100,600],[577,130,600],[552,226,600]];
        VAR num radius;
        VAR pos center;
        VAR pos normal;
     
        !***********************************************************
        PROC main()
            VAR robtarget StartPoint;
            VAR robtarget MidPoint;
            VAR robtarget endpoint;
            StartPoint:=CRobT();
            MidPoint:=StartPoint;
            endpoint:=StartPoint;
            StartPoint.trans:=points{1};
            MidPoint.trans:=points{2};
            EndPoint.trans:=points{3};
    !        center:=[700,-200,600];
    !        radius:=6;
    !        normal:=[0,0,1];
    !        FitCircle points,center,radius,normal;
            MoveL StartPoint,v10,fine,tool0;
            MoveC MidPoint,endpoint,v10,fine,tool0;
            

        ENDPROC


    Let me know if that answers your questions and good luck programming
  • Thank you. I go to try it.