Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Cannot add call program.MoveL() with target item

#1
To reproduce, load a new Station, import any Kuka robot. Then create a new python program.

In the body of the program I am using this example:

https://robodk.com/doc/en/PythonAPI/robo...AddProgram

After fixing the missing 'program_name' and 'robot' variables, I then run the program. I immediately get this error:

Python script failed returning 1
Traceback (most recent call last):
File "/var/folders/z7/12j9__qs7v93kxmjhrs0x2dsww4_55/T/Prog21.py", line 39, in
prog.MoveL(ti)
File "/Users/michael.staub/RoboDK/RoboDK.app/Contents/Python/robolink.py", line 3978, in MoveL
raise Exception("Adding a movement instruction to a program given joints or a pose is not supported. Use a target item instead, for example, add a target as with RDK.AddTarget(...) and set the pose or joints.")
Exception: Adding a movement instruction to a program given joints or a pose is not supported. Use a target item instead, for example, add a target as with RDK.AddTarget(...) and set the pose or joints.


It looks like the MoveL method is checking that the target is type 'Item', which it should be. This appears to be a bug in the python API. Can you link me to an example of a working python script that can successfully generate a program that moves the robot?

Here is my full python program:

from robolink import *    # RoboDK API
from robodk import *      # Robot toolbox
RDK = Robolink()

RDK.Render(False)
prog = RDK.AddProgram('AutoProgram')


robot= RDK.Item('', ITEM_TYPE_ROBOT)

POINTS = [ [ 1, 2, 3], [4, 5, 6] ]

# Retrieve the current robot position:
pose_ref = robot.Pose()

# Iterate through a number of points
for i in range(len(POINTS)):
    # add a new target
    ti = RDK.AddTarget('Auto Target %i' % (i+1))
    
    # use the reference pose and update the XYZ position
    pose_ref.setPos(POINTS[i])
    ti.setPose(pose_ref)
    
    # force to use the target as a Cartesian target (default)
    ti.setAsCartesianTarget()

    # Add the target as a Linear/Joint move in the new program
    prog.MoveL(ti)
#2
You should use 
Code:
prog.addMoveL(ti)
I guess it's legacy code in the examples.
#3
Thanks, that worked. But from the docs, it looks like addMoveL is deprecated: https://robodk.com/doc/en/PythonAPI/robo...m.addMoveL
#4
You should not have these issues with the latest version of RoboDK. I recommend you to update RoboDK to the latest version.

It could also be conflicting with a manually installed version of the RoboDK API for Python. If so, you can manually update it in console mode using:

pip install robodk --upgrade
#5
I am on the latest version ( 3.5.5 )
#6
Hi robotguy, 

Note that we constantly update the software (when I say constantly, I mean a few times a week). 
Considering that we don't want to bother people with minor update all the time, we don't change the version number every time.
If you go in "Help -> Check for updates...", you will see the date of the last minor update. (See the picture below.)

   

We know that this situation is not perfect, be we think that it's better than having to tell a costumer having an issue to wait for a month for the next version. In other words, it's the method we found to be as reactive as possible, but without constantly asking everyone to update RDK. 

Have a good day. 
Jeremy
  




Users browsing this thread:
1 Guest(s)