Apollo 11.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#include "modules/common_msgs/routing_msgs/geometry.pb.h"
29
30#include "cyber/common/macros.h"
36
37namespace apollo {
38namespace planning {
39
40class EgoInfo {
41 public:
42 EgoInfo();
43
44 ~EgoInfo() = default;
45
48
49 void Clear();
50
51 common::TrajectoryPoint start_point() const { return start_point_; }
52
53 common::VehicleState vehicle_state() const { return vehicle_state_; }
54
55 double front_clear_distance() const { return front_clear_distance_; }
56
57 common::math::Box2d ego_box() const { return ego_box_; }
58
60 const std::vector<const Obstacle*>& obstacles);
61
63 const ReferenceLineProvider* reference_line_provider);
64
65 double distance_to_destination() const { return distance_to_destination_; }
66
67 apollo::hdmap::LaneWaypoint adc_waypoint() const { return adc_waypoint_; }
68
69 private:
70 FRIEND_TEST(EgoInfoTest, EgoInfoSimpleTest);
71
72 void set_vehicle_state(const common::VehicleState& vehicle_state) {
73 vehicle_state_ = vehicle_state;
74 }
75
76 void set_start_point(const common::TrajectoryPoint& start_point) {
77 start_point_ = start_point;
78 const auto& param = ego_vehicle_config_.vehicle_param();
79 start_point_.set_a(
80 std::fmax(std::fmin(start_point_.a(), param.max_acceleration()),
81 param.max_deceleration()));
82 }
83
84 void CalculateEgoBox(const common::VehicleState& vehicle_state);
85
86 // stitched point (at stitching mode)
87 // or real vehicle point (at non-stitching mode)
88 common::TrajectoryPoint start_point_;
89
90 // ego vehicle state
91 common::VehicleState vehicle_state_;
92
93 double front_clear_distance_ = FLAGS_default_front_clear_distance;
94
95 common::VehicleConfig ego_vehicle_config_;
96
97 common::math::Box2d ego_box_;
98
99 apollo::hdmap::LaneWaypoint adc_waypoint_;
100 double distance_to_destination_ = 0;
101};
102
103} // namespace planning
104} // 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
apollo::hdmap::LaneWaypoint adc_waypoint() const
Definition ego_info.h:67
double distance_to_destination() const
Definition ego_info.h:65
common::VehicleState vehicle_state() const
Definition ego_info.h:53
void CalculateCurrentRouteInfo(const ReferenceLineProvider *reference_line_provider)
Definition ego_info.cc:107
common::math::Box2d ego_box() const
Definition ego_info.h:57
void CalculateFrontObstacleClearDistance(const std::vector< const Obstacle * > &obstacles)
Definition ego_info.cc:69
common::TrajectoryPoint start_point() const
Definition ego_info.h:51
double front_clear_distance() const
Definition ego_info.h:55
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