Robotics StackExchange | Archived questions

How do you calculate the tcp with an urdf file?

Hello,

im currently parsing an URDF file of an serial robot in c++ and was wondering how i calculate the transformation from the base to the TCP of the robot.

How would i need to do that, since there are joints and links. How would i need to code the transformation of that?

Asked by Qilos on 2022-07-05 02:51:35 UTC

Comments

Answers

You can calculate the transform of a robot link n relative to its base link with the following equation: T_base_to_n = T_base_to_1*T_1_to_2*...T_n-1_to_n. The T_k-1_to_k is determined with the values in the joint tag from the URDF file. The xyz value specified corresponds to the last column and first three rows of the transformation matrix, e.g. T_k-1_to_k(0:2, 3) = [x_k, y_k, z_k]. The rpy values are used to calculate the 3x3 rotation martrix R_k = RYaw(y_k)*RPitch(p_k)*RRoll(r_k), which corresponds to the first three rows and columns of T_k-1_to_k, e.g. T_k-1_to_k(0:2, 0:2) = R_k.

If you want to see an example, you can checkout this repo: https://github.com/pac48/robot_kinematics

Asked by pac48 on 2022-07-05 14:25:46 UTC

Comments

@Qilos The discussion in #q193916 may also help.

Asked by Mike Scheutzow on 2022-07-17 07:48:47 UTC

@pac48

Thanks for your answer it worked. Im just wondering what i would need to change if I want to change the angles of my joints?

I have my urdf file and i can read in the transformation matrices between the joints like you explained. And then multiplicate them to get the transformation from base to tcp. So how would i need to change the transformation matrices change the current angle of each joint?

Asked by Qilos on 2022-07-26 05:15:48 UTC