ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Concatenating relative transformations to obtain a global transformation

asked 2013-05-08 21:52:45 -0600

updated 2013-11-18 07:25:18 -0600

tfoote gravatar image

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

edit retag flag offensive close merge delete

Comments

Hi, how did you solve the problem ?

sai gravatar image sai  ( 2014-03-30 16:14:05 -0600 )edit

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

Mobile_robot gravatar image Mobile_robot  ( 2014-07-01 08:03:31 -0600 )edit
1

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

K_Yousif gravatar image K_Yousif  ( 2014-07-09 20:54:06 -0600 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2014-03-30 16:34:55 -0600

The above procedure is correct, there was jumping or incorrect transformation every now and then which ruins the estimate, therefore I added an if statement that if the relative transformation is > than a specified threshold, then ignore it and set the relative transformation to the identity.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-05-08 21:52:45 -0600

Seen: 2,991 times

Last updated: May 08 '13