Cannot add call program.MoveL() with target item- Printable Version +- RoboDK Forum (//www.sinclairbody.com/forum) +-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN) + - - -论坛:RoboDK错误(//www.sinclairbody.com/forum/Forum-RoboDK-bugs) +--- Thread: Cannot add call program.MoveL() with target item (/Thread-Cannot-add-call-program-MoveL-with-target-item) |
Cannot add call program.MoveL() with target item-robotguy-02-05-2019 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: //www.sinclairbody.com/doc/en/PythonAPI/robolink.html?highlight=program#robolink.Robolink.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) RE: Cannot add call program.MoveL() with target item-hoolymama-02-06-2019 You should use
Code:
prog.addMoveL(ti)
RE: Cannot add call program.MoveL() with target item-robotguy-02-06-2019 Thanks, that worked. But from the docs, it looks like addMoveL is deprecated://www.sinclairbody.com/doc/en/PythonAPI/robolink.html?highlight=addmovel#robolink.Item.addMoveL RE: Cannot add call program.MoveL() with target item-Albert-02-06-2019 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 theRoboDK API for Python. If so, you can manually update it in console mode using: pip install robodk --upgrade RE: Cannot add call program.MoveL() with target item-robotguy-02-06-2019 I am on the latest version ( 3.5.5 ) RE: Cannot add call program.MoveL() with target item-Jeremy-02-06-2019 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 |