1

我正在尝试创建 5 轴机器应用程序,为了定义 3D 位置加上末端执行器的方向,常用方法是从 XYZIJK 计算它,其中 XYZ 是空间位置,IJK 是方向向量。PowerMill 有这个对象,大多数 5 轴编程系统都有这个对象。在 Eyeshot 9.0 或更高版本中怎么可能。Eyeshot = DevDept

4

1 回答 1

0

Eyeshot 最适合处理变换矩阵或四元数。我仍然无法理解四元数,所以这里是转换矩阵的答案。这个函数所做的就是把你所说的点和向量变成一个完整的变换框架。

一个问题是我只有对称的工具,所以这会让你的工具到达正确的点和矢量,但会任意旋转工具向上。如果你弄清楚那部分,请告诉我。

Transformation pointNormalTransformation(Point3D point, Vector3D normal)
{
    Vector3D direction = normal;
    direction.Normalize();
    Vector3D rotAbout = Vector3D.Cross(Vector3D.AxisZ, direction);
    rotAbout.Normalize();
    double angleBetween = Vector3D.AngleBetween(Vector3D.AxisZ, direction);

    Translation trans = new Translation(point.X, point.Y, point.Z);
    Rotation rot = new Rotation(angleBetween, rotAbout, Point3D.Origin);
    return trans * rot;
}

// These are what you already have
Entity toolCenterPoint = Mesh.CreateBox(1.0,1.0,1.0);
Point3D XYZ = new Point3D(x, y, z);
Vector3D IJK = new Vector3D(i, j, k);

// Need a transformation to move your entity
Transformation newPosition = pointNormalTransformation(XYZ, IJK);
// Need last transformation to move your entity back to origin.
Transformation lastPosition = new Transformation(1.0);

//  Loop this with updated positions
//
lastPosition.Invert(); 
toolCenterPoint.TransformBy(lastPosition); // return end effector (TCP) back to origin
toolCenterPoint.TransformBy(newPosition); // move TCP from origin to location
lastPosition = newPosition;
// end loop
于 2020-10-31T21:33:17.833 回答