Discussion

Left ArrowBack to discussions page
kakimmykakimmy Posts: 4 Apprentice
Is there any way to make a Subprogram be associated with a global variable, can you change a load to a variable? If I was to add all of my part numbers to the program then there would be 600 subprograms in my main program because each part number has to have a different program with different way points and camera locates. I will be running two different parts at a time and I am trying to figure out a way to get the robot to use a variable to pull the necessary program up or something. When I open the command file for the Subprogram it says I can load a file but there aren’t any variables there. I’m just trying to find a way from having my main program loaded with all the Subprograms when it will only need two at a time.

Comments

  • Etienne_SamsonEtienne_Samson Posts: 356 Handy
    @kakimmy there is indeed the equivalent of global variables with UR, they are called installation variables. In Polyscope you can go to the Installation tab, then into Variables and add variables that you can use in your program.
    Etienne Samson
    Technical Support Manager - Responsable soutien technique
    +01 418-380-2788 ext. 207
    esamson@robotiq.com
  • matthewd92matthewd92 Posts: 488Founding Pro, Tactile Sensor Beta Testers Handy
    @kakimmy I am trying to understand what you are asking.  Are you asking can the program load a different subprogram based on what particular part number you are running and have the program know which one to load based on a variable?  It can do that in a round about fashion but would still require you to have something in the program to tell it what subprogram to run for each variable.  The installation variables that @Etienne_Samson references can only hold integers, not strings.  You could have two installation variables, one for part A and one for part B and then use a switch statement in the program to call the correct subprogram but you will still have to have all of them in the program for it to know what to do.  At the start of the program you would need to ask the user which parts are running.  You really wouldn't have to have an installation variable for that.  

    Yes your subprograms can reference the variables from your main program or even each other.
Sign In or Register to comment.
Left ArrowBack to discussions page