Robotics StackExchange | Archived questions

How to transform Vector3 with tf::Transform?

I have a position Vector3 pWorld in WORLD coordinate system and I have a tf::Transform t from WORLD to TURTLE coordinate system. I would like to get a transformed position Vector3 pTurtle, which is pWorld in TURTLE coordinate system. What is a simple way of doing it?

Asked by pauljurczak on 2020-03-25 02:38:18 UTC

Comments

Answers

Similar example earlier. I assume you can replace your tf::transform with tf::transformStamped retrieved from lookupTransform .

tf2_ros::Buffer tfBuffer;
tf2_ros::TransformListener tf2_listener(tfBuffer);
geometry_msgs::TransformStamped your_transform; 

your_transform = tfBuffer.lookupTransform("TURTLE", "WORLD", ros::Time(0), ros::Duration(1.0) );
geometry_msgs::Point your_point;
tf2::doTransform(your_point, your_point, your_transform); 

Asked by bob-ROS on 2020-03-25 03:54:37 UTC

Comments

Is there a tf equivalent of tf2::doTransform? I'm having some issues with tf2.

Asked by pauljurczak on 2020-03-25 04:01:27 UTC

Yes there is See

transformPoint (const std::string &target_frame, const geometry_msgs::PointStamped &stamped_in, geometry_msgs::PointStamped &stamped_out)

Create a PointStamped message and insert your position. In the header: put the frame you are currently in, the stamp = ros::Time::now() and I think you can ignore the seq value in the header.

Asked by bob-ROS on 2020-03-25 04:13:46 UTC

An issue ticket was opened for a tf2::doTransfrom() that I think will answer your question.

Asked by Lost Monkey 5 on 2020-04-28 12:42:15 UTC

Comments