In my work, I am using force sensors that provide measurements based on their frame pose in Gazebo. Due to the fact that frames are not constructed based on DH parameters, I need to track the tip's pose in order to be able to apply force measurements to a haptic device {$H$} (i.e. not shown there). I'm struggling now with the right transformation matrix between the tip's frame and the frame of the haptic device. To create a minimal working example, take a look at the following picture.

enter image description here

The tip's frame {$T$} is shown at the top of the second arm. In the left side menu, there are the pose and the relative pose. The former seems to me the pose of {$T$} with respect to the base's frame. When the tip interacts with the enviroment, the force sensor provides measurements with respect to {$T$}, my question is what is the proper way to transform ${}^Tf$ to ${}^Hf$ using ROS capabilities?


1 Answer 1


If you have robot state publisher that publishes transformations between links/joints. You can use tf package to fetch those transformations.

If you want to transform tip measurements into base frame, you should multiply T^-1 * tip_measurements.

To find out T you can use tf package and lookUpTransform to find out what's the transform between tip frame and the base frame.

You can check Python API for tf here and C++ API for tf here.

C++ API has helper classes TransformBroadcaster and TransformListener which can help you.

  • $\begingroup$ Maybe I'm missing something, but isn't T^-1 * tip_measurements the same as tip_measurements/T? $\endgroup$ May 15 at 17:58
  • 2
    $\begingroup$ It's not the same because T is not a scalar. One of the main reasons is that matrix multiplication is not commutative, and we are talking about homogeneous transformation matrix T. If we have transformation matrix which denotes spatial transformation between coordinate frame A and B or more so, denotes pose of the coordinate frame A in the coordinate frame B, then its inverse represents pose of the coordinate frame B in the coordinate frame A. It is more or less standard notation in the robotics community regarding transformation matrices. $\endgroup$ May 16 at 9:00
  • $\begingroup$ Is it possible to get the vector directly in the base frame without preforming the multiplication? RViz provides the pose with respect to the base frame, indicating that multiplication has occurred somewhere. $\endgroup$
    – CroCo
    May 17 at 14:11
  • 1
    $\begingroup$ @Greenonline The matrix algebra differs from the algebra used by real numbers. Matrix algebra does not allow division. $\endgroup$
    – CroCo
    May 17 at 14:13
  • $\begingroup$ @CroCo and Filip - Yep, sorry, gotcha. I wasn't quite with the program when I wrote that. $\endgroup$ May 17 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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