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

External Rail programmation with the Python API

#7
Hi Marc,

When you use external axes you need to provide the position of the external axes in your target (using setJoints). If the target is Cartesian you don't need to worry about the robot axes. Alternatively, you can load a robot machining file such as Gcode or APT and use a curve follow project or robot machining project. You'll then be able to optimization tools for external axes.

I was unable to test your file as it requires additional input data but this small script will allow you to update the position of the external axes to all targets in a station (for example, 5000 mm):

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

targets = RDK.ItemList(ITEM_TYPE_TARGET)

RDK.Render(False)
for t in targets:
# Set the value of the external axis
e1 = 5000 # in mm
t.setJoints([0,0,0,0,0,0, e1])

# Recalculate the joint position based on the new position of the external axis
# Robot joints are updated but not external axis
t.setAsCartesianTarget ()
t.Joints()

jnts = t.Joints()
print(t.Name() + "-Joints: " + str(jnts.list()))

If you are looking for faster speed (I noticed you already disabled Render) I would recommend you to use the C++ API (slightly faster) or the plugin interface to create a plugin (much faster). The API's are almost the same in both cases.

Albert


Attached Files
.rdk M301_01.rdk(Size: 1.86 MB / Downloads: 548)


Messages In This Thread
RE: External Rail programmation with the Python API - byAlbert——12-02-2019 09:48点



Users browsing this thread:
2 Guest(s)