Hello,
I publish a PointCloud2 message to a predefined topic that rviz's PointCloud display subscribes to (/output) successfully, but the pointcloud does not show up on the visualization. I know it publishes successfully because there is no error message in the rviz display window.
In the launch file for my program, I launch the demo.launch for my tx90 robot that was created through the moveit_setup_assistant,
which starts up rviz which visualizes my tx90 robot, but not the pointcloud2 message.
i believe this may be a problem with TF, but i added a static_transform_publisher to my launch file as so:
But this does not change anything except add the frame head to my transform tree (which I found through using tf view_frames), I am still not able to view the pointclouds in rviz. It says I do not have enough karma to post my frames.pdf file.
My code for this portion is as follows:
ros::Publisher pc_pub = n.advertise ("/output", 1);
boost::filesystem::path pkgPath, imgPath;
std::stringstream ss;
pkgPath = ros::package::getPath("mover_node");
ss << pkgPath.c_str() << "/Wound_3d_mesh.pcd";
std::string fpath = ss.str();
sensor_msgs::PointCloud2 cloud_msg;
pcl::PointCloud cloud;
pcl::PCLPointCloud2 point_cloud2;
pcl::io::loadPCDFile(fpath, cloud);
//pcl::PointCloud::ConstPtr tmp_cloud = cloud;
pcl::toPCLPointCloud2(cloud, point_cloud2);
pcl_conversions::fromPCL(point_cloud2, cloud_msg);
cloud_msg.header.frame_id = "head";
cloud_msg.header.stamp = ros::Time::now();
pc_pub.publish(cloud_msg);
↧