38 #include <sensor_msgs/PointCloud.h> 40 int main(
int argc,
char** argv){
41 ros::init(argc, argv,
"point_cloud_publisher");
46 unsigned int num_points = 100;
51 sensor_msgs::PointCloud cloud;
53 cloud.header.frame_id =
"sensor_frame";
55 cloud.points.resize(num_points);
58 cloud.channels.resize(1);
59 cloud.channels[0].name =
"intensities";
60 cloud.channels[0].values.resize(num_points);
63 for(
unsigned int i = 0; i < num_points; ++i){
64 cloud.points[i].x = 1 + count;
65 cloud.points[i].y = 2 + count;
66 cloud.points[i].z = 3 + count;
67 cloud.channels[0].values[i] = 100 + count;
void publish(const boost::shared_ptr< M > &message) const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
int main(int argc, char **argv)