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 -0600
Seen: 6,030 times
Last updated: May 12 '17
Fast triangulation of unordered point clouds - adding new clouds
Coloring point clouds from images - how to match 3Dpoint/pixel efficiently?
getting data from a pointcloud2 coming from Kinect
Compatibility of .pcd files in ROS and standalone PCL
Error in building point cloud using PointCloud2
Interpreting stored cloud file from PointCloud2 data type
Function for unpacking RGB point field from point in point cloud?