Apollo 11.0
自动驾驶开放平台
lateral_qp_optimizer.cc
浏览该文件的文档.
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
18
19#include "cyber/common/log.h"
20
21namespace apollo {
22namespace planning {
23
25 ACHECK(!opt_d_.empty() && !opt_d_prime_.empty() && !opt_d_pprime_.empty());
26
27 PiecewiseJerkTrajectory1d optimal_trajectory(
28 opt_d_.front(), opt_d_prime_.front(), opt_d_pprime_.front());
29
30 for (size_t i = 1; i < opt_d_.size(); ++i) {
31 double j = (opt_d_pprime_[i] - opt_d_pprime_[i - 1]) / delta_s_;
32 optimal_trajectory.AppendSegment(j, delta_s_);
33 }
34 return optimal_trajectory;
35}
36
37std::vector<common::FrenetFramePoint> LateralQPOptimizer::GetFrenetFramePath()
38 const {
39 std::vector<common::FrenetFramePoint> frenet_frame_path;
40 double accumulated_s = 0.0;
41 for (size_t i = 0; i < opt_d_.size(); ++i) {
42 common::FrenetFramePoint frenet_frame_point;
43 frenet_frame_point.set_s(accumulated_s);
44 frenet_frame_point.set_l(opt_d_[i]);
45 frenet_frame_point.set_dl(opt_d_prime_[i]);
46 frenet_frame_point.set_ddl(opt_d_pprime_[i]);
47 frenet_frame_path.push_back(std::move(frenet_frame_point));
48 accumulated_s += delta_s_;
49 }
50 return frenet_frame_path;
51}
52
53} // namespace planning
54} // namespace apollo
virtual PiecewiseJerkTrajectory1d GetOptimalTrajectory() const
virtual std::vector< common::FrenetFramePoint > GetFrenetFramePath() const
void AppendSegment(const double jerk, const double param)
Planning module main class.
#define ACHECK(cond)
Definition log.h:80
class register implement
Definition arena_queue.h:37