0
$\begingroup$

I have a list of poses that I'm trying to publish after converting into the 'map' coordinate frame of reference. I understand that this is done with the help of tf/static_transform_publisher, however I am not sure how to determine the values of the transform.

Is there a standard method for this? Thank you!

$\endgroup$

2 Answers 2

0
$\begingroup$

Welcome to Robotics Stack Exchange!

How can I calculate the static transform between 2 coordinate frames?

Using terminal

Please use tf_echo utility from tf package as shown below:

  1. ROS 1: $ rosrun tf tf_echo turtle1 turtle2
  2. ROS 2: $ ros2 run tf2_ros tf2_echo turtle2 turtle1

Using API inside code

Please use lookupTransform from tf package as shown below:

  1. ROS 1: listener.lookupTransform("/turtle2", "/turtle1", ros::Time(0), transform);
  2. ROS 2: tf_buffer_->lookupTransform(toFrameRel, fromFrameRel, tf2::TimePointZero);
$\endgroup$
3
  • $\begingroup$ Thanks very much for your response! However, I have not yet defined the transform from "map-gt" to "map". I am unsure how to calculate the numbers to correctly transform between the 2 frames $\endgroup$
    – user36184
    Sep 4, 2023 at 14:31
  • $\begingroup$ I suggest improving your question. You said "I have a list of poses..." in your question already. You are either confused or not sharing the complete information with us. $\endgroup$
    – ravi
    Sep 5, 2023 at 1:31
  • $\begingroup$ Ah sorry about that. I have a list of poses in one coordinate frame, I don't yet have their equivalent in the map frame. $\endgroup$
    – user36184
    Sep 9, 2023 at 16:20
0
$\begingroup$

Find below some possibilities on how to address your problem:

  • Probably is not suitable for the case at your hand, but the transform can be trivial. E.g. if you place a camera (RF with z forward) parallel to the ground, 10cm above a mobile base (RF with x forward), you have a translation of 10cm and a rotation of 90°, thus you can "manually" define your transform. See an example in the tf tutorial. If you fall into this scenario, thus you probably should edit your robot urdf to include the camera-to-base link, and let the robot_state_publisher do the rest.

  • From your answer to ravi, I guess you are able to retrieve the pose of an object (more in general, a point) in the map-gt reference frame. You should place something in known poses in the map reference frame, assuming that you are able to locate the map origin in the real world. One option is to measure (yes, with a tape measure, a ruler, or whatever) where they are. Once you have got the same point both in map and map-gt, you can use an algorithm such as ICP (iterative closest point) to find the transform. Here some extra info about the algorithm, and here some possible Python implementations of it.

  • If you have access to a camera set up to work in ROS, you could also try to use markers (such as Aruco markers) and the aruco_ros package to directly get the transform between your RF. Please note that you have to manually place the markers at the origin of each of the two RF and align them with the RF axis, which is very error-prone and could not always be feasible (e.g. if the origin is on the floor and the z-axis points downward).

Hope you can find your way!

$\endgroup$

Your Answer

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

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