# Revision history [back]

Create a tf point from your Eigen point, query the tf server for the right transform, and then apply the transform.

Here's some code to get you started. (I haven't actually compiled this)

#include <tf/transform_listener.h>
#include <tf/transform_datatypes.h>

// the point, in the camera frame
tf::Vector3 point(x, y, z);

// request the transform between the two frames
tf::TransformListener listener;
tf::StampedTransform transform;
try{
ros::Time::now(), transform);
}
catch (tf::TransformException ex) {
ROS_WARN("Base to camera transform unavailable %s", ex.what());
}

// the point, in the base link frame
tf::Vector3 point_bl = transform * point;


If the transform doesn't change, you probably want to cache it once, and then apply it to your data without querying it over and over.

Create a tf point from your Eigen point, query the tf server for the right transform, and then apply the transform.

Here's some code to get you started. (I haven't actually compiled this)

#include <tf/transform_listener.h>
#include <tf/transform_datatypes.h>

// the point, in the camera frame
tf::Vector3 point(x, y, z);

// request the transform between the two frames
tf::TransformListener listener;
tf::StampedTransform transform;
ros::Time time = ros::Time::now();

try{
time, ros::Duration(3.0));
ros::Time::now(), time, transform);
}
catch (tf::TransformException ex) {
ROS_WARN("Base to camera transform unavailable %s", ex.what());
}

// the point, in the base link frame
tf::Vector3 point_bl = transform * point;


If the transform doesn't change, you probably want to cache it once, and then apply it to your data without querying it over and over.

Create a tf point from your Eigen point, query the tf server for the right transform, and then apply the transform.

Here's some code to get you started. (I haven't actually compiled this)

#include <tf/transform_listener.h>
#include <tf/transform_datatypes.h>

// the point, in the camera frame
tf::Vector3 point(x, y, z);

// request the transform between the two frames
tf::TransformListener listener;
tf::StampedTransform transform;

// the time to query the server is the stamp of the incoming message
ros::Time time = ros::Time::now();

// frame of the incoming message

try{