Home› Programming
Discussion
Back to discussions page
matthewd92
Founding Pro, Tactile Sensor Beta Testers Posts: 1,267 Handy
Handy Helper Functions for Universal Robots |
1.4K views
|
Answered | |
/ Most recent by matthewd92
in Programming
|
10 comments |

I thought that we might want a single thread where everyone can post up any handy little helper functions that they have developed over time that make programming and using the UR robots easier. If you have any functions that you are willing to share please post the code below along with an example of how to use the code. If you have any questions about how to use something please feel free to reach out to the author or post a question on here so that everyone can learn from each other.
Tagged:
This function takes a float between 0 and 1 as an argument, one thing to note is if you actually send 0 it pauses the program but I have not found a way to easily recover from this so I am using the if statement to verify that the speed is not 0, if so it sets it to 0.001 which basically stops motion but allows the robot program to continue to run.
Usage in a program would be
Another example is how to have a popup message that only has an OK button and is non-blocking, this allows you to have informational messages that do not stop the program execution and that the operator cannot stop program execution from either. An example of where we use this is during programs that have a long start-up time during the before start portion of the program. We will pop up a message to tell the user that the program is in the process of starting so that they don't hit the play button repeatedly.
The way that you would use this is
One last one is to programmatically close the popup, now, the caveat to this is it will close ANY open popup, it actually doesn't know what it is closing, just that popups will be closed. So you want to make sure you are only using this when there is no chance that you are closing something that should be blocking operation, user be warned.
Simply use it by calling the function in your program
where I can find the list of commands like "set speed" , "popup" ... ?
the other commands thay that I use regularly are sprinkled throughout the UR support website.
We have also used in before in conjunction with a laser scanner, instead of putting the robot in a safeguard stop when someone entered the cell, we placed the robot in reduced mode and then fired a set speed command to chop the speed slider to 1%, this effectively "stops" the robot, its still moving but extremely slowly. This was so the program could continue to run even when someone walked by so that we could monitor the machines in the cell and catch their completion status as it was only broadcast once and missing it meant we never knew the machines finished. We no longer follow this practice but rather wire machines like that up to other systems that can catch those signals such as a PLC and then the robot communicates with the PLC to get the information it is looking for.