Apollo 11.0
自动驾驶开放平台
constant_jerk_trajectory1d.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
22
23#include "cyber/common/log.h"
25
26namespace apollo {
27namespace planning {
28
30 const double v0,
31 const double a0,
32 const double j,
33 const double param)
34 : p0_(p0), v0_(v0), a0_(a0), param_(param), jerk_(j) {
35 CHECK_GT(param, FLAGS_numerical_epsilon);
36 p1_ = Evaluate(0, param_);
37 v1_ = Evaluate(1, param_);
38 a1_ = Evaluate(2, param_);
39}
40
41double ConstantJerkTrajectory1d::Evaluate(const std::uint32_t order,
42 const double param) const {
43 switch (order) {
44 case 0: {
45 return p0_ + v0_ * param + 0.5 * a0_ * param * param +
46 jerk_ * param * param * param / 6.0;
47 }
48 case 1: {
49 return v0_ + a0_ * param + 0.5 * jerk_ * param * param;
50 }
51 case 2: {
52 return a0_ + jerk_ * param;
53 }
54 case 3: {
55 return jerk_;
56 }
57 default:
58 return 0.0;
59 }
60}
61
62double ConstantJerkTrajectory1d::start_position() const { return p0_; }
63
64double ConstantJerkTrajectory1d::start_velocity() const { return v0_; }
65
67
68double ConstantJerkTrajectory1d::end_position() const { return p1_; }
69
70double ConstantJerkTrajectory1d::end_velocity() const { return v1_; }
71
72double ConstantJerkTrajectory1d::end_acceleration() const { return a1_; }
73
74double ConstantJerkTrajectory1d::ParamLength() const { return param_; }
75
76std::string ConstantJerkTrajectory1d::ToString() const { return ""; }
77
78double ConstantJerkTrajectory1d::jerk() const { return jerk_; }
79
80} // namespace planning
81} // namespace apollo
ConstantJerkTrajectory1d(const double p0, const double v0, const double a0, const double jerk, const double param)
double Evaluate(const std::uint32_t order, const double param) const
Planning module main class.
class register implement
Definition arena_queue.h:37