planning_data.h 2.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/******************************************************************************
 * 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.
 *****************************************************************************/

/**
J
Jiangtao Hu 已提交
18
 * @file
19 20 21 22 23
 **/

#ifndef MODULES_PLANNING_COMMON_PLANNING_DATA_H_
#define MODULES_PLANNING_COMMON_PLANNING_DATA_H_

A
Aaron Xiao 已提交
24 25
#include <memory>
#include <string>
26
#include <vector>
A
Aaron Xiao 已提交
27

28
#include "modules/common/proto/path_point.pb.h"
29

30
#include "modules/planning/common/decision_data.h"
31 32
#include "modules/planning/common/path/path_data.h"
#include "modules/planning/common/planning_data.h"
33
#include "modules/planning/common/planning_object.h"
34
#include "modules/planning/common/speed/speed_data.h"
35 36 37
#include "modules/planning/common/trajectory/publishable_trajectory.h"
#include "modules/planning/reference_line/reference_line.h"

38 39 40 41 42 43
namespace apollo {
namespace planning {

class PlanningData {
 public:
  PlanningData() = default;
44 45

  // copy reference line to planning data
46
  void set_reference_line(const std::vector<ReferencePoint>& ref_points);
47
  void set_decision_data(std::shared_ptr<DecisionData>& decision_data);
48 49 50 51 52 53 54 55
  void set_init_planning_point(const TrajectoryPoint& init_planning_point);

  const ReferenceLine& reference_line() const;
  const DecisionData& decision_data() const;
  const TrajectoryPoint& init_planning_point() const;

  DecisionData* mutable_decision_data() const;

56 57 58 59 60 61
  const PathData& path_data() const;
  const SpeedData& speed_data() const;

  PathData* mutable_path_data();
  SpeedData* mutable_speed_data();

62 63
  double timestamp() const;

64
  // aggregate final result together by some configuration
65 66
  bool aggregate(const double time_resolution,
                 PublishableTrajectory* PublishableTrajectory);
67

68 69
  std::string DebugString() const;

70
 protected:
71 72 73 74 75
  std::unique_ptr<ReferenceLine> reference_line_ = nullptr;
  std::shared_ptr<DecisionData> decision_data_ = nullptr;
  TrajectoryPoint init_planning_point_;
  PathData path_data_;
  SpeedData speed_data_;
76
  double timestamp_ = 0.0;
77 78 79 80 81 82
};

}  // namespace planning
}  // namespace apollo

#endif  // MODULES_PLANNING_COMMON_PLANNING_DATA_H_