Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check for interference via radial sweep using python scripts.
#1
Dear All,
I using the following python codes so as to get the variable radial sweep data along with
the Denavit Hartenberg values.The main reason behind this is to check for interference
during action.The following program is not producing the variable hexagaonal path.
Could any one correct the following codes.Please refer haxagonal path in weld test
for KUKA KR6 R900.Thank you.


####################################################
from robolink import *    # API to communicate with RoboDK
from robodk import *      # robodk robotics toolbox
import time

# Any interaction with RoboDK must be done through RDK:
RDK = Robolink()

# get the robot by name:
robot = RDK.Item('', ITEM_TYPE_ROBOT)

# get the home target and the welding targets:
home = RDK.Item('Home')
target = RDK.Item('Target 1')

# get the pose of the target (4x4 matrix representing position and orientation):
poseref = target.Pose()

# move the robot to home, then to the Target 1:
robot.MoveJ(home)
robot.MoveJ(target)

# make an hexagon around the Target 1:
for i in range(7):
    ang = i*2*pi/6 #angle: 0, 60, 120, ...
    for x in range(200,210,1):
        #posei = poseref*rotz(ang)*transl(225,0,0)*rotz(-ang)
        posei = poseref*rotz(ang)*transl(x,0,0)*rotz(-ang)
        robot.MoveL(posei)
        print posei
        time.sleep(.025)

# move back to the center, then home:
robot.MoveL(target)
robot.MoveJ(home)
#####################################################

With Regards
Hems
#2
You can change your second loop so that it goes through the following points (in order):
[200,210,200]

I also changed the pause by calling:
    robot.Pause(0.025)
This is important if you want to see the pause when you generate the program when you generate the program offline or you run the program on the robot using the driver.

You can also use robot.setSpeed(speed) if you need to change the speed. More information and examples here:
https://robodk.com/doc/en/PythonAPI/robo...AddProgram
https://robodk.com/doc/en/PythonAPI/exam...g-with-gui

See the attached code and project.

   

from robolink import *    # API to communicate with RoboDK
from robodk import *      # robodk robotics toolbox

# Any interaction with RoboDK must be done through RDK:
RDK = Robolink()

# get the robot by name:
robot = RDK.Item('', ITEM_TYPE_ROBOT)

# get the home target and the welding targets:
home = RDK.Item('Home')
target = RDK.Item('Target 1')

# get the pose of the target (4x4 matrix representing position and orientation):
poseref = target.Pose()

# move the robot to home, then to the Target 1:
robot.MoveJ(home)
robot.MoveJ(target)

# make an hexagon around the Target 1:
for i in range(7):
    ang = i*2*pi/6 #angle: 0, 60, 120, ...
    for x in [200,210,200]:
        #posei = poseref*rotz(ang)*transl(225,0,0)*rotz(-ang)
        posei = poseref*rotz(ang)*transl(x,0,0)*rotz(-ang)
        robot.MoveL(posei)
        print(posei)
        robot.Pause(.025)

# move back to the center, then home:
robot.MoveL(target)
robot.MoveJ(home)


Attached Files
.rdk   KUKA-Robot-Welding-Radial-Sweep.rdk (Size: 335.37 KB / Downloads: 36)
  




Users browsing this thread:
1 Guest(s)