Target pose from pointcloud [closed]
Hi, I'm using ROS kinetic and PCL to find a target point. The aim is to use moveit to move to the target point/pose. I used pcl to create a concave hull and as shown in the code below, I publish the tf frame of the first point in the cloud_hull. However, I'm lost at trying to get the pose as a geometry_msgs type or valid format for path planning in moveit. I can visualize the frame and get the coordinates, I want to know how to convert to a PoseStamped or PointStamped so i can use the point as a goal.
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_hull (new pcl::PointCloud<pcl::PointXYZ>);
pcl::ConcaveHull<pcl::PointXYZ> chull;
chull.setInputCloud (cloud_projected);
chull.setAlpha (0.1);
chull.reconstruct (*cloud_hull);
static tf::TransformBroadcaster br;
tf::Transform part_transform;
part_transform.setOrigin( tf::Vector3(cloud_hull->at(1).x, cloud_hull->at(1).y, cloud_hull->at(1).z) );
tf::Quaternion q;
q.setRPY(0, 0, 0);
part_transform.setRotation(q);
br.sendTransform(tf::StampedTransform(part_transform, ros::Time::now(), world_frame, "Potshell_outline"));
Here is an answer I was hoping to use, but I'm not sure how to get the header of the cloud_hull.
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);
if i use pt.header=cloud_hull->header;
I get no known conversion from pcl::PCLHeader
to std_msgs::Header_
Any help would be highly appreciated. In short, want to get the point coordinates in the cloud_hull as a PoseStamped
message to set as a target.
Thanks.