Apollo 11.0
自动驾驶开放平台
piecewise_jerk_speed_problem.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 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 <utility>
24#include <vector>
25
27
28namespace apollo {
29namespace planning {
30
31/*
32 * @brief:
33 * This class solve the path time optimization problem:
34 * s
35 * |
36 * | P(t1, s1) P(t2, s2)
37 * | P(t0, s0) ... P(t(k-1), s(k-1))
38 * |P(start)
39 * |
40 * |________________________________________________________ t
41 *
42 * we suppose t(k+1) - t(k) == t(k) - t(k-1)
43 *
44 * Given the s, s', s'' at P(start), The goal is to find t0, t1, ... t(k-1)
45 * which makes the line P(start), P0, P(1) ... P(k-1) "smooth".
46 */
47
49 public:
50 PiecewiseJerkSpeedProblem(const size_t num_of_knots, const double delta_s,
51 const std::array<double, 3>& x_init);
52
53 virtual ~PiecewiseJerkSpeedProblem() = default;
54
55 void set_dx_ref(const double weight_dx_ref, const double dx_ref);
56
57 void set_dx_ref(const std::vector<double>& weight_dx_ref,
58 const std::vector<double>& dx_ref);
59
60 void set_penalty_dx(std::vector<double> penalty_dx);
61
62 protected:
63 // naming convention follows osqp solver.
64 void CalculateKernel(std::vector<c_float>* P_data,
65 std::vector<c_int>* P_indices,
66 std::vector<c_int>* P_indptr) override;
67
68 void CalculateOffset(std::vector<c_float>* q) override;
69
70 OSQPSettings* SolverDefaultSettings() override;
71
72 bool has_dx_ref_ = false;
73 std::vector<double> dx_ref_;
74 std::vector<double> weight_dx_ref_;
75 std::vector<double> penalty_dx_;
76};
77
78} // namespace planning
79} // namespace apollo
void set_dx_ref(const double weight_dx_ref, const double dx_ref)
void set_penalty_dx(std::vector< double > penalty_dx)
void CalculateOffset(std::vector< c_float > *q) override
void CalculateKernel(std::vector< c_float > *P_data, std::vector< c_int > *P_indices, std::vector< c_int > *P_indptr) override
Planning module main class.
class register implement
Definition arena_queue.h:37