/****************************************************************************** * Copyright 2018 The Apollo Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *****************************************************************************/ /** * @file **/ #pragma once #include #include #include #include "modules/planning/math/piecewise_jerk/piecewise_jerk_problem.h" namespace apollo { namespace planning { /* * @brief: * FEM stands for finite element method. * This class solve an optimization problem: * x * | * | P(s1, x1) P(s2, x2) * | P(s0, x0) ... P(s(k-1), x(k-1)) * |P(start) * | * |________________________________________________________ s * * we suppose s(k+1) - s(k) == s(k) - s(k-1) * * Given the x, x', x'' at P(start), The goal is to find x0, x1, ... x(k-1) * which makes the line P(start), P0, P(1) ... P(k-1) "smooth". */ class Fem1dQpProblem : public PiecewiseJerkProblem { public: Fem1dQpProblem() = default; virtual ~Fem1dQpProblem() = default; protected: // naming convention follows osqp solver. void CalculateKernel(std::vector* P_data, std::vector* P_indices, std::vector* P_indptr) override; void CalculateOffset(std::vector* q) override; }; } // namespace planning } // namespace apollo