1
$\begingroup$

I modeled the following robot with an urdf file. Thanks to a robot state publisher, i have access to the static tfs between camera_link and base_link.

I'm using orb_slam3 library as SLAM algorithm. This algorithm gives me a tf between the camera_link and to camera_link at time 0 (i call it "cam0"). My question is the following : How to convert this tf to a tf between base_link and map ?

enter image description here

I tried lookup for the tf between camera_link and base_link, and then do :

tf_map_base_link = tf_base_link_camera_link * tf_cam0_camera_link

But when I set "tf_cam0_camera_link" to the identity tf, compute "tf_map_base_link" and publish it as a tf between map and base_link, I visualize the following on rviz :

enter image description here

As you can see, camera_link and map frames are now superimposed. I don't understand why.

Here is my tf tree :

enter image description here

Can you help me ? Cheers

$\endgroup$
0

1 Answer 1

1
$\begingroup$

I proceeded by tinkering to obtain a correct transformation. There's probably a better option, but here's what i did :

 tf2::Transform tf_final;    //tf base_link --> map
 tf_final = (tf_camera_base_link.inverse() * tf_camera_cam0 * tf_camera_base_link).inverse();

 tf2::Vector3 vec = tf_final.getOrigin();
 tf_final.setOrigin(-vec);

 tf2::Quaternion q_final = tf_final.getRotation();
 tf2::Quaternion q_inverted(-q_final.x(), -q_final.y(), -q_final.z(), -q_final.w());
 tf_final.setRotation(q_inverted);

```
$\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.