Convert Pose to KuKa Euler Coordinates in C#- Printable Version +- RoboDK Forum (//www.sinclairbody.com/forum) +-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN) +--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API) +--- Thread: Convert Pose to KuKa Euler Coordinates in C# (/Thread-Convert-Pose-to-KuKa-Euler-Coordinates-in-C) |
Convert Pose to KuKa Euler Coordinates in C#-Nino Contino-09-29-2022 Hi, We are currently interfacing RoboDK with our SW using the C# Api. In RoboDk we are using the KUKA KR 250 R2700-2. We are having some issue in performing absolute rotation of the end effector of the robot and we think the issue are the Euler Coordinates that we obtain in the Api. We collect the pose using Pose(), we create a rotation matrix, we transform the rotation matrix from the reference frame in 0.0.0 to the frame of the robot and we then multiply by the robot pose. we then send this pose to robodk using MoveJ. As long as the coordinate system is similar to the system of the end effector, it works as expected. If instead they differ (especially in z axis) then the movement is not what we expect. I think this is because the Pose that we obtain with Pose() is in Mecademic coordinates, while the robot uses KUKA Coordinates. Is there a way in C# to obtain and send the coordinate correctly to robodk? Below an example of what we are doing. We also tryed using RPM instead of Rxyz but it still doesn't work Mat robot_pose = _robot.Pose(); var move_xyzrxryrz = new double[6]; move_xyzrxryrz[0] = 0; move_xyzrxryrz[1] = 0; move_xyzrxryrz[2] = 0; move_xyzrxryrz[3] = 0; move_xyzrxryrz[4] = -45; move_xyzrxryrz[5] = 0; var movementPoseRxyz = Mat.FromTxyzRxyz(move_xyzrxryrz); var transformationAxes = new Mat(robot_pose); transformationAxes.setPos(0, 0, 0); var movementPoseAlignedRxyz = transformationAxes.inv() * movementPoseRxyz * transformationAxes; Mat MovRxyz = robot_pose * movementPoseAlignedRxyz; _robot.MoveJ(MovRxyz, MoveBlocking); EDIT - 我更新了例子,我添加了一些截图to clarify the behavior. Please see the coordinates before and after attempting to perform a -45° rotation on the Y axis. I also included the screenshot of the final pose that I was expecting. RE: Convert Pose to KuKa Euler Coordinates in C#-ANDYF-10-03-2022 var newPose = Mat.MultiplyMatSimple( _robot.Pose(), -Mat.roty(Math.PI/4)); |