I am trying to get the forward kinematics for a robot model in matlab (rigid body tree). I created a 4 x4 transformation matrix from the base to the end-effector using the gettransform() function. I have 4 different joint angles to control. But how do I multiply the joint angles with the transformation matrix so that I get the correct orientation and position output of the end-effector?

Is there otherwise a better option to get the forward kinematics?


  • $\begingroup$ By the time you obtain forward kinematic matrix, you should have each joint variable inside it (not multiply it) Maybe you need post your forward kinematic matrix here.. $\endgroup$
    – Albert H M
    Jun 16 '21 at 0:51
  • $\begingroup$ @AlbertHM Does that mean I have to calculate the matrix again every time I change the joint values? $\endgroup$
    – Veronique
    Jun 17 '21 at 10:15
  • $\begingroup$ Absolutely. Because forward kinematic is a function that map joint configuration into end effector position. And each joint movement will result in different position and orientation of end effector. $\endgroup$
    – Albert H M
    Jun 17 '21 at 10:59
  • $\begingroup$ Or you wanna make matlab function using that matrix, then there is a way. Make theta1 theta2 etc as symbolic (look matlab syms), then input it in getTransform $\endgroup$
    – Albert H M
    Jun 17 '21 at 11:00

After looking the documentation, in function gettransform you put your joint angle configuration there in radians.

  1. Create the struct containing your join value

    s = struct(nameofjoint1, valueofjoint1,..., nameofjointN, valueofjointN)

  2. Get the position and orientation of your end-effector

    % Syntax

    % transform = getTransform(robot,jointconfiguration,startframe,lastframe)

    transform = getTransform(robot,s,'L1','L4')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.