43 const uint32_t laser_cloud_step = 16;
65 const sensor_msgs::Image::ConstPtr& message
73 image_channels_ = message->data.size() / (message->height * message->width);
84 const sensor_msgs::CameraInfo::ConstPtr& message
93 sensor_msgs::PointCloud2::Ptr message
109 message->header.stamp,
113 message->header.frame_id,
129 float* pointCloudDataP =
reinterpret_cast<float*
>(&(message->data[0]));
131 const uint32_t height = message->height;
132 const uint32_t width = message->width;
133 const uint32_t cloudStep = message->point_step / message->fields.size();
135 uint32_t validPoints = 0;
136 for( uint32_t index = 0 ; index < height * width ; ++index, pointCloudDataP += cloudStep)
138 float x = pointCloudDataP[0];
139 float y = pointCloudDataP[1];
140 float z = pointCloudDataP[2];
147 if (sqrt(x * x + y * y * z * z) > 58.0)
167 if (u <
color_image_.width && v < color_image_.height && u >= 0.0 && v >= 0.0)
170 colorPointCloudDataP[0] = x;
171 colorPointCloudDataP[1] = y;
172 colorPointCloudDataP[2] = z;
174 uint8_t* colorChannelP =
reinterpret_cast<uint8_t*
>(&colorPointCloudDataP[3]);
186 colorChannelP[2] = imageDataP[2];
187 colorChannelP[1] = imageDataP[1];
188 colorChannelP[0] = imageDataP[0];
191 colorChannelP[1] = imageDataP[1];
192 colorChannelP[0] = imageDataP[0];
195 colorChannelP[0] = imageDataP[0];
196 colorChannelP[2] = imageDataP[0];
197 colorChannelP[1] = imageDataP[0];
201 colorPointCloudDataP += cloudStep;
250 int main(
int argc,
char** argv)
254 ros::init(argc, argv,
"color_laser_publisher");
259 std::string tf_prefix;
260 nh_private.
param<std::string>(
"tf_prefix", tf_prefix,
"multisense");
266 catch(std::exception& e)