converting velodyne packets to pointcloud
Hii, I have velodyne packets and its config file . I want to convert it to point cloud in a C++ program. Can anyone provide me API to do this .
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
Hii, I have velodyne packets and its config file . I want to convert it to point cloud in a C++ program. Can anyone provide me API to do this .
here is the api to convert into pcl data structure .After this we can use Pcl_conversion to convert the cloud into sensor_msg::pointcloud2
#include "velodyne_pointcloud/calibration.h"
#include "velodyne_msgs/VelodynePacket.h"
#include "velodyne_msgs/VelodyneScan.h"
#include "velodyne_pointcloud/rawdata.h"
#include "velodyne_pointcloud/point_types.h"
#include "velodyne_pointcloud/VelodyneConfigConfig.h"
#include "velodyne_pointcloud/point_types.h"
#include "velodyne_pointcloud/calibration.h"
#include <pcl_conversions/pcl_conversions.h>
void save_3d_lidar(velodyne_msgs::VelodyneScan::ConstPtr v_scan,nav_msgs::Odometry::ConstPtr gps_pose)
{
pcl::PointCloud<pcl::PointXYZI> cloud_3d;
pcl::PointXYZI point;
velodyne_rawdata::RawData data;
cloud_3d.clear();
for(int i=0;i<v_scan->packets.size();i++)
{
pcl::PointCloud<velodyne_pointcloud::PointXYZIR> v_point_cloud;
data.setParameters(0.9,130.0,0.0,6.28);
data.setupOffline("file adresss",130.0,0.9);
data.unpack(v_scan->packets[i],v_point_cloud);
for(int j=0;j<v_point_cloud.size();j++)
{
point.x=v_point_cloud.points[j].x;
point.y=v_point_cloud.points[j].y;
point.z=v_point_cloud.points[j].z;
point.intensity=v_point_cloud.points[j].intensity;
cloud_3d.push_back(point);
}
}
}
The velodyne_pointcloud package does what you seem to need.
It's not exactly an advertised interface, but I suppose you could use the RawData class: http://docs.ros.org/indigo/api/velody...
Asked: 2017-05-04 05:01:49 -0500
Seen: 5,752 times
Last updated: May 12 '17
Having trouble understanding the velodyne ROS driver
Converting PointCloud2: From ROS to PCL (converting in callback vs directly)
Why does ROS2 not have pcl::toRosMsg? Deprecated?
How to convert sensor_msgs/Image to PointCloud<pcl::RGB>??
Process has died - Exit Code -11
"right_arm_base_link" passed to lookupTransform argument target_frame does not exist.
Generating and merging point clouds
Generate map with underwater sonar data