Visit Zacobria Webshop

Universal-Robots painting application:


Application Description:
This program example shows a program for painting application. The robot is a Universal-Robots UR5 dressed with a robosuit model “18v 180z fire retardant pvc vinyl orange colour with zipper on upper arm”.

Function description:
A paint spray nozzle is mounted on the UR5 robot with aint and air supply hoses connected. The spray nozzled is turned On/Off by a pneumatic cylinder that is controlled by a 2 way valve connected to digital output 0.

In this example the robot draws 4 horizontial lines with a distance between the lines  – where the lenght of the horizontial line and height of the distance between the lines can be set in the robot program.

Setting of Plane:


The robot tool head is oriented with the stanard TCP notation in mind as shown on the image above.

In this case the Plane is defined by setting the Point_1 at the position of the origin of the Plane which is also the desired start position of the painting cycle. Point_2 is the Y direction of the Plane – and in this case is chosen to set the Y direction to be towards the painting object (for example a wall). Point_3 is set in the desired X direction of the Plane.

In this way the X direction becomes the horizontal line direction (left-right) and the Z direction becomes the vertical direction (up-down).

I/O table Inputs:
None used.

I/O table Outputs:
DO0 = Spray nozzle On/Off

Variable Table:

Variable Waypoints:


Program description:
The program uses a user defined plane as reference for the start point of the painting cycle. With this method it becomes easy to shift the entire painting pattern to other starting points.

The Plane is defined in the Features menu.


The Plane_1_var is copied into a P1 variable so it has a shorter name.

var_start is set to the reference value of all 0 because that is the start position of the painting.

var_x1 line is set to the width of the desired horizontal line lenght. In this case 400mm.

var_z1_line is set to the desired vertical shift down from the end of the first horizontal line. In this case 50mm down.

var_x2_line is set to the desired position of the back stroke which is 50mm down from the starting position.

var_z2_line is set to the next desired vertical shift down from the end of the first back stroke. In this case further 50mm down.

var_x3_line is set to the desired position of the third line which is 50mm further down and a lenght of 400mm.

var_z3_line is set to the desired vertical shift down from the end of the first horizontal line. In this case 50mm further down.

var_x4_line is set to the desired position of the second back stroke which is further 50mm down.

Output 0 is the activation and de-activaion of the spray nozzle and by setting digital output 0 to low (off) the spray nozzle is ensured to be off.

In the main program the Waypoint_1 is set to the desired resting position – in this case is used the same position as the Plane origin.

A Popup messages ensures the robot is waiting for an operator acknowledgement for starting the painting cycle.

Each variable waypoint is then assigned the value of the end of horizontal lines and end of vertical lines so each variable waypoint is ready to be used for moving the robot. In this case the user defined plane is used as reference to each move by using the function pose_trans() where the plane is the first argument and the desired offset of the end point of the particular move is the second argument.

For moving the robot MoveL is used in order to make linear lines during the painting.

The robot moves to start position and the spray nozzle is activated. After the activation a delay of 0.3 seconds are inserted in order to ensure that the spray nozzle is fully on and paint flow has been started.

In this case – after each horizontal line the spray nozzle is turned off during the vertical move.

After last line 4 – the last line in this example the spray nozzle is turned off and the robot returns to starting position and the await operator activation of next cycle.

Program code:


Notice that the MoveL has the Base_var as feature because the reference to the plane is set by using the pose_trans() function where the Plane variable is used.

It is possible to reduce the length of the program by using variable for the length of the horizontal and vertical distances and then do math on the variable when used in the waypoint variable by increment the value with the desired number.

And it is also possible to reduce the program further by using the loop function for drawing each line.

But for the purpose of ease of understanding this program is chosen to be shown with the assignments along the way.

Disclaimer: While the Zacobria Pte. Ltd. believes that information and guidance provided is correct, parties must rely upon their skill and judgement when making use of them. Zacobria Pte. Ltd. assumes no liability for loss or damage caused by error or omission, whether such an error or omission is the result of negligence or any other cause. Where reference is made to legislation it is not to be considered as legal advice. Any and all such liability is disclaimed.

If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.

By Zacobria Lars Skovsgaard
Accredited 2015-2018 Universal Robots support Centre and Forum.


Follow @zacobria