我正在尝试创建5轴机器应用程序,为了定义3D位置加上末端执行器的方向,通常的方法是从XYZIJK计算它,其中XYZ是空间位置,IJK是方向向量。PowerMill有这个对象,大多数5轴编程系统都有这个对象。在视界9.0或更高版本中怎么可能。视野= DevDept
发布于 2020-11-01 05:33:18
视线最适合处理变换矩阵或四元数。我仍然不能理解四元数,所以这里是转换矩阵的答案。此函数的作用是获取您正在讨论的点和向量,并将其转换为完整的变换框架。
这样做的一个问题是,我只有对称的工具,所以这可以让你的工具到达正确的点和矢量,但可以任意地围绕工具向上旋转。如果你弄清楚了那部分,请告诉我。
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 loophttps://stackoverflow.com/questions/64345511
复制相似问题