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 | Q&A answers.ros.org |
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...
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2017-05-04 05:01:49 -0500
Seen: 5,332 times
Last updated: May 12 '17
Pointcloud2 messages and logical operations...
Reworked Velodyne driver causes OctoMap segmentation fault
adding rgb data into a point cloud?
PCL Pointcloud type conversion/pointer issue
how to use concatenatePointCloud
ImportError: libpcl_keypoints.so.1.7: cannot open shared object file: No such file or directory
How to port a node to nodelet as easy as possible?
how to convert/save pointcloud2 into ply with ROS electric (pcl1.1) [closed]