Articles Download Safety & Security Forum myUR Go to Main Site

Universal Robots A/S
Energivej 51
DK-5260 Odense S

T: +45 8993 8989
sales@universal-robots.com

 
  • Articles
  • Download
  • Safety & Security
  • Forum
  • myUR
  • Go to Main Site
  • Support
  • Articles
  • Interpolate a square or lattice using scripts

Interpolate a square or lattice using scripts

Explains how to use script codes to interpolate a square or lattice for robot movements

Last modified on Jan 29, 2025

Examples are valid for:
CB2 Software version: 1.8.16941

CB3 Software version: 3.1.17779
e-Series Software version: All versions
Note that older or newer software versions may behave differently.

In order to move the robot to position along the sides of a square or in a lattice, four corner points must be given. These will be called A, B, C and D.
This example uses the function “interpolate_pose()”, please refer to the functionality of this in the script manual or in this How to: Interpolate a pose using script

A square is defined by four corners, A, B, C and D. Between these waypoints, there are “i” positions between A and B, and “j” positions between A and D. 

Square 01

In order to define the sides or lattice positions of the square, the function interpolate_pose is used. The function returns an intermediate position between the two waypoints given.

First we find the position in the “I”-direction, which is the position between A and B, D and C respectively.

ab = interpolate_pose(A, B, i)
dc = interpolate_pose(D, C, i)

This gives two positions, ab and dc. If “i” is 0.25, the point would be 1/4 of the way between A and B, which can be illustrated as below. 

Square 02

The lattice point will then be on the dotted line between ab and dc. This is found using this command:

lattice_point = interpolate_pose(ab, dc, j)

 

If j is 0.50 the position found would be: 

Square 03

Thus the lattice point 0.25/1 of the way between A and B and 0.50/1 of the way between A and D is found.

The script codes may be created as a script file, that can be used to get to the different lattice positions. This is also the concept used in the Palletizing wizard.

The script file could look like:

def Lattice(A, B, C, D, i, j):
   ab = interpolate_pose(A, B, i)
   dc = interpolate_pose(D, C, i)
   lattice_point = interpolate_pose(ab, dc, j)
   return lattice_point
end

 

This script file may be used in programs and called as an assignment.

Ursim

Note: Download example is available below for better understanding, open .urp on your offline simulator.

Attached files


Lattice.urp
LatticeCalculator.script

Attached files

Lattice.urp
LatticeCalculator.script

Related articles

Interpolate a position using script
logo

Product

  • UR3e Robot
  • UR5e Robot
  • UR10e Robot
  • UR16e Robot
  • UR20 Robot
  • UR+ Products

Company

  • About us
  • Contact us
  • Careers We're hiring
  • UR merchandise

Training / Resources

  • Academy
  • Technical Resources
  • Articles
  • FAQ

Insights

  • Blog
  • Case stories
  • Content library
  • News centre
  • Podcast
  • Webinars & Events

Get in touch

  • Ask an Expert
  • Schedule a no-cost assessment
  • Find a distributor
  • Customer support

Connect with us

  • LinkedIn
  • Facebook
  • Twitter
  • YouTube
  • Instagram
  • Universal Robots A/S
  • Energivej 51
  • DK-5260 Odense S
  • T: +45 89 93 89 89
  • sales@universal-robots.com
  • US Corporate Office
  • 27-43 Wormwood St.
  • 02210 Boston, MA.
  • +1-844-GO-COBOT
  • ur.na@universal-robots.com
  • Copyright @ Universal Robots 2025
  • Cookie policy
  • Privacy policy
  • Universal Robots A/S
  • Energivej 51
  • DK-5260 Odense S
  • T: +45 89 93 89 89
  • sales@universal-robots.com
  • US Corporate Office
  • 27-43 Wormwood St.
  • 02210 Boston, MA.
  • +1-844-GO-COBOT
  • ur.na@universal-robots.com

Copyright © Universal Robots 2025

Cookie policy
Privacy policy