Simple Joint Movement with Python

Forum Forums Visual Components 4.0 Robot Programming Simple Joint Movement with Python

Visual Components Essentials has been officially released, download link

Be sure to read the Forum Rules and Guidelines before start using the Forum.

This topic contains 1 reply, has 1 voice, and was last updated by  MichaelW 7 months, 2 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2194

    MichaelW
    Participant

    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()
    robot.driveJoints(0,0,0,0,0,0)
    robot.Controller.moveJoint(2,90)

     

    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.

     

     

    Attachments:
    You must be logged in to view attached files.
    #2212

    MichaelW
    Participant

    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.

     

    Best,

    Michael

     

    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)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.