UR10e robot configuration

Hi,

I am using a model of the Universal Robots UR10e in my simulation, and I have problems with the robot’s configuration.

In the Programming tab, I can choose a robot configuration, out of eight different options. In my case, the configuration labeled ‘BACK BELOW NOFLIP’ is the one I need, as it reflects the actual state of the robot on my real workcell.

However, I control my simulated robot using the Python API, which I want to use to set the robot’s waypoint and corresponding configuration, using the following commands:

from vcScript import *
from vcHelpers.Robot2 import *

comp = getComponent()
app = getApplication()

def OnRun():
  robot = getRobot()
  controller = robot.Controller
  target = controller.createTarget()
  target.Target = mtx
  target.RobotConfig = 6
  controller.moveTo(target)

(Here, the variable mtx is a vcMatrix object that I parametrized earlier in the code.) I assign the value 6 as desired configuration to reach the target, the value that should correspond to the configuration labeled ‘BACK BELOW NOFLIP’. The robot moves to the expected Cartesian target, however it takes on the configuration ‘FRONT ABOVE NOFLIP’, the configuration identified by the value 0.

What I can see is the following:

  • During execution, and also always when saving my script, I get an error notification in the terminal:
    File “UR10e::PythonKinematics”, line 79, in OnGetCurrentConfiguration
    NameError: Attribute or method ‘Configuration’ not found.
  • If I add a line to print the configuration in my code, The returned value is 0, indicating the value was not set to 6, and explaining why the robot reached the target in the wrong configuration:
target.RobotConfig = 6
print(target.RobotConfig)

→ 0

  • If I add a line to print the number of available configurations, it returns 1, indicating that the configuration ‘FRONT ABOVE FLIPPED’ is the only one available, which explains why the value 6 couldn’t be set.
print(target.ConfigCount)

→ 1

What can be the reason for this? Note that before the weekend, my code was working. I could successfully change the robot configuration through my Python script, and all eight options were available.

Toon Daemen
Robotics engineer at Flanders Make, Belgium

Hi,

I can’t say exactly what is the cause for the error here. But here’s a working example for moving UR to target using robot config 6. Script is in the Pedestal Template component. That’s a good eCat component to start scripting robots and it can be found on eCat under “Component Templates” type.

UR python example.vcmx (1.4 MB)

Looking at your snippet I assume it’s not the whole script. But just to make sure put everything in OnRun except maybe for comp and app lines. getRobot() call needs to be either in OnStart or OnRun. If it’s done at script root you will get error when loading the model. That’s because the executor and its program are not ready when script is compiled and vcHelpers.Robot2 object relies on those being ready when this object is created.

-k

Follow keke on this. However, here is quick video of example and layout. Pay attention to how you define the target.


Test - UR10e with Back config.vcmx (1.3 MB)

1 Like

One thing that might be missing is setting MotionType to the motion target. It needs to be VC_MOTIONTARGET_MT_JOINT (~PTP). Joint motion can change the configuration and linear motion always keeps current target. I think default value should be joint motion but setting it explicitly is good just to be 100% sure about it. I edited my previous reply’s attachment to set MotionType too, I forgot it on the original one.

-k