diff --git a/modules/planning/common/BUILD b/modules/planning/common/BUILD index 532d94dbeb7f3323e7fae7e32d78fe156351d58f..54a2988457813369b2d7a5250a37dd555a33c602 100644 --- a/modules/planning/common/BUILD +++ b/modules/planning/common/BUILD @@ -50,6 +50,7 @@ cc_library( deps = [ "//modules/common/math:box2d", "//modules/planning/common:planning_object", + "//modules/planning/common/trajectory:prediction_trajectory", ], ) @@ -127,13 +128,12 @@ cc_library( "frame.h", ], deps = [ - "//modules/planning/common:planning_data", - "//modules/planning/common:environment", "//modules/common:log", + "//modules/planning/common:environment", + "//modules/planning/common:planning_data", ], ) - cc_library( name = "speed_limit", srcs = [ @@ -161,8 +161,8 @@ cc_library( ":frame", ":planning_data", ":planning_gflags", - "//modules/common/status", "//modules/common", + "//modules/common/status", "//modules/planning/state_machine:master_state_machine", ], ) @@ -171,8 +171,8 @@ cc_library( name = "planning_common", deps = [ "@eigen//:eigen", - ":frame", ":data_center", + ":frame", ":planning_gflags", ":speed_limit", "//modules/common:log", diff --git a/modules/planning/common/map_object.cc b/modules/planning/common/map_object.cc index 623575620f21035ed91a788eb25ac71bdd21a3c1..05e213d4debcc7a8b221c2e35dc0b2d7530edebc 100644 --- a/modules/planning/common/map_object.cc +++ b/modules/planning/common/map_object.cc @@ -24,7 +24,7 @@ namespace apollo { namespace planning { std::string MapObject::Id() const { - return id_; + return id_; } } // namespace planning diff --git a/modules/planning/common/map_object.h b/modules/planning/common/map_object.h index edad9f2c928c961fed0abc0e1f3dd10e4885d661..6aa770839c5276eb9dc0a089e46876d93869eac0 100644 --- a/modules/planning/common/map_object.h +++ b/modules/planning/common/map_object.h @@ -27,12 +27,12 @@ namespace apollo { namespace planning { class MapObject : public PlanningObject { -public: - MapObject() = default; - std::string Id() const; + public: + MapObject() = default; + std::string Id() const; -private: - std::string id_; + private: + std::string id_; }; } // namespace planning diff --git a/modules/planning/common/obstacle.cc b/modules/planning/common/obstacle.cc index 5ce9db9d28f6c6dd32b73af8af05ec2d3996c3ed..6f89d6779d7bef9289a704f6dccf4a13fe5b8412 100644 --- a/modules/planning/common/obstacle.cc +++ b/modules/planning/common/obstacle.cc @@ -20,86 +20,76 @@ #include "modules/planning/common/obstacle.h" -//#include +#include namespace apollo { namespace planning { - int Obstacle::Id() const { - return id_; + return id_; } void Obstacle::SetId(int id) { - id_ = id; + id_ = id; } double Obstacle::Height() const { - return height_; + return height_; } void Obstacle::SetHeight(const double height) { - height_ = height; + height_ = height; } double Obstacle::Width() const { - return width_; + return width_; } void Obstacle::SetWidth(const double width) { - width_ = width; + width_ = width; } double Obstacle::Length() const { - return length_; + return length_; } void Obstacle::SetLength(const double length) { - length_ = length; + length_ = length; } double Obstacle::Heading() const { - return heading_; + return heading_; } void Obstacle::SetHeading(const double heading) { - heading_ = heading; + heading_ = heading; } ::apollo::common::math::Box2d Obstacle::BoundingBox() const { - return ::apollo::common::math::Box2d(center_, heading_, length_, width_); + return ::apollo::common::math::Box2d(center_, heading_, length_, width_); } -const Obstacle::ObstacleType& Obstacle::Type() const { - return type_; +const Obstacle::ObstacleType &Obstacle::Type() const { + return type_; } -void Obstacle::SetType(const ObstacleType& type) { - type_ = type; +void Obstacle::SetType(const ObstacleType &type) { + type_ = type; } -// TODO: to be added -/* -const std::vector& +const std::vector & Obstacle::prediction_trajectories() const { - return _prediction_trajectories; + return prediction_trajectories_; } -*/ -// TODO: to be added -/* void Obstacle::add_prediction_trajectory( - const PredictionTrajectory& prediction_trajectory) { - _prediction_trajectories.push_back(prediction_trajectory); + const PredictionTrajectory &prediction_trajectory) { + prediction_trajectories_.push_back(prediction_trajectory); } -*/ -// TODO: to be added -/* -std::vector* Obstacle::mutable_prediction_trajectories() { - return &_prediction_trajectories; +std::vector *Obstacle::mutable_prediction_trajectories() { + return &prediction_trajectories_; } -*/ -} // namespace planning -} // namespace apollo +} // namespace planning +} // namespace apollo diff --git a/modules/planning/common/obstacle.h b/modules/planning/common/obstacle.h index da31412d53d231ba40d7c70fa7d167a425723149..4b5c142b2f0ca9c9972be50775db33430a6ea6f5 100644 --- a/modules/planning/common/obstacle.h +++ b/modules/planning/common/obstacle.h @@ -26,64 +26,62 @@ #include #include "modules/common/math/box2d.h" -//#include "common/trajectory/prediction_trajectory.h" +#include "modules/planning/common/trajectory/prediction_trajectory.h" namespace apollo { namespace planning { class Obstacle : public PlanningObject { -public: - enum class ObstacleType { - UNKNOWN = 0, - UNKNOWN_MOVABLE = 1, - UNKNOWN_UNMOVABLE = 2, - PEDESTRIAN = 3, - BICYCLE = 4, - VEHICLE = 5, - }; - - Obstacle() = default; - - int Id() const; - void SetId(int id); - - const ObstacleType& Type() const; - void SetType(const ObstacleType& type); - - double Height() const; - void SetHeight(const double height); - - double Width() const; - void SetWidth(const double width); - - double Length() const; - void SetLength(const double length); - - double Heading() const; - void SetHeading(const double heading); - - ::apollo::common::math::Box2d BoundingBox() const; - - // TODO: to be added - //const std::vector& prediction_trajectories() const; - //void add_prediction_trajectory( - // const PredictionTrajectory& prediction_trajectory); - //std::vector* mutable_prediction_trajectories(); - -private: - int id_ = 0; - double height_ = 0.0; - double width_ = 0.0; - double length_ = 0.0; - double heading_ = 0.0; - - ::apollo::common::math::Vec2d center_; - // TODO: to be added - //std::vector prediction_trajectories_; - ObstacleType type_ = ObstacleType::VEHICLE; + public: + enum class ObstacleType { + UNKNOWN = 0, + UNKNOWN_MOVABLE = 1, + UNKNOWN_UNMOVABLE = 2, + PEDESTRIAN = 3, + BICYCLE = 4, + VEHICLE = 5, + }; + + Obstacle() = default; + + int Id() const; + void SetId(int id); + + const ObstacleType &Type() const; + void SetType(const ObstacleType &type); + + double Height() const; + void SetHeight(const double height); + + double Width() const; + void SetWidth(const double width); + + double Length() const; + void SetLength(const double length); + + double Heading() const; + void SetHeading(const double heading); + + ::apollo::common::math::Box2d BoundingBox() const; + + const std::vector &prediction_trajectories() const; + void add_prediction_trajectory( + const PredictionTrajectory &prediction_trajectory); + std::vector *mutable_prediction_trajectories(); + + private: + int id_ = 0; + double height_ = 0.0; + double width_ = 0.0; + double length_ = 0.0; + double heading_ = 0.0; + + ::apollo::common::math::Vec2d center_; + std::vector prediction_trajectories_; + ObstacleType type_ = ObstacleType::VEHICLE; }; -} // namespace planning -} // namespace apollo +} // namespace planning +} // namespace apollo -#endif // MODULES_PLANNING_COMMON_OBSTACLE_H +#endif // MODULES_PLANNING_COMMON_OBSTACLE_H