Universal Robots Forum

How to teach a path by hand

Hi, I’m trying to teach a path to my UR10 moving it by hand in freedrive mode.
These are the steps I follow:

  1. connect at TCP server 30002.
  2. I acquire the vectors joint position (“JointActualPosition”) while manually moving the robot in freemode.
  3. stop freedrive mode.
  4. write back via tcp socket each vectors joint position with “servoj” command. One send for each vector, like this:

var command = “servoj([0.4, 0.4, 0.4, 0, 0, 0], 0, 0, 0.1, 0.1, 100)\n”;
SendCommand(command); // send over tcp 30002
Thread.Sleep(100); // ms

Result: the robot trajectory is snappy.
How to improve it? I need to use the real time communication at port 30003? “servoj” command is the right way?


Including all the servoj commands in a “def myprogram():” now the tracking of the path is much better.

Hi Daniele,

You’re right, putting them within a function is a much better approach. If you send the commands individually over the client interface, each command is executed soon as it is received, regardless of whether the previous one has completed. Putting them within a function allows them to be executed in sequence.

The Secondary interface 30002 runs at 10Hz where as the realtime interface 30003 runs at 125Hz, so switching to that will also potentially bring a performance improvement.

1 Like