Apollo  6.0
Open source self driving car software
osqp_spline_2d_solver.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 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 "gtest/gtest_prod.h"
28 #include "osqp/osqp.h"
29 
30 namespace apollo {
31 namespace planning {
32 
33 class OsqpSpline2dSolver final : public Spline2dSolver {
34  public:
35  OsqpSpline2dSolver(const std::vector<double>& t_knots, const uint32_t order);
36 
37  void Reset(const std::vector<double>& t_knots, const uint32_t order) override;
38 
39  // customize setup
41  Spline2dKernel* mutable_kernel() override;
42  Spline2d* mutable_spline() override;
43 
44  // solve
45  bool Solve() override;
46 
47  // extract
48  const Spline2d& spline() const override;
49 
50  private:
51  FRIEND_TEST(OSQPSolverTest, basic_test);
52 
53  private:
54  OSQPSettings* osqp_settings_ = nullptr;
55  OSQPWorkspace* work_ = nullptr; // Workspace
56  OSQPData* data_ = nullptr; // OSQPData
57 
58  int last_num_constraint_ = 0;
59  int last_num_param_ = 0;
60  bool last_problem_success_ = false;
61 };
62 
63 } // namespace planning
64 } // namespace apollo
: piecewise smoothing spline 2d class
Spline2dKernel * mutable_kernel() override
void Reset(const std::vector< double > &t_knots, const uint32_t order) override
Definition: spline_2d.h:34
OsqpSpline2dSolver(const std::vector< double > &t_knots, const uint32_t order)
Spline2d * mutable_spline() override
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Planning module main class. It processes GPS and IMU as input, to generate planning info...
Spline2dConstraint * mutable_constraint() override
Definition: spline_2d_constraint.h:33
const Spline2d & spline() const override
Definition: osqp_spline_2d_solver.h:33
Definition: spline_2d_kernel.h:32
Definition: spline_2d_solver.h:33