Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create target from txt
#1
Hi everyone, 

I want to know the possibilities of communication between Python and RoboDK. I'm doing a simulation in RoboDK and i want to move the robotic arm ur5e to a desired target (using Python). I have a python program which generates the position (x, y, z) and export it to a txt file. I want to know if there is an option to create a target from this coordinates in python and import it to RoboDK or just import the coordinates from the txt file to a target in RoboDK.

Thanks in advance,

Regards.
#2
Hi there, 

This piece of Python code should help you create your target:

Code:
# Name of the reference frame to be use
frame = RDK.Item('Frame Name')

# Create new target at [0,0,0] (XYZ) from reference frame
Target = RDK.AddTarget('Target name ' + str(target_number), frame)

# Offset the new target position
Target.setPose(Offset(eye(), pos_X, pos_Y, pos_Z, rot_X, rot_Y, rot_Z))

Remember that you also need the orientation of the target.
Simply using [X,Y,Z] is a point, not a target.

Hope it helps. 
Jeremy
#3
(12-03-2019, 07:31 PM)Jeremy Wrote: Hi there, 

This piece of Python code should help you create your target:

Code:
# Name of the reference frame to be use
frame = RDK.Item('Frame Name')

# Create new target at [0,0,0] (XYZ) from reference frame
Target = RDK.AddTarget('Target name ' + str(target_number), frame)

# Offset the new target position
Target.setPose(Offset(eye(), pos_X, pos_Y, pos_Z, rot_X, rot_Y, rot_Z))

Remember that you also need the orientation of the target.
Simply using [X,Y,Z] is a point, not a target.

Hope it helps. 
Jeremy

Hi Jeremy,

It has worked perfectly! Thank you for your quick response.

Regards,
Kevin
  




Users browsing this thread:
1 Guest(s)