Overarching Movement Variables

  • KRC4

    WorkVisual 6.0.24

    KSS 8.6.7


    I am working on a program that will control a string of movements that will allow the program to call a point and have the robot safely move there from another point, working its way through intermediate points.
    Example: Robot is at P1 but needs to move to P5. To get there it needs to move through P2 and P4 but can skip over P3 safely (assume they are in order). The way I have it setup currently is that the program calls the function name and inputs the desired position (1-10) and the robot runs a series of case statements that will move the robot around. The moves are called in a sub program just to keep the main one a little cleaner.


    My question is, can I set the movement variables (acceleration, speed, base) once per run of the sub program and have it work for any of the points. Or do I have to have the variables set directly before each movement?

    EX:


    moveCall (movePos:IN, type:IN)


    BAS(#PTP_PARAMS, 100)

    FDAT_ACT=HOMEBASE

    SWITCH movePos


    CASE 1

    IF type == 1 THEN

    PTP P1

    IF type == 0 THEN

    PTP P1 C_DIS

    ENDIF

    CASE 2

    etc....

  • AD
  • As Panic says. The only thing to watch for is that you have to set them at least once -- after a program Reset or Select, many motion control variables have no settings. That's why the default KRL templates always include the INI Fold at the top, to initialize all the motion variables to default values.


    Also, doing a subroutine call does not reset the motion variables. That is, if you set your motion variables in your Main program, those same settings will still be active for any subroutine called from Main (unless, of course, said subroutine makes changes to those variables). And any changes made in the subroutine will still be active when the program pointer returns to Main.


    The motion variables are Global, and static. Basically, unless an event to change them occurs (program setting, or a system-level event like Program Reset or Select, or a Cold Boot), they retain their last values forever.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now