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

How to add a curve to a reference frame

#1
I have a problem importing trajectories into RDK from my Python script when I want to have the position data displayed in relation to a custom coordinate system as a reference frame. However, if I use the global coordinate system in RDK (reference_object=0) everything works fine. As soon as I change the coordinate system, I get the error:

Code:
WARNING: Invalid curve, a 3xN (or 6xN) list of points must be provided
and
Code:
Exception: Invalid item provided: The item identifier provided is not valid or it does not exist.

I think the format of the Data is correct and the reference frame with the name "Rahmen99" is already created in RDK :(

I am showing you this script as a not working example script with the hope someone can help me:
Code:
from robodk.robolink import *  # Import RoboDK API
from robodk.robomath import *  # Import für Mat, etc.
import numpy as np
RDK = Robolink()
roboter = RDK.Item('UR10e', ITEM_TYPE_ROBOT)
RUN_ON_ROBOT = True
roboter.setConnectionParams('192.168.1.50', 50002, '/programs/', 'root', 'easybot')
# Referenzrahmen finden
frame = RDK.Item('Rahmen99', ITEM_TYPE_FRAME)
if not frame.Valid():
    raise Exception("Referenzrahmen 'Rahmen99' nicht gefunden!")
# Punkte definieren: XYZ Positionen in mm (relativ zu Rahmen99)
kurven_punkte = [
    [100, 0, 200],
    [200, 100, 200],
    [300, 0, 200]
]
#kurven_punkte = robomath.Mat(punkte_matrix)
# Kurve im RoboDK erstellen (als Objekt)
kurve = RDK.AddCurve(kurven_punkte, frame, add_to_ref=False, projection_type=0)
if roboter.Valid():    
    path_settings = RDK.AddMillingProject("Bewegungstest_Pfad")
    prog, status = path_settings.setMillingParameters(part=kurve)
    prog.RunProgram()
#2
The reference object of the Add Curve call should be an object, not a coordinate system. This object is used to add the new curve to the same object.

If you want to add a curve as a new object item and attached to a coordinate system you could do something like this:
Code:
new_object = RDK.AddCurve(points)
new_object.setParent(frame)
You can find more information about how to add a curve in RoboDK here:
https://robodk.com/doc/en/PythonAPI/robo...obolink-py
  




Users browsing this thread:
1 Guest(s)