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