MCPcopy Create free account
hub / github.com/brytsknguyen/slict / PcHandler

Method PcHandler

src/SensorSync.cpp:216–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214 }
215
216 void PcHandler(const sensor_msgs::PointCloud2::ConstPtr &msg, int idx, int stamp_type)
217 {
218 double startTime = -1, endTime = -1;
219 if (stamp_type == 1)
220 {
221 startTime = msg->header.stamp.toSec();
222 endTime = startTime + 0.1;
223 }
224 else
225 {
226 endTime = msg->header.stamp.toSec();
227 startTime = endTime - 0.1;
228 }
229
230 // Convert the cloud msg to pcl
231 CloudOusterPtr cloud_inL(new CloudOuster());
232 pcl::fromROSMsg(*msg, *cloud_inL);
233
234 // Transform to the body frame
235 CloudXYZITPtr cloud_inB(new CloudXYZIT());
236 for(int i = 0; i < cloud_inL->size(); i++)
237 {
238 PointOuster &point_inL = cloud_inL->points[i];
239
240 // Discard of the point if range is zero
241 if (point_inL.range < min_range)
242 continue;
243
244 Vector3d p_inL(point_inL.x, point_inL.y, point_inL.z);
245 p_inL = R_B_L[idx]*p_inL + t_B_L[idx];
246
247 PointXYZIT point_inB;
248 point_inB.x = p_inL(0);
249 point_inB.y = p_inL(1);
250 point_inB.z = p_inL(2);
251 point_inB.intensity = point_inL.intensity;
252 point_inB.t = point_inL.t / 1e9;
253
254 cloud_inB->push_back(point_inB);
255 }
256
257 lidar_buf_mtx.lock();
258 lidar_buf[idx].push_back(CloudPacket(startTime, endTime, cloud_inB));
259 lidar_buf_mtx.unlock();
260 }
261
262 void ImuHandler(const sensor_msgs::Imu::ConstPtr &msg)
263 {

Callers

nothing calls this directly

Calls 3

CloudPacketClass · 0.70
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected