Best way to tf a non-stamped point.

asked 2020-10-19 05:58:32 -0500

Mackou gravatar image

Hello everyone.

I am currently trying to transforn a Point in C++ from one frame to another.

So I am trying to use the Transform listener and the function transformPoint. The problem is that all the definitions of transformPoint expect a PointStamped and not a simple Point.

I have my point, the current frame and the target frame.

Should I create a PointStamped with the current frame then TF it and then get the Point ? It doesn't seem right to do so. I would like something like :

transformPoint(const std::string& current_frame, const std::string& target_frame, const geometry_msgs::Point& in, geometry_msgs::Point& out)

So what do you think ? Thanks !

edit retag flag offensive close merge delete

Comments

1

What would you proposed transformPoint(..) do exactly? How would it know which timestamp to retrieve the transform for?

gvdhoorn gravatar image gvdhoorn  ( 2020-10-19 06:16:51 -0500 )edit

@gvdhoorn I just want to get a transformed Point, not PointStamped.

Then we could add the timestamp :

transformPoint(const std::string& current_frame, const std::string& target_frame, const geometry_msgs::Point& in, geometry_msgs::Point& out, const ros::Time& target_time)

Mackou gravatar image Mackou  ( 2020-10-19 06:25:16 -0500 )edit

So with that target_time added, you basically now pass a PointStamped, but instead of using a single arg, you use 3 (current_frame, in and target_time (although you typically don't use target's time, but source)).

Summarising: wrap your Point in a PointStamped and provide suitable values for the Header part of it.

Semantically, transforming a plain Point is difficult, as you don't have enough information: you don't know when or relative to what. So you have to supply those.

gvdhoorn gravatar image gvdhoorn  ( 2020-10-19 06:27:50 -0500 )edit

@gvdhoorn Thanks for your answer. So the only way is to create a PointStamped ? Thanks

Mackou gravatar image Mackou  ( 2020-10-19 07:29:55 -0500 )edit