Apollo 10.0
自动驾驶开放平台
lidar_point_label.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 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#pragma once
17
18namespace apollo {
19namespace perception {
20namespace lidar {
21
22enum class LidarPointLabel {
23 UNKNOWN = 0,
24 ROI = 1,
25 GROUND = 2,
26 OBJECT = 3,
28}; // enum class LidarPointLabel
29
31 UNKNOWN = 0,
32 IGNORE = 1,
33 GROUND = 2,
34 OBJECT = 3,
35 CURB = 4,
36 VEGETATION = 5,
37 FENCE = 6,
38 NOISE = 7,
39 WALL = 8,
41}; // enum class PointSemanticLabel
42
43enum class PointMotionLabel {
44 UNKNOWN = 0,
45 MOVING = 1,
46 STATIONARY = 2,
48}; // enum class PointMotionLabel
49
50// save semantic label in last four bits
51inline void SetSemanticLabel(PointSemanticLabel label, uint8_t* value) {
52 *value &= 240; // 240: 11110000
53 *value |= static_cast<uint8_t>(label);
54}
55
56inline PointSemanticLabel GetSemanticLabel(uint8_t value) {
57 return static_cast<PointSemanticLabel>(value & 15);
58}
59
60inline bool IsSemanticLabelEqual(PointSemanticLabel label, uint8_t value) {
61 return (value & 15) == static_cast<uint8_t>(label);
62}
63
64// save motion label in first four bits
65inline void SetMotionLabel(PointMotionLabel label, uint8_t* value) {
66 *value &= 15; // 15: 00001111
67 *value = (static_cast<uint8_t>(label) << 4) | (*value);
68}
69
70inline PointMotionLabel GetMotionLabel(uint8_t value) {
71 return static_cast<PointMotionLabel>(value >> 4);
72}
73
74inline bool IsMotionLabelEqual(PointMotionLabel label, uint8_t value) {
75 return (value >> 4) == static_cast<uint8_t>(label);
76}
77
78} // namespace lidar
79} // namespace perception
80} // namespace apollo
PointSemanticLabel GetSemanticLabel(uint8_t value)
bool IsMotionLabelEqual(PointMotionLabel label, uint8_t value)
bool IsSemanticLabelEqual(PointSemanticLabel label, uint8_t value)
void SetMotionLabel(PointMotionLabel label, uint8_t *value)
void SetSemanticLabel(PointSemanticLabel label, uint8_t *value)
PointMotionLabel GetMotionLabel(uint8_t value)
class register implement
Definition arena_queue.h:37