Home Programming

Discussion

Left ArrowBack to discussions page
JstewartJstewart Posts: 42 Apprentice
Im doing some testing with a UR5, and i am having a pop-up show at the start of the program asking the operator to input a number anywhere from 1 - 6. when the operator selects 1 or 2, that will instruct the robot to move to pick up either a green (1) or red (2) marker then im using switch cases to step through the rest of the program. After it picks up the marker, i have a variable called "TOOL_SELECT" and which ever marker is selected is the value. However whenever i stop and then restart the program, the value goes back to 0 then when i call the switch case to return whichever marker, it moves back to the home position instead of returning the marker. ( i have it returning home if the TOOL_SELECT variable had a 0) is there a way to keep the current marker selected? or is it always going to return to 0 after a stop?

Best Answer

  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,131 Handy
    Accepted Answer
    There are two ways to accomplish this.  

    If all you want to do is keep the variable state run to run, but not when power is lost, then add an Init Variables to the program and then you can choose the variable you want and tell it to keep its value from the last run.

    The permanent way to do this is to add an installation variable.  This variable will be available to any program that uses that installation file and would be persisted even after a power loss event such as powering down the robot.  Only recommend these when its a variable that you do not ever want to lose its state regardless of power and it doesn't hurt to be available in other programs.


Comments

  • mkardasinskimkardasinski Posts: 37 Handy
    Power loss and powering down have me a bit confused. Is an installation variable saved immediately after being updated? So in the event of a power outage & power to the robot is abruptly cut while running, the variable contents are current after power-up?
  • JstewartJstewart Posts: 42 Apprentice
    @matthewd92 thats exactly what i was looking for. thanks.
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,131 Handy
    I’m not sure if the value changed right before power was abruptly lost it would be current but yes, the values are persisted to disk to prevent loss whenever the robot is powered off.  Not sure how often the writes to disk occur but we’ve lost power before and still had our variables. 
  • JstewartJstewart Posts: 42 Apprentice
    @matthewd92 why are my variables not showing in the drop down of the initial variable values page?
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,131 Handy
    How are they defined?  If they are defined in script they will not show there, if they are installation variables they will not show there.
  • JstewartJstewart Posts: 42 Apprentice
    I tried defining in the installation and in the before program section. Where are you supposed to define them at?
  • JstewartJstewart Posts: 42 Apprentice
    @matthewd92 Forget my last post, i ended up figuring it out. Thanks for the help!
Sign In or Register to comment.
Left ArrowBack to discussions page