Apollo 11.0
自动驾驶开放平台
apollo::planning::CosThetaSmoother类 参考

#include <cos_theta_smoother.h>

apollo::planning::CosThetaSmoother 的协作图:

Public 成员函数

 CosThetaSmoother (const CosThetaSmootherConfig &config)
 
bool Solve (const std::vector< std::pair< double, double > > &raw_point2d, const std::vector< double > &bounds, std::vector< double > *opt_x, std::vector< double > *opt_y)
 

详细描述

在文件 cos_theta_smoother.h 第 26 行定义.

构造及析构函数说明

◆ CosThetaSmoother()

apollo::planning::CosThetaSmoother::CosThetaSmoother ( const CosThetaSmootherConfig &  config)
explicit

在文件 cos_theta_smoother.cc 第 27 行定义.

28 : config_(config) {}

成员函数说明

◆ Solve()

bool apollo::planning::CosThetaSmoother::Solve ( const std::vector< std::pair< double, double > > &  raw_point2d,
const std::vector< double > &  bounds,
std::vector< double > *  opt_x,
std::vector< double > *  opt_y 
)

在文件 cos_theta_smoother.cc 第 30 行定义.

33 {
34 const double weight_cos_included_angle = config_.weight_cos_included_angle();
35 const double weight_anchor_points = config_.weight_anchor_points();
36 const double weight_length = config_.weight_length();
37 const size_t print_level = config_.print_level();
38 const size_t max_num_of_iterations = config_.max_num_of_iterations();
39 const size_t acceptable_num_of_iterations =
41 const double tol = config_.tol();
42 const double acceptable_tol = config_.acceptable_tol();
43 const bool use_automatic_differentiation =
45
46 CosThetaIpoptInterface* smoother =
47 new CosThetaIpoptInterface(raw_point2d, bounds);
48
49 smoother->set_weight_cos_included_angle(weight_cos_included_angle);
50 smoother->set_weight_anchor_points(weight_anchor_points);
51 smoother->set_weight_length(weight_length);
52 smoother->set_automatic_differentiation_flag(use_automatic_differentiation);
53
54 Ipopt::SmartPtr<Ipopt::TNLP> problem = smoother;
55
56 // Create an instance of the IpoptApplication
57 Ipopt::SmartPtr<Ipopt::IpoptApplication> app = IpoptApplicationFactory();
58
59 app->Options()->SetIntegerValue("print_level", static_cast<int>(print_level));
60 app->Options()->SetIntegerValue("max_iter",
61 static_cast<int>(max_num_of_iterations));
62 app->Options()->SetIntegerValue(
63 "acceptable_iter", static_cast<int>(acceptable_num_of_iterations));
64 app->Options()->SetNumericValue("tol", tol);
65 app->Options()->SetNumericValue("acceptable_tol", acceptable_tol);
66
67 Ipopt::ApplicationReturnStatus status = app->Initialize();
68 if (status != Ipopt::Solve_Succeeded) {
69 AERROR << "*** Error during initialization!";
70 return false;
71 }
72
73 status = app->OptimizeTNLP(problem);
74
75 if (status == Ipopt::Solve_Succeeded ||
76 status == Ipopt::Solved_To_Acceptable_Level) {
77 // Retrieve some statistics about the solve
78 Ipopt::Index iter_count = app->Statistics()->IterationCount();
79 ADEBUG << "*** The problem solved in " << iter_count << " iterations!";
80 } else {
81 AERROR << "Solver fails with return code: " << static_cast<int>(status);
82 return false;
83 }
84 smoother->get_optimization_results(opt_x, opt_y);
85 return true;
86}
#define ADEBUG
Definition log.h:41
#define AERROR
Definition log.h:44

该类的文档由以下文件生成: