Apollo 11.0
自动驾驶开放平台
voxel_downsample.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2024 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17#pragma once
18
19#include <iostream>
20#include <vector>
21
22#include <thrust/device_ptr.h>
23#include <thrust/device_vector.h>
24#include <thrust/extrema.h>
25#include <thrust/host_vector.h>
26#include <thrust/sort.h>
27
30
31namespace apollo {
32namespace perception {
33namespace lidar {
34
40
41struct voxel {
42 float x;
43 float y;
44 float z;
45 float intensity;
47};
48
64
66 __host__ __device__ bool operator()(hashElement l, hashElement r) {
67 return l.index_of_voxel < r.index_of_voxel;
68 }
69};
70
71struct compareX {
72 __host__ __device__ bool operator()(base::PointF lp, base::PointF rp) {
73 return lp.x < rp.x;
74 }
75};
76
77struct compareY {
78 __host__ __device__ bool operator()(base::PointF lp, base::PointF rp) {
79 return lp.y < rp.y;
80 }
81};
82
83struct compareZ {
84 __host__ __device__ bool operator()(base::PointF lp, base::PointF rp) {
85 return lp.z < rp.z;
86 }
87};
88
90public:
93
95 base::PointF *d_point_cloud,
96 int number_of_points,
97 float resolution_X,
98 float resolution_Y,
99 float resolution_Z,
100 gridParameters &out_rgd_params);
101
102 cudaError_t cudaCalculateGrid(
103 int threads,
104 base::PointF *d_point_cloud,
105 hashElement *d_hashTable,
106 int number_of_points,
107 gridParameters rgd_params,
108 int *count);
109
110 cudaError_t cudaDownSample(
111 int threads,
112 base::PointF *d_point_cloud,
113 bool *d_markers,
114 hashElement *d_hashTable,
115 voxel *d_voxel,
116 int number_of_points,
117 gridParameters rgd_params,
118 bool use_centroid_downsample,
119 int *count);
120
121 cudaError_t cudaWarmUpGPU();
122};
123
124} // namespace lidar
125} // namespace perception
126} // namespace apollo
cudaError_t cudaCalculateGridParams(base::PointF *d_point_cloud, int number_of_points, float resolution_X, float resolution_Y, float resolution_Z, gridParameters &out_rgd_params)
cudaError_t cudaCalculateGrid(int threads, base::PointF *d_point_cloud, hashElement *d_hashTable, int number_of_points, gridParameters rgd_params, int *count)
cudaError_t cudaDownSample(int threads, base::PointF *d_point_cloud, bool *d_markers, hashElement *d_hashTable, voxel *d_voxel, int number_of_points, gridParameters rgd_params, bool use_centroid_downsample, int *count)
class register implement
Definition arena_queue.h:37
__host__ __device__ bool operator()(hashElement l, hashElement r)
__host__ __device__ bool operator()(base::PointF lp, base::PointF rp)
__host__ __device__ bool operator()(base::PointF lp, base::PointF rp)
__host__ __device__ bool operator()(base::PointF lp, base::PointF rp)