05-30-2019, 05:09 PM
Hello all,
I created a program in Python that decodes a NC file posted for a 5 axis CNC machine. The NC file has X Y Z coordinates plus I J K tool vector. I'm simulating a Comau robot, but could be any robot.
First I set Joint angles:
Then I can successfully move the robot in the X Y Z plane using the offset instruction as below:
But I'm not sure what how to get proper tool orientation from I J K
I tried to convert each I value, J value and K value with ACOS() then from rad to angle and used those values in the code below:
With the first G Code line:
I get an Exception: Target cannot be reached. Executing the code without the Tool angles runs fine.
I think I'm not doing the proper way. I appreciate if someone can point me in the right direction.
Thank you.
I created a program in Python that decodes a NC file posted for a 5 axis CNC machine. The NC file has X Y Z coordinates plus I J K tool vector. I'm simulating a Comau robot, but could be any robot.
First I set Joint angles:
Code:
robot.setJoints([0,-20,-115,0,83,0])
Then I can successfully move the robot in the X Y Z plane using the offset instruction as below:
Code:
for i in vetor:
pose_n1 = pose_i.Offset(i.x, i.y, i.z)
robot.MoveL (pose_n1)
But I'm not sure what how to get proper tool orientation from I J K
I tried to convert each I value, J value and K value with ACOS() then from rad to angle and used those values in the code below:
Code:
pose_n1 = pose_i.Offset(i.x,i.y,i.z).RelTool(i.rx, i.ry, i.rz)
With the first G Code line:
Code:
G00 X100.113 Y-5.049 Z12.822 A.383 B0. C.924 F10
I get an Exception: Target cannot be reached. Executing the code without the Tool angles runs fine.
I think I'm not doing the proper way. I appreciate if someone can point me in the right direction.
Thank you.