Apollo 11.0
自动驾驶开放平台
util.cc
浏览该文件的文档.
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
19
20namespace apollo {
21namespace perception {
22namespace lidar {
23
25 double frame_timestamp, const Eigen::Vector3d& local_to_global_offset,
26 Eigen::Affine3d& lidar2world_pose, Eigen::Affine3d& lidar2novatel_pose) {
27 TrackedObjectConstPtr latest_object = track_data->GetLatestObject().second;
28 if (!FLAGS_need_reserve_blind_cone || latest_object == nullptr) {
29 return false;
30 }
31 // reserve condition: TrafficCone
32 // reserve condition: static
33 // reserve condition: within reserve time
34 double time_diff = frame_timestamp - track_data->GetLatestObject().first;
35 if (latest_object->output_velocity.head<2>().norm() > 0.01 ||
36 latest_object->object_ptr->sub_type != base::ObjectSubType::TRAFFICCONE
37 || time_diff >= FLAGS_cone_reserve_time) {
38 return false;
39 }
40
41 // reserve condition: front
42 Eigen::Vector3d world_center = Eigen::Vector3d(
43 latest_object->center(0) + local_to_global_offset(0),
44 latest_object->center(1) + local_to_global_offset(1),
45 latest_object->center(2) + local_to_global_offset(2));
46
47 // from world to lidar to imu
48 Eigen::Vector3d lidar_center = Eigen::Vector3d(1, 0, 0);
49 lidar_center = lidar2world_pose.inverse() * world_center;
50
51 Eigen::Vector3d imu_center = Eigen::Vector3d(1, 0, 0);
52 imu_center = lidar2novatel_pose * lidar_center;
53
54 if (imu_center(0) <= FLAGS_cone_x_front &&
55 imu_center(0) >= FLAGS_cone_x_back &&
56 imu_center(1) <= FLAGS_cone_y_front &&
57 imu_center(1) >= FLAGS_cone_y_back) {
58 AINFO << "[JudgeBlindTrafficCone] track_id: " << track_data->track_id_
59 << " loc: (x) " << imu_center(0) << " (y) " << imu_center(1)
60 << " reserve. time_diff: " << time_diff;
61 return true;
62 }
63 return false;
64}
65
66} // namespace lidar
67} // namespace perception
68} // namespace apollo
#define AINFO
Definition log.h:42
std::shared_ptr< const MlfTrackData > MlfTrackDataConstPtr
std::shared_ptr< const TrackedObject > TrackedObjectConstPtr
bool JudgeBlindTrafficCone(const MlfTrackDataConstPtr &track_data, double frame_timestamp, const Eigen::Vector3d &local_to_global_offset, Eigen::Affine3d &lidar2world_pose, Eigen::Affine3d &lidar2novatel_pose)
Definition util.cc:24
class register implement
Definition arena_queue.h:37