# Concatenating relative transformations to obtain a global transformation

Hi guys,

I am trying to implement a visual odometry system that matches features viewed by sequential frames and calculating the rigid body transformation between the corresponding points using RANSAC. I am successfully obtaining the ransac transformation that aligns the points obtained by the two frames. The relative transformation is of type `Eigen::Matrix4f relative_transformation`

. I would like to concatenate (sum up) all the relative transformation in order to obtain a global transformation. I don't think I am doing it correctly:

```
//class attributes
Eigen::Matrix4f global_transformation== Eigen::Matrix4f::Identity(4,4);;
Eigen::Matrix4f relative_transformation;
tf::Transform transform;
void process(){
relative_transformation=calculate_ransac_relative_transformation();
global_transformation = global_transformation*relative_transformation;
Eigen::Matrix4d global_transformation_(global_transformation.cast<double>());
Eigen::Affine3d affine(global_transformation_);
tf::TransformEigenToTF(affine, transform);
static tf::TransformBroadcaster br;
br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "/odom", "Global_transformation"));
}
```

When viewing the transformation in RVIZ, it keeps jumping around even if the camera is not moving. Any idea what I am doing wrong?

Any help would be much appreciated. Thanks,

Khalid

Hi, how did you solve the problem ?

Hello Khalid, I am trying to use the same procedure, I am using Groovy and Ubuntu 12.04. The problem is that it says : " ‘TransformEigenToTF’ is not a member of ‘tf’ " !! as I understood I should add the header file : <tf_conversions tf_eigen.h=""> but I have the problem, it says that for computer Eigein/Core.h is not clear!! Can you please tell me how you did that? Thanks Hamed

Hi Hamed, Try transformEigenToTF (with the small t instead of capital T).