为方便查阅,此文是原网站文档翻译,如有侵权,请与本人联系。
官网
在chrono::sensor::ChLidarSensor中,合成数据是通过基于GPU的光线跟踪生成的。通过利用NVIDIA Optix Library提供的硬件加速支持和无头渲染功能。对于每个激光雷达光束,都会跟踪一组对该激光雷达光束进行采样的光线。样本数量以及光束发散角由用户设置。激光雷达的整个帧/扫描在单个渲染步骤中进行处理。为了说明扫描过程中光线的时间差,使用了关键帧和运动模糊技术。有了这些关键帧,扫描中的每个光束都会在特定时间跟踪场景,再现物体和激光雷达的运动。激光雷达光束返回的强度基于漫反射。
Creating a Lidar
auto lidar = chrono_types::make_shared<ChLidarSensor>(
parent_body, // body lidar is attached to
update_rate, // scanning rate in Hz
offset_pose, // offset pose
horizontal_samples, // number of horizontal samples
vertical_channels, // number of vertical channels
horizontal_fov, // horizontal field of view
max_vert_angle, // high vertical extent
min_vert_angle, // low vertical extent
max_distance, // maximum range
beam_shape, // set the beam shape to rectangular or elliptical
sample_radius, // configures the number of samples to use per beam
vert_divergence_angle, // vertical beam divergence angle
hori_divergence_angle, // horizontal beam divergence angle
return_mode, // return mode for the lidar when multiple samples used
clip_near // near clipping distance to ensure housing geometry not seen
);
lidar->SetName("Lidar Sensor");
lidar->SetLag(lag);
lidar->SetCollectionWindow(collection_time); // typically time to spin 360 degrees
Lidar Filter Graph
// Access lidar data in raw format (range and intensity)
lidar->PushFilter(chrono_types::make_shared<ChFilterDIAccess>());
// Generate point cloud from raw data
lidar->PushFilter(chrono_types::make_shared<ChFilterPCfromDepth>());
// Add noise based on angle, angle, range, intensity
lidar->PushFilter(chrono_types::make_shared<ChFilterLidarNoiseXYZI>(0.01f, 0.001f, 0.001f, 0.01f));
// Access lidar data in point cloud format
lidar->PushFilter(chrono_types::make_shared<ChFilterXYZIAccess>());
// visualize point cloud (<height, width, zoom, name> of visual window)
lidar->PushFilter(chrono_types::make_shared<ChFilterVisualizePointCloud>(640, 480, 2, "Lidar Point Cloud"));
// Add sensor to manager
manager->AddSensor(lidar);
Lidar Data Access
UserXYZIBufferPtr xyzi_ptr;
while () {
xyzi_ptr=lidar->GetMostRecentBuffer<UserXYZIBufferPtr>();
if(xyzi_ptr->Buffer) {
// Retrieve and print the first point in the point cloud
PixelXYZI first_point= xyzi_ptr->Buffer[0];
std::cout<<"First Point: [ "<<unsigned(first_point.x) <<", "<<
unsigned(first_point.y) <<", “ <<unsigned(first_point.z) <<", "<<
unsigned(first_point.intensity) <<" ]"<<std::endl;
}
}