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

Can't create target in KRC4 robot with respect to the tool

#1
I am creating target using KR C4 robot (KUKA KR6 R900 sixx) with C# RoboDK Api.The problem is ,while creating target using C# api , the target's X is not creating parallel to active Tool X!! ,the target X is created parallel to Robot base X.
.docx   kuka_targets.docx (Size: 221.8 KB / Downloads: 29)
.rdk   kukaStation.rdk (Size: 909.14 KB / Downloads: 33) (Note i am working with Robodk C# API)
#2
Could you please share the code you use to create the targets?
#3
This is the code we are using
Code:
Item tool = RDK.getItem("tool1", ITEM_TYPE_TOOL);
Item robot = RDK.getItem("Robot", ITEM_TYPE_ROBOT);
Item frame = RDK.getItem("Frame 2", ITEM_TYPE_FRAME);
robot.setTool(tool);
string name = targetItem.Name();
double[] targetPose = targetItem.Pose().ToTxyzRxyz();
double x = targetPose[0];
double y = targetPose[1];
double z = targetPose[2];
double appr = apprHeight == 1 ? 200 : 50;
Mat pose = new Mat(4, 4);
string[] apprpoint = new string[6];
for (int i = 1; i <= 3; i++)
{
    Item target;
    if (i == 2)
    {
        apprpoint = RzRyRx(x, y, z, rz, ry, rx, 0, 0, 0);
        pose = Mat.FromXYZRPW(
      double.Parse(apprpoint[0]), double.Parse(apprpoint[1]), double.Parse(apprpoint[2]),
      double.Parse(apprpoint[3]), double.Parse(apprpoint[4]), double.Parse(apprpoint[5])
        );
        robot.MoveL(pose);
        target = RDK.AddTarget($"{name}", null, null);
        
        target.setPose(pose);
    }
    else
    {
        apprHeight = -1;
        apprpoint = RzRyRx(x, y, z, rz, ry, rx, 0, 0, appr);
      
        pose = Mat.FromXYZRPW(
        double.Parse(apprpoint[0]), double.Parse(apprpoint[1]), double.Parse(apprpoint[2]),
        double.Parse(apprpoint[3]), double.Parse(apprpoint[4]), double.Parse(apprpoint[5])
      );
       
        robot.MoveL(pose);
        target = RDK.AddTarget($"{name} ap {i}", null, null);
   
        target.setPose(pose);
    }
}
#4
If you have an existing target and you want to update the pose of another target adding a relative transformation to the tool, you can do something like this:
Code:
pose_ref = target_ref.Pose()
new_pose = pose_ref * pose_offset
new_target.setPose(new_pose)

You can find some examples here:
https://robodk.com/doc/en/PythonAPI/exam...rogramming

If you prefer to set the target pose relative to the current position of the robot tool you could do something like this:
Code:
pose_ref = tool.PoseAbs() * tool.PoseTool()
new_pose = pose_ref * pose_offset
new_target.setPose(new_pose)
  




Users browsing this thread:
1 Guest(s)