Rotation Matrix using API?可打印版本 +- 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: Rotation Matrix using API? (/Thread-Rotation-Matrix-using-API) |
Rotation Matrix using API?-mnurpeiissov-02-08-2019 Hello, Is there a way to extract rotation matrix? The Mat which is returned when calling robot.SolveFK contains the information about the pose of the robot where the first three elements of last column represent the X,Y,Z positions. Is the 3x3 (first three cols and first three rows) of Mat is rotation matrix? If I use the Pose_2_TxyzRxyz and then construct the rotation matrix using Euler angle convention rotz*roty*rotx (I am not sure if this method is right), I end up with different result than 3x3 of Mat. I would appreciate any help. Best Regards RE: Rotation Matrix using API?-Albert-02-08-2019 This is not correct. Calling the following function: pose = TxyzRxyz_2_Pose([x,y,z,rx,ry,rz]) Where x,y,z is the translation in mm and rx,ry,rz is the rotation in radians. It ss the same as doing the following: pose = transl(x,y,z)*rotx(rx)*roty(ry)*rotz(rz) And you can revert this operation doing: x,y,z,rx,ry,rz = Pose_2_TxyzRxyz(pose) More information here: //www.sinclairbody.com/doc/en/PythonAPI/robodk.html#robodk.Pose_2_TxyzRxyz If you are using the Python API and you only want the rotation matrix you can do: rotation = pose[0:3,0:3] Another tip: You can change the coordinate system of a point the following way: point_ref1 = [x,y,z,1] point_ref2 = pose * point_ref1 You can change the coordinate system of a vector the following way: vector_ref1 = [u,v,w] vector_ref2 = pose * vector_ref1 RE: Rotation Matrix using API?-mnurpeiissov-02-09-2019 Thank you for your reply. I have constructed transformation matrix using DH table and calculated it using MATLAB. I came up with different rotation and translation when all joints are zero. When all the joints set to 0, robodk shows that translation along X,Y,Z are [-817 , -191, -4.45] respectively. The calculated ones are [-817, -9.53, -5.33]. So we have different Y and Z translations. The rotation matrices were different two, but I haven't attached them. What could be the reason for that? I have acquired DH parameters fromhttp://rsewiki.elektro.dtu.dk/index.php/UR5 [attachment=157][attachment=158][attachment=159] |