Apollo  6.0
Open source self driving car software
st_graph_point.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2017 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 /*
18  * @file: st_graph_point.h
19  */
20 
21 #pragma once
22 
23 #include <limits>
24 
26 
27 namespace apollo {
28 namespace planning {
29 
30 class StGraphPoint {
31  public:
32  std::uint32_t index_s() const;
33  std::uint32_t index_t() const;
34 
35  const STPoint& point() const;
36  const StGraphPoint* pre_point() const;
37 
38  double reference_cost() const;
39  double obstacle_cost() const;
40  double spatial_potential_cost() const;
41  double total_cost() const;
42 
43  void Init(const std::uint32_t index_t, const std::uint32_t index_s,
44  const STPoint& st_point);
45 
46  // given reference speed profile, reach the cost, including position
47  void SetReferenceCost(const double reference_cost);
48 
49  // given obstacle info, get the cost;
50  void SetObstacleCost(const double obs_cost);
51 
52  // given potential cost for minimal time traversal
53  void SetSpatialPotentialCost(const double spatial_potential_cost);
54 
55  // total cost
56  void SetTotalCost(const double total_cost);
57 
58  void SetPrePoint(const StGraphPoint& pre_point);
59 
60  double GetOptimalSpeed() const;
61 
62  void SetOptimalSpeed(const double optimal_speed);
63 
64  private:
65  STPoint point_;
66  const StGraphPoint* pre_point_ = nullptr;
67  std::uint32_t index_s_ = 0;
68  std::uint32_t index_t_ = 0;
69 
70  double optimal_speed_ = 0.0;
71  double reference_cost_ = 0.0;
72  double obstacle_cost_ = 0.0;
73  double spatial_potential_cost_ = 0.0;
74  double total_cost_ = std::numeric_limits<double>::infinity();
75 };
76 
77 } // namespace planning
78 } // namespace apollo
const STPoint & point() const
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
void SetPrePoint(const StGraphPoint &pre_point)
void SetTotalCost(const double total_cost)
Planning module main class. It processes GPS and IMU as input, to generate planning info...
void SetReferenceCost(const double reference_cost)
Definition: st_graph_point.h:30
void SetSpatialPotentialCost(const double spatial_potential_cost)
double spatial_potential_cost() const
Definition: st_point.h:30
const StGraphPoint * pre_point() const
void SetOptimalSpeed(const double optimal_speed)
std::uint32_t index_s() const
void SetObstacleCost(const double obs_cost)
void Init(const std::uint32_t index_t, const std::uint32_t index_s, const STPoint &st_point)
std::uint32_t index_t() const