obstacle.cc 2.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/******************************************************************************
 * 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 obstacle.cc
 **/

#include "modules/planning/common/obstacle.h"

J
jiangyifei 已提交
23
#include <sstream>
24 25 26 27 28

namespace apollo {
namespace planning {

int Obstacle::Id() const {
J
jiangyifei 已提交
29
  return id_;
30 31 32
}

void Obstacle::SetId(int id) {
J
jiangyifei 已提交
33
  id_ = id;
34 35 36
}

double Obstacle::Height() const {
J
jiangyifei 已提交
37
  return height_;
38 39 40
}

void Obstacle::SetHeight(const double height) {
J
jiangyifei 已提交
41
  height_ = height;
42 43 44
}

double Obstacle::Width() const {
J
jiangyifei 已提交
45
  return width_;
46 47 48
}

void Obstacle::SetWidth(const double width) {
J
jiangyifei 已提交
49
  width_ = width;
50 51 52
}

double Obstacle::Length() const {
J
jiangyifei 已提交
53
  return length_;
54 55 56
}

void Obstacle::SetLength(const double length) {
J
jiangyifei 已提交
57
  length_ = length;
58 59 60
}

double Obstacle::Heading() const {
J
jiangyifei 已提交
61
  return heading_;
62 63 64
}

void Obstacle::SetHeading(const double heading) {
J
jiangyifei 已提交
65
  heading_ = heading;
66 67 68
}

::apollo::common::math::Box2d Obstacle::BoundingBox() const {
J
jiangyifei 已提交
69
  return ::apollo::common::math::Box2d(center_, heading_, length_, width_);
70 71
}

J
jiangyifei 已提交
72 73
const Obstacle::ObstacleType &Obstacle::Type() const {
  return type_;
74 75
}

J
jiangyifei 已提交
76 77
void Obstacle::SetType(const ObstacleType &type) {
  type_ = type;
78 79
}

J
jiangyifei 已提交
80
const std::vector<PredictionTrajectory> &
81
Obstacle::prediction_trajectories() const {
J
jiangyifei 已提交
82
  return prediction_trajectories_;
83 84 85
}

void Obstacle::add_prediction_trajectory(
J
jiangyifei 已提交
86 87
    const PredictionTrajectory &prediction_trajectory) {
  prediction_trajectories_.push_back(prediction_trajectory);
88 89
}

J
jiangyifei 已提交
90 91
std::vector<PredictionTrajectory> *Obstacle::mutable_prediction_trajectories() {
  return &prediction_trajectories_;
92 93
}

J
jiangyifei 已提交
94 95
}  // namespace planning
}  // namespace apollo