Apollo  6.0
Open source self driving car software
spline_1d_solver.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2017 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 
21 #pragma once
22 
23 #include <vector>
24 
25 #include "Eigen/Core"
30 #include "modules/planning/proto/math/qp_problem.pb.h"
31 
32 namespace apollo {
33 namespace planning {
34 
36  public:
37  Spline1dSolver(const std::vector<double>& x_knots, const uint32_t order)
38  : spline_(x_knots, order),
39  constraint_(x_knots, order),
40  kernel_(x_knots, order) {}
41 
42  virtual ~Spline1dSolver() = default;
43 
44  virtual void Reset(const std::vector<double>& x_knots, const uint32_t order) {
45  spline_ = Spline1d(x_knots, order);
46  constraint_ = Spline1dConstraint(x_knots, order);
47  kernel_ = Spline1dKernel(x_knots, order);
48  }
49 
51  return &constraint_;
52  }
53 
55 
56  virtual bool Solve() = 0;
57 
58  // output
59  virtual const Spline1d& spline() const { return spline_; }
60 
61  // convert qp problem to proto
62  void GenerateProblemProto(QuadraticProgrammingProblem* const qp_proto) const;
63 
64  protected:
65  void ConvertMatrixXdToProto(const Eigen::MatrixXd& matrix,
66  QPMatrix* const proto) const;
67 
68  protected:
72 
74  int last_num_param_ = 0;
75  bool last_problem_success_ = false;
76 };
77 
78 } // namespace planning
79 } // namespace apollo
Definition: spline_1d_solver.h:35
: wrapp up solver constraint interface with direct methods and preset methods
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
int last_num_constraint_
Definition: spline_1d_solver.h:73
Planning module main class. It processes GPS and IMU as input, to generate planning info...
Spline1d spline_
Definition: spline_1d_solver.h:69
virtual void Reset(const std::vector< double > &x_knots, const uint32_t order)
Definition: spline_1d_solver.h:44
Spline1dKernel kernel_
Definition: spline_1d_solver.h:71
Spline1dConstraint constraint_
Definition: spline_1d_solver.h:70
: wrap up solver constraint interface with direct methods and preset methods
Definition: spline_1d_kernel.h:33
void ConvertMatrixXdToProto(const Eigen::MatrixXd &matrix, QPMatrix *const proto) const
: quadratic programming base class
Spline1dSolver(const std::vector< double > &x_knots, const uint32_t order)
Definition: spline_1d_solver.h:37
bool last_problem_success_
Definition: spline_1d_solver.h:75
Definition: spline_1d.h:40
virtual const Spline1d & spline() const
Definition: spline_1d_solver.h:59
virtual Spline1dConstraint * mutable_spline_constraint()
Definition: spline_1d_solver.h:50
Definition: spline_1d_constraint.h:35
virtual Spline1dKernel * mutable_spline_kernel()
Definition: spline_1d_solver.h:54
void GenerateProblemProto(QuadraticProgrammingProblem *const qp_proto) const
: piecewise smoothing spline class
virtual ~Spline1dSolver()=default
int last_num_param_
Definition: spline_1d_solver.h:74