I've been trying to emulate the behavior of a real-world KUKA KR16 in RoboDK, and run into something very strange (at least, to me).
This robot moves to several hand-taught positions, and then runs a mathematically-generated several-hundred-point motion pattern. The motion is a sort of "corkscrew" motion along the Tool X axis and rotating around the Tool X axis. The corkscrew pattern is a series of offsets from the hand-taught Start Position.
In my RoboDK cell, I've been able to establish the Base, Tool, and hand-teach the starting points. I've also hand-taught a few of the mathematically-generated points, just as a sanity check.
To carry out the corkscrew pattern, I have a Python script that, when called from the RDK program, takes the robot pose (using robot.Pose()) and uses transl and rotx in a simple FOR loop.
The strange behavior I'm seeing is that, when I execute target_i = target_ref * transl(LinOffset,0,0) * rotx(-RotOffset) with a LinOffset value of 0, the TCP rotates in the correct direction. But, if LinOffset has any non-zero value, the TCP rotates in the opposite direction, even though RotOffset is the same value for every test. I've tested this extensively, and the behavior is consistent.
Is there any full documentation of the transl and rotx functions that explain their behavior in-depth?
DegPerMM = 67/113.559
MMPerDeg = 113.559/67
LinOffset = 0
PrevLinOffset = 0
RotOffset = 0
PrevRotOffset = 0
LinMax = 457.2
LinMin = 0
RotMax = 67
RotMin = 0
LinDirection = 1
RotDirection = 1
for Step in range(1,208):
bLoop = True
while bLoop:
LinOffset = LinOffset + LinDirection
if ((LinOffset>=LinMax) or (LinOffset<=LinMin)):
LinDirection = -LinDirection
bLoop = False
RotOffset = RotOffset + (RotDirection*DegPerMM)
if ((RotOffset>=RotMax) or (RotOffset<=RotMin)):
RotDirection = -RotDirection
bLoop = False
target_i = target_ref * transl(LinOffset,0,0) * rotx(-RotOffset)
robot.MoveL(target_i)
PrevRotOffset = RotOffset
PrevLinOffset = LinOffset
robot.MoveL(target_ref)
Display More