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

Convert python script into robodk program

#1
Hello,

I'am currently working on a PYTHON program for ROBODK to automatically to generate trajectories from points.

I have succeeded to create the python program but i would like to know if it's able to adjust certain trajectories between the waypoints by integrating intermediate points manually. For that, it would be necessary that the python program can be converted into a classic RoboDK program (MoveL, MoveJ,…). So i can adjust part of the program directly in ROBODK without editing the PYTHON script

i didn't find a way to do that . Only exporting directly to postpro Robot seems possible. Could you indicate if this is feasible and in what way?

Thanking you
#2
Hi Welid,

You can use "addTarget" to create a target in your simulation environment using Python.
https://robodk.com/doc/en/PythonAPI/robo....AddTarget

Jeremy
Find useful information about RoboDK and its features by visiting our Online Documentation and by watching tutorials on our Youtube Channel


#3
Thank you Jermey for your reply ,
I have already created target with python that I can see on ROBODK display but i can't see the other instructions like the type of the move (MoveL, MoveJ) to reach the target , i want to convert all my python script into a visual robodk instructions .
Sincerly ,
#4
Hi,

I think this example of code from our documentation could help you:

Code:
# Turn off rendering (faster)
RDK.Render(False)
prog = RDK.AddProgram('AutoProgram')

# Hide program instructions (optional, but faster)
prog.ShowInstructions(False)

# 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)
   
# Hide the target items from the tree: it each movement still keeps its own target.
# Right click the movement instruction and select "Select Target" to see the target in the tree
program.ShowTargets(False)

# Turn rendering ON before starting the simulation (automatic if we are done)
RDK.Render(True)



Jeremy
Find useful information about RoboDK and its features by visiting our Online Documentation and by watching tutorials on our Youtube Channel


  




Users browsing this thread:
1 Guest(s)