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

Rotate tool path while keeping tool orientation

#1
Hello,

I am trying to reuse some of my python code and have trouble doing so. The dark grey areas on the picture show part of the tool path I want to follow. My intention was to program one of the four groups, turn my reference frame at the center by 90° and do the same movements. Unfortunately, in this case the tool orientation changes as well. Is there a way to reuse the movement pattern while keeping the tool orientation the same?

Thank you for your help!

My attempt:
    robot.setPoseFrame(MiddleOfSubstrate)
    robot.MoveL(StartDeposition)
    robot.MoveL(StartDeposition*transl(0,100,0))

    robot.setPoseFrame(MiddleOfSubstrate.Pose()*rotz(90*pi/180))
    robot.MoveL(StartDeposition)
    robot.MoveL(StartDeposition*transl(0,100,0))

    ...


Attached Files Thumbnail(s)
   
#2
Hi Marwin,

There might be cleaner ways, but this works:

Code:
robot = RDK.Item('YourRobot', robolink.ITEM_TYPE_ROBOT)
target_1 = RDK.Item('YourTarget', robolink.ITEM_TYPE_TARGET)
robot.MoveL(target) # move to target

Rz = robomath.rotz(robomath.pi/2) # Rotation matrix about the Z-axis, 90 deg.
target_2 =  RDK.AddTarget('YourTarget_2') # Add a new target
# Set the pose of target_2 such that its position equals that of target_1 rotated by Rz
# w.r.t. its frame of reference origin, while maintaining the same orientation of target_1:
target_2.setPose( robomath.transl( (Rz*target_1.Pose()).Pos() ) * target_1.Pose().rotationPose() )
robot.MoveL(target_2) # Move to target_2.
You could extend this for multiple targets, and multiple rotations.

Best regards,

Maarten
#3
Like this:

Code:
from robodk import robolink    # RoboDK API
from robodk import robomath    # Robot toolbox

RDK = robolink.Robolink()

robot = RDK.Item('R1', robolink.ITEM_TYPE_ROBOT) # Get robot
T1 = RDK.Item('T1', robolink.ITEM_TYPE_TARGET) # Get target
T2 = RDK.Item('T2', robolink.ITEM_TYPE_TARGET) # Get target
T3 = RDK.Item('T3', robolink.ITEM_TYPE_TARGET) # Get target
T4 = RDK.Item('T4', robolink.ITEM_TYPE_TARGET) # Get target
T5 = RDK.Item('T5', robolink.ITEM_TYPE_TARGET) # Get target

Path1 = [T1.Pose(),T2.Pose(),T3.Pose(),T4.Pose(),T5.Pose()] # Original sequence of poses to form a path


def myMoveLPath(Path): # Move robot linearly along poses in Path:
   for Pose in Path: # For each pose in Path:
       robot.MoveL(Pose) # Move linearly to pose

def myRotSameOrient(PoseIn,R): # Rotate pose 'PoseIn' by rotation matrix 'R', while maintaining its orientation:
   PoseOut = robomath.transl(R*PoseIn.Pos()) * PoseIn.rotationPose()
   return PoseOut


Rz = robomath.rotz(robomath.pi/2) # Rotation matrix about the Z-axis, 90 deg.

Path2 = [] # New path
for Pose in Path1: # For each pose in Path:
   Path2.append(myRotSameOrient(Pose,Rz)) # Add a pose rotated but with same orientation

Path3 = [] # New path
for Pose in Path2: # For each pose in Path:
   Path3.append(myRotSameOrient(Pose,Rz)) # Add a pose rotated but with same orientation

Path4 = [] # New path
for Pose in Path3: # For each pose in Path:
   Path4.append(myRotSameOrient(Pose,Rz)) # Add a pose rotated but with same orientation


robot.MoveJ(Path1[0]) # Joint move to start of first path
myMoveLPath(Path1) # Move linearly along path
robot.MoveJ(Path2[0]) # Joint move to start of next path
myMoveLPath(Path2) # Move linearly along path
robot.MoveJ(Path3[0]) # Joint move to start of next path
myMoveLPath(Path3) # Move linearly along path
robot.MoveJ(Path4[0]) # Joint move to start of next path
myMoveLPath(Path4) # Move linearly along path
robot.MoveJ(Path1[0]) # Joint move back to start of first path

Maarten
#4
Great, thank you very much! :-)
  




Users browsing this thread:
1 Guest(s)