Skip to content

Commit 1f63a4f

Browse files
committed
PCL example test completed
1 parent 77112ca commit 1f63a4f

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

cuboid_detection/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ include
144144
## ADD YOUR PROGRAMS HERE
145145

146146
# add_executable(${PROJECT_NAME}_node src/cuboid_detection_node.cpp)
147+
add_executable(example src/example.cpp)
147148

148149
## <<<<<<<<<<<<<<<<<<<<<<<
149150

@@ -164,3 +165,4 @@ include
164165
# target_link_libraries(${PROJECT_NAME}
165166
# ${OpenCV_LIBS}
166167
# )
168+
target_link_libraries(example ${catkin_LIBRARIES})

cuboid_detection/package.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,14 @@
5454
<build_depend>pcl_ros</build_depend>
5555
<build_depend>roscpp</build_depend>
5656
<build_depend>sensor_msgs</build_depend>
57+
<build_depend>libpcl-all-dev</build_depend>
5758
<build_export_depend>cv_bridge</build_export_depend>
5859
<build_export_depend>image_transport</build_export_depend>
5960
<build_export_depend>pcl_conversions</build_export_depend>
6061
<build_export_depend>pcl_ros</build_export_depend>
6162
<build_export_depend>roscpp</build_export_depend>
6263
<build_export_depend>sensor_msgs</build_export_depend>
64+
<exec_depend>libpcl-all</exec_depend>
6365
<exec_depend>cv_bridge</exec_depend>
6466
<exec_depend>image_transport</exec_depend>
6567
<exec_depend>pcl_conversions</exec_depend>

cuboid_detection/src/example.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include <ros/ros.h>
2+
// PCL specific includes
3+
#include <sensor_msgs/PointCloud2.h>
4+
#include <pcl_conversions/pcl_conversions.h>
5+
#include <pcl/point_cloud.h>
6+
#include <pcl/point_types.h>
7+
8+
ros::Publisher pub;
9+
10+
void
11+
cloud_cb (const sensor_msgs::PointCloud2ConstPtr& input)
12+
{
13+
// Create a container for the data.
14+
sensor_msgs::PointCloud2 output;
15+
16+
// Do data processing here...
17+
output = *input;
18+
19+
// Publish the data.
20+
pub.publish (output);
21+
}
22+
23+
int
24+
main (int argc, char** argv)
25+
{
26+
// Initialize ROS
27+
ros::init (argc, argv, "my_pcl_tutorial");
28+
ros::NodeHandle nh;
29+
30+
// Create a ROS subscriber for the input point cloud
31+
ros::Subscriber sub = nh.subscribe ("input", 1, cloud_cb);
32+
33+
// Create a ROS publisher for the output point cloud
34+
pub = nh.advertise<sensor_msgs::PointCloud2> ("output", 1);
35+
36+
// Spin
37+
ros::spin ();
38+
}

0 commit comments

Comments
 (0)