From 77f4a4495c05df9ad78ed0dc0dcc16b0de83f5bb Mon Sep 17 00:00:00 2001 From: Zhang Liangliang Date: Thu, 14 Sep 2017 15:40:22 -0700 Subject: [PATCH] ALL: fixed all lint errors. --- .../obstacle/common/file_system_util.cc | 2 +- .../tasks/dp_poly_path/trajectory_cost.cc | 47 +++++++++---------- .../tasks/dp_poly_path/trajectory_cost.h | 10 ++-- .../qp_spline_st_speed/qp_spline_st_graph.h | 1 + .../qp_spline_st_speed_optimizer.cc | 1 + .../container/pose/pose_container_test.cc | 2 +- modules/routing/common/routing_gflags.cc | 2 +- 7 files changed, 33 insertions(+), 32 deletions(-) diff --git a/modules/perception/obstacle/common/file_system_util.cc b/modules/perception/obstacle/common/file_system_util.cc index 7ff1a31f84..963bb5d7f4 100644 --- a/modules/perception/obstacle/common/file_system_util.cc +++ b/modules/perception/obstacle/common/file_system_util.cc @@ -18,7 +18,7 @@ #include -#include +#include "boost/filesystem.hpp" namespace apollo { namespace perception { diff --git a/modules/planning/tasks/dp_poly_path/trajectory_cost.cc b/modules/planning/tasks/dp_poly_path/trajectory_cost.cc index bfceda72be..f048ca4eca 100644 --- a/modules/planning/tasks/dp_poly_path/trajectory_cost.cc +++ b/modules/planning/tasks/dp_poly_path/trajectory_cost.cc @@ -15,7 +15,7 @@ *****************************************************************************/ /** - * @file trjactory_cost.h + * @file **/ #include "modules/planning/tasks/dp_poly_path/trajectory_cost.h" @@ -35,15 +35,14 @@ using apollo::common::math::Vec2d; using apollo::common::TrajectoryPoint; TrajectoryCost::TrajectoryCost( - const DpPolyPathConfig &config, - const ReferenceLine &reference_line, - const std::vector& obstacles, + const DpPolyPathConfig &config, const ReferenceLine &reference_line, + const std::vector &obstacles, const common::VehicleParam &vehicle_param, - const SpeedData &heuristic_speed_data) : - config_(config), - reference_line_(&reference_line), - vehicle_param_(vehicle_param), - heuristic_speed_data_(heuristic_speed_data) { + const SpeedData &heuristic_speed_data) + : config_(config), + reference_line_(&reference_line), + vehicle_param_(vehicle_param), + heuristic_speed_data_(heuristic_speed_data) { const double total_time = std::min(heuristic_speed_data_.TotalTime(), FLAGS_prediction_total_time); @@ -56,13 +55,13 @@ TrajectoryCost::TrajectoryCost( } const auto ptr_obstacle = ptr_path_obstacle->obstacle(); if (ptr_obstacle->PerceptionId() < 0) { - //Virtual obsatcle + // Virtual obsatcle continue; } std::vector box_by_time; for (uint32_t t = 0; t <= num_of_time_stamps_; ++t) { TrajectoryPoint trajectory_point = - ptr_obstacle->GetPointAtTime(t * config.eval_time_interval()); + ptr_obstacle->GetPointAtTime(t * config.eval_time_interval()); Box2d obs_box = ptr_obstacle->GetBoundingBox(trajectory_point); box_by_time.push_back(obs_box); } @@ -77,15 +76,15 @@ double TrajectoryCost::Calculate(const QuinticPolynomialCurve1d &curve, // path_cost double path_s = 0.0; while (path_s < (end_s - start_s)) { - double l = std::fabs(curve.Evaluate(0, path_s)); + const double l = std::fabs(curve.Evaluate(0, path_s)); total_cost += l; - double dl = std::fabs(curve.Evaluate(1, path_s)); + const double dl = std::fabs(curve.Evaluate(1, path_s)); total_cost += dl; path_s += config_.path_resolution(); } - + // obstacle cost uint32_t start_index = 0; bool is_found_start_index = false; @@ -109,24 +108,24 @@ double TrajectoryCost::Calculate(const QuinticPolynomialCurve1d &curve, for (; start_index < end_index; ++start_index) { common::SpeedPoint speed_point; heuristic_speed_data_.EvaluateByTime( - start_index * config_.eval_time_interval(), &speed_point); - double s = speed_point.s() - start_s; - double l = curve.Evaluate(0, s); - double dl = curve.Evaluate(1, s); + start_index * config_.eval_time_interval(), &speed_point); + const double s = speed_point.s() - start_s; + const double l = curve.Evaluate(0, s); + const double dl = curve.Evaluate(1, s); Vec2d ego_xy_point; common::SLPoint sl; sl.set_s(speed_point.s()); sl.set_l(l); reference_line_->SLToXY(sl, &ego_xy_point); - ReferencePoint reference_point = - reference_line_->GetReferencePoint(speed_point.s()); + ReferencePoint reference_point = + reference_line_->GetReferencePoint(speed_point.s()); double one_minus_kappa_r_d = 1 - reference_point.kappa() * l; double delta_theta = std::atan2(dl, one_minus_kappa_r_d); - double theta = common::math::NormalizeAngle( - delta_theta + reference_point.heading()); - Box2d ego_box = {ego_xy_point, theta, - vehicle_param_.length(), vehicle_param_.width()}; + double theta = + common::math::NormalizeAngle(delta_theta + reference_point.heading()); + Box2d ego_box = {ego_xy_point, theta, vehicle_param_.length(), + vehicle_param_.width()}; for (const auto &obstacle_trajectory : obstacle_boxes_) { auto &obstacle_box = obstacle_trajectory[start_index]; double distance = obstacle_box.DistanceTo(ego_box); diff --git a/modules/planning/tasks/dp_poly_path/trajectory_cost.h b/modules/planning/tasks/dp_poly_path/trajectory_cost.h index 20123bd04c..beec072ef1 100644 --- a/modules/planning/tasks/dp_poly_path/trajectory_cost.h +++ b/modules/planning/tasks/dp_poly_path/trajectory_cost.h @@ -18,8 +18,8 @@ * @file trjactory_cost.h **/ -#ifndef MODULES_PLANNING_TASKS_DP_POLY_PATH_TRAJECTORY_COST_H -#define MODULES_PLANNING_TASKS_DP_POLY_PATH_TRAJECTORY_COST_H +#ifndef MODULES_PLANNING_TASKS_DP_POLY_PATH_TRAJECTORY_COST_H_ +#define MODULES_PLANNING_TASKS_DP_POLY_PATH_TRAJECTORY_COST_H_ #include @@ -40,7 +40,7 @@ class TrajectoryCost { public: explicit TrajectoryCost(const DpPolyPathConfig &config, const ReferenceLine &reference_line, - const std::vector& obstacles, + const std::vector &obstacles, const common::VehicleParam &vehicle_param, const SpeedData &heuristic_speed_data); double Calculate(const QuinticPolynomialCurve1d &curve, const double start_s, @@ -51,7 +51,7 @@ class TrajectoryCost { const ReferenceLine *reference_line_ = nullptr; const common::VehicleParam vehicle_param_; SpeedData heuristic_speed_data_; - uint32_t num_of_time_stamps_; + uint32_t num_of_time_stamps_ = 0; std::vector> obstacle_boxes_; std::vector obstacle_probabilities_; }; @@ -59,4 +59,4 @@ class TrajectoryCost { } // namespace planning } // namespace apollo -#endif // MODULES_PLANNING_TASKS_DP_POLY_PATH_TRAJECTORY_COST_H +#endif // MODULES_PLANNING_TASKS_DP_POLY_PATH_TRAJECTORY_COST_H_ diff --git a/modules/planning/tasks/qp_spline_st_speed/qp_spline_st_graph.h b/modules/planning/tasks/qp_spline_st_speed/qp_spline_st_graph.h index 8afee2f59a..2911434107 100644 --- a/modules/planning/tasks/qp_spline_st_speed/qp_spline_st_graph.h +++ b/modules/planning/tasks/qp_spline_st_speed/qp_spline_st_graph.h @@ -22,6 +22,7 @@ #define MODULES_PLANNING_TASKS_QP_SPLINE_ST_SPEED_QP_SPLINE_ST_GRAPH_H_ #include +#include #include #include "modules/common/configs/proto/vehicle_config.pb.h" diff --git a/modules/planning/tasks/qp_spline_st_speed/qp_spline_st_speed_optimizer.cc b/modules/planning/tasks/qp_spline_st_speed/qp_spline_st_speed_optimizer.cc index 03612e4ae8..e93e5a2087 100644 --- a/modules/planning/tasks/qp_spline_st_speed/qp_spline_st_speed_optimizer.cc +++ b/modules/planning/tasks/qp_spline_st_speed/qp_spline_st_speed_optimizer.cc @@ -21,6 +21,7 @@ #include "modules/planning/tasks/qp_spline_st_speed/qp_spline_st_speed_optimizer.h" #include +#include #include #include "modules/common/proto/pnc_point.pb.h" diff --git a/modules/prediction/container/pose/pose_container_test.cc b/modules/prediction/container/pose/pose_container_test.cc index 0772ec7111..436a5a78d1 100644 --- a/modules/prediction/container/pose/pose_container_test.cc +++ b/modules/prediction/container/pose/pose_container_test.cc @@ -33,7 +33,7 @@ class PoseContainerTest : public ::testing::Test { PoseContainerTest() = default; virtual ~PoseContainerTest() = default; - virtual void SetUp() override {} + void SetUp() override {} protected: void InitPose(LocalizationEstimate *localization); diff --git a/modules/routing/common/routing_gflags.cc b/modules/routing/common/routing_gflags.cc index d652c8749f..9741d1b335 100644 --- a/modules/routing/common/routing_gflags.cc +++ b/modules/routing/common/routing_gflags.cc @@ -28,4 +28,4 @@ DEFINE_bool(use_road_id, true, "enable use road id to cut routing result"); DEFINE_double(min_length_for_lane_change, 10.0, "min length for lane change, in creater, in meter"); DEFINE_bool(enable_change_lane_in_result, false, - "contain change lane operator in result"); \ No newline at end of file + "contain change lane operator in result"); -- GitLab