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

Revision history [back]

Get the point out of the point cloud, construct a PointStamped, then transform it using transformPoint.

However, when sending a goal, whatever is listening for the goal will likely transform it into whatever frame it needs.

Get the point out of the point cloud, construct a PointStamped, then transform it using transformPoint.transformPoint. Here's a code snippet that will load the values from your point into a PointStamped, transform that point into target_frame, and put the resulting point into pt_transformed.

geometry_msgs::PointStamped pt;
geometry_msgs::PointStamped pt_transformed;
pt.header = myCloud->header;
pt.point.x = myCloud->points[1].x;
pt.point.y = myCloud->points[1].y;
pt.point.z = myCloud->points[1].z;

tf::TransformListener listener;
listener.transformPoint("target_frame", pt, pt_transformed);

However, when sending a goal, whatever is listening for the goal will likely transform it into whatever frame it needs.