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

How to transform Vector3 with tf::Transform?

asked 2020-03-25 02:38:18 -0500

pauljurczak gravatar image

updated 2020-03-25 02:54:50 -0500

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?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2020-03-25 03:54:37 -0500

bob-ROS gravatar image

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);
edit flag offensive delete link more

Comments

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

pauljurczak gravatar image pauljurczak  ( 2020-03-25 04:01:27 -0500 )edit
1

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.

bob-ROS gravatar image bob-ROS  ( 2020-03-25 04:13:46 -0500 )edit
0

answered 2020-04-28 12:42:15 -0500

Lost Monkey 5 gravatar image

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

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-03-25 02:38:18 -0500

Seen: 1,117 times

Last updated: Mar 25 '20