Last active
August 29, 2015 14:23
-
-
Save jarvisschultz/2c3d0f0db1b7979817e9 to your computer and use it in GitHub Desktop.
PCL IO Errors from answers.ros.org
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 2.8.3) | |
project( pcl_io_errs ) | |
find_package(catkin REQUIRED COMPONENTS | |
roscpp | |
pcl_ros | |
sensor_msgs | |
) | |
find_package(PCL REQUIRED) | |
include_directories(${PCL_INCLUDE_DIRS}) | |
link_directories(${PCL_LIBRARY_DIRS}) | |
add_definitions(${PCL_DEFINITIONS}) | |
catkin_package() | |
include_directories(include | |
${catkin_INCLUDE_DIRS} | |
) | |
add_executable(pcl_io_errs pclio.cpp) | |
add_dependencies(pcl_io_errs ${catkin_EXPORTED_TARGETS}) | |
target_link_libraries(pcl_io_errs ${catkin_LIBRARIES} ${PCL_LIBRARIES}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<package> | |
<name> pcl_io_errs </name> | |
<version>0.0.0</version> | |
<description> | |
test package | |
</description> | |
<maintainer email="[email protected]">jarvis</maintainer> | |
<license>GPLv3</license> | |
<buildtool_depend>catkin</buildtool_depend> | |
<build_depend>roscpp</build_depend> | |
<build_depend>sensor_msgs</build_depend> | |
<build_depend>libpcl1-dev</build_depend> | |
<build_depend>pcl_ros</build_depend> | |
<run_depend>roscpp</run_depend> | |
<run_depend>sensor_msgs</run_depend> | |
<run_depend>libpcl1</run_depend> | |
<run_depend>pcl_ros</run_depend> | |
</package> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ros/ros.h" | |
#include <ros/package.h> | |
#include <sensor_msgs/PointCloud2.h> | |
//PCL | |
#include <iostream> | |
#include <pcl/io/pcd_io.h> | |
#include <pcl/point_types.h> | |
#include <pcl_conversions/pcl_conversions.h> | |
int main(int argc, char **argv) | |
{ | |
ros::init(argc, argv, "pcl_io_errs"); | |
ros::NodeHandle n; | |
//test PointCloud_to_ObjectModel3D | |
ros::Publisher pub = n.advertise<sensor_msgs::PointCloud2>("point_cloud", 1); | |
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>); | |
std::string path = ros::package::getPath("pcl_io_errs"); | |
pcl::io::loadPCDFile<pcl::PointXYZ> (path+"/bun000_Structured.pcd", *cloud); | |
ros::Rate loop_rate(10); | |
while (ros::ok()) | |
{ | |
sensor_msgs::PointCloud2 cloud2; | |
pcl::toROSMsg(*cloud, cloud2); | |
cloud2.header.frame_id = "point_cloud_link"; | |
cloud2.header.stamp = ros::Time::now(); | |
pub.publish(cloud2); | |
ros::spinOnce(); | |
loop_rate.sleep(); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment