Simple Joint Movement with Python

I try to move a robot in joint position mode with the Python API.

Code looks like this:

from vcScript import *
from vcHelpers.Robot import *

def OnRun():
robot = getRobot()


However, I can’t find the class:

Error: vcHelpers.Robot was unable to find controller in component "
NeueKomponente ".
Traceback (most recent call last):
File “NeueKomponente::PythonScript”, line 6, in OnRun
AttributeError: ‘NoneType’ object has no attribute ‘driveJoints’



Any idea? In worked well in the old 2014 version.



vcRobotcontroller.vcmx (70.5 KB)

I have a solution. If someone finds this thread later, use the vcHelpers.robots2 lib instead the first version. Further, there is a difference, if the script is started inside the robot component (getRobot() with empty braces) and outsite like below.





from vcScript import *
from vcHelpers.Robot2 import *

def OnRun():

robot = getRobot(app.findComponent(“GenericRobot”))
robot.Controller.moveJoint(5, 100)
#move all 6 joints with method
robot.driveJoints(0, 0, 90, 0, 45, 10)

1 Like