path_obstacle.h 2.5 KB
Newer Older
D
Dong Li 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
/******************************************************************************
 * Copyright 2017 The Apollo Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *****************************************************************************/

/**
 * @file
 **/

#ifndef MODULES_PLANNING_COMMON_PATH_OBSTACLE_H_
#define MODULES_PLANNING_COMMON_PATH_OBSTACLE_H_

#include <list>
#include <vector>

#include "modules/perception/proto/perception_obstacle.pb.h"
#include "modules/planning/proto/decision.pb.h"
#include "modules/prediction/proto/prediction_obstacle.pb.h"

#include "modules/common/math/box2d.h"
#include "modules/common/math/vec2d.h"
#include "modules/planning/common/obstacle.h"
#include "modules/planning/reference_line/reference_line.h"

namespace apollo {
namespace planning {

/**
 * @class PathObstacle
 * @brief This is the class that associates an Obstacle with its path
 * properties. An obstacle's path properties relative to a path.
 * The `s` and `l` values are examples of path properties.
 * The decision of an obstacle is also associated with a path.
 */
class PathObstacle {
 public:
  PathObstacle() = default;

  PathObstacle(const planning::Obstacle* obstacle,
               const ReferenceLine* reference_line);

  const std::string& Id() const;

  const planning::Obstacle* Obstacle() const;

D
Dong Li 已提交
57 58 59 60 61 62 63
  /**
   * @class add decision to this obstacle.
   * @param decider_tag identifies which component added this decision
   * @param the decision to be added to this path obstacle.
   */
  void AddDecision(const std::string& decider_tag,
                   const ObjectDecisionType& decision);
D
Dong Li 已提交
64 65 66

  const std::vector<ObjectDecisionType>& Decisions() const;

D
Dong Li 已提交
67 68
  const std::string DebugString() const;

D
Dong Li 已提交
69 70 71 72 73 74
 private:
  bool Init(const ReferenceLine* reference_line);

  std::string id_;
  const planning::Obstacle* obstacle_ = nullptr;
  std::vector<ObjectDecisionType> decisions_;
D
Dong Li 已提交
75
  std::vector<std::string> decider_tags_;
D
Dong Li 已提交
76 77 78 79 80 81
};

}  // namespace planning
}  // namespace apollo

#endif  // MODULES_PLANNING_COMMON_PATH_OBSTACLE_H_