How to find match for point cloud "Azimuth" filed and output
Hi everyone, I am a little new to ROS especially for the PCL package, I want to build a new ROS node named "filter_node" to receive lidar real-time data and filter necessary information then publish. However, I meet some problem when I used PCL package to program.
the background is my PC will connect with a Robosense Lidar to collect lidar raw data, and several topics can be subscribed, here I use rslidar_points to read all raw data. Now I want to make my own node to filter some information.
My main loop is as below, initialize a ROS node and create a ROS subscriber for filtering, meanwhile, a topic "rslidar_points" is subscribed to collect point cloud raw data
int main (int argc, char** argv)
{
// Initialize ROS
ros::init (argc, argv, "filter_node");
ros::NodeHandle nh;
// Create a ROS subscriber for the input point cloud
ros::Subscriber sub1 = nh.subscribe ("/rslidar_points", 1, cloud_cb1);
}
regarding callback function based on my understanding, first of all the pointcloud data should be read in to workspace from row message. Meanwhile, a container for the message should be declared. then find the azimuth = 0 pointcloud data, finally using ROS_INFO_STREAM to output the information on console.
void cloud_cb1 (const sensor_msgs::PointCloud2ConstPtr& cloud_msg)
{
pcl::PointCloud<pcl::PointXYZ> msg; // create a container for the data
pcl::fromROSMsg(*cloud_msg,msg); // convert data from ROS
/* read point cloud azimuth value then comparing it around 0.0 (e.g. -2<= azimuth <= 2) to filter point cloud data then output point cloud coordinate and the laser ID*/
ROS_INFO_STREAM(msg.points); // output corresponding point cloud data stream
}
So my question is how to filter azimuth value and data. I don't have any ideas about this part only knows maybe PCL package could be used in further coding. Could you help me?