Apollo 10.0
自动驾驶开放平台
ego_info.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
21#pragma once
22
23#include <vector>
24
25#include "modules/common/vehicle_state/proto/vehicle_state.pb.h"
26#include "modules/common_msgs/config_msgs/vehicle_config.pb.h"
27#include "modules/common_msgs/routing_msgs/geometry.pb.h"
28
29#include "cyber/common/macros.h"
34
35namespace apollo {
36namespace planning {
37
38class EgoInfo {
39 public:
40 EgoInfo();
41
42 ~EgoInfo() = default;
43
46
47 void Clear();
48
49 common::TrajectoryPoint start_point() const { return start_point_; }
50
51 common::VehicleState vehicle_state() const { return vehicle_state_; }
52
53 double front_clear_distance() const { return front_clear_distance_; }
54
55 common::math::Box2d ego_box() const { return ego_box_; }
56
58 const std::vector<const Obstacle*>& obstacles);
59
61 const ReferenceLineProvider* reference_line_provider);
62
63 private:
64 FRIEND_TEST(EgoInfoTest, EgoInfoSimpleTest);
65
66 void set_vehicle_state(const common::VehicleState& vehicle_state) {
67 vehicle_state_ = vehicle_state;
68 }
69
70 void set_start_point(const common::TrajectoryPoint& start_point) {
71 start_point_ = start_point;
72 const auto& param = ego_vehicle_config_.vehicle_param();
73 start_point_.set_a(
74 std::fmax(std::fmin(start_point_.a(), param.max_acceleration()),
75 param.max_deceleration()));
76 }
77
78 void CalculateEgoBox(const common::VehicleState& vehicle_state);
79
80 // stitched point (at stitching mode)
81 // or real vehicle point (at non-stitching mode)
82 common::TrajectoryPoint start_point_;
83
84 // ego vehicle state
85 common::VehicleState vehicle_state_;
86
87 double front_clear_distance_ = FLAGS_default_front_clear_distance;
88
89 common::VehicleConfig ego_vehicle_config_;
90
91 common::math::Box2d ego_box_;
92
93 apollo::hdmap::LaneWaypoint adc_waypoint_;
94 double distance_to_destination_ = 0;
95};
96
97} // namespace planning
98} // namespace apollo
Rectangular (undirected) bounding box in 2-D.
Definition box2d.h:52
bool Update(const common::TrajectoryPoint &start_point, const common::VehicleState &vehicle_state)
Definition ego_info.cc:36
common::VehicleState vehicle_state() const
Definition ego_info.h:51
void CalculateCurrentRouteInfo(const ReferenceLineProvider *reference_line_provider)
Definition ego_info.cc:107
common::math::Box2d ego_box() const
Definition ego_info.h:55
void CalculateFrontObstacleClearDistance(const std::vector< const Obstacle * > &obstacles)
Definition ego_info.cc:69
common::TrajectoryPoint start_point() const
Definition ego_info.h:49
double front_clear_distance() const
Definition ego_info.h:53
The class of ReferenceLineProvider.
Planning module main class.
class register implement
Definition arena_queue.h:37
Declaration of the class ReferenceLineProvider.
optional VehicleParam vehicle_param