Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
1122cf96
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1122cf96
编写于
9月 11, 2017
作者:
Z
Zhang Liangliang
提交者:
Dong Li
9月 11, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Planning: added initial definition of piecewise linear constraint.
上级
72a9c3b2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
112 addition
and
71 deletion
+112
-71
modules/planning/math/smoothing_spline/piecewise_linear_constraint.cc
...ning/math/smoothing_spline/piecewise_linear_constraint.cc
+94
-0
modules/planning/math/smoothing_spline/piecewise_linear_constraint.h
...nning/math/smoothing_spline/piecewise_linear_constraint.h
+18
-71
未找到文件。
modules/planning/math/smoothing_spline/piecewise_linear_constraint.cc
0 → 100644
浏览文件 @
1122cf96
/******************************************************************************
* Copyright 2017 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
* @brief: Implementation of PiecewiseLinearConstraint class
**/
#include "modules/planning/math/smoothing_spline/piecewise_linear_constraint.h"
#include <limits>
namespace
apollo
{
namespace
planning
{
PiecewiseLinearConstraint
::
PiecewiseLinearConstraint
(
const
uint32_t
dimension
)
:
dimension_
(
dimension
)
{}
bool
PiecewiseLinearConstraint
::
AddBoundary
(
const
std
::
vector
<
uint32_t
>&
index_list
,
const
std
::
vector
<
double
>&
lower_bound
,
const
std
::
vector
<
double
>&
upper_bound
)
{
// TODO(Liangliang): implement this function
return
true
;
}
bool
PiecewiseLinearConstraint
::
AddDerivativeBoundary
(
const
std
::
vector
<
uint32_t
>&
index_list
,
const
std
::
vector
<
double
>&
lower_bound
,
const
std
::
vector
<
double
>&
upper_bound
)
{
// TODO(Liangliang): implement this function
return
true
;
}
bool
PiecewiseLinearConstraint
::
AddSecondDerivativeBoundary
(
const
std
::
vector
<
uint32_t
>&
index_list
,
const
std
::
vector
<
double
>&
lower_bound
,
const
std
::
vector
<
double
>&
upper_bound
)
{
// TODO(Liangliang): implement this function
return
true
;
}
bool
PiecewiseLinearConstraint
::
AddThirdDerivativeBoundary
(
const
std
::
vector
<
uint32_t
>&
index_list
,
const
std
::
vector
<
double
>&
lower_bound
,
const
std
::
vector
<
double
>&
upper_bound
)
{
// TODO(Liangliang): implement this function
return
true
;
}
bool
PiecewiseLinearConstraint
::
AddPointConstraint
(
const
double
x
,
const
double
fx
)
{
// TODO(Liangliang): implement this function
return
true
;
}
bool
PiecewiseLinearConstraint
::
AddPointDerivativeConstraint
(
const
double
x
,
const
double
dfx
)
{
// TODO(Liangliang): implement this function
return
true
;
}
bool
PiecewiseLinearConstraint
::
AddPointSecondDerivativeConstraint
(
const
double
x
,
const
double
ddfx
)
{
// TODO(Liangliang): implement this function
return
true
;
}
bool
PiecewiseLinearConstraint
::
AddPointThirdDerivativeConstraint
(
const
double
x
,
const
double
dddfx
)
{
// TODO(Liangliang): implement this function
return
true
;
}
bool
PiecewiseLinearConstraint
::
AddMonotoneInequalityConstraint
()
{
// TODO(Liangliang): implement this function
return
true
;
}
}
// namespace planning
}
// namespace apollo
modules/planning/math/smoothing_spline/piecewise_linear_constraint.h
浏览文件 @
1122cf96
...
...
@@ -22,107 +22,54 @@
#ifndef MODULES_PLANNING_MATH_SMOOTHING_SPLINE_PIECEWISE_LINEAR_CONSTRAINT_H_
#define MODULES_PLANNING_MATH_SMOOTHING_SPLINE_PIECEWISE_LINEAR_CONSTRAINT_H_
#include <algorithm>
#include <vector>
#include "Eigen/Core"
#include "modules/planning/math/smoothing_spline/affine_constraint.h"
#include "modules/planning/math/smoothing_spline/spline_1d.h"
#include "Eigen/Core"
namespace
apollo
{
namespace
planning
{
class
Spline1d
Constraint
{
class
PiecewiseLinear
Constraint
{
public:
explicit
Spline1dConstraint
(
const
Spline1d
&
pss
);
Spline1dConstraint
(
const
std
::
vector
<
double
>&
x_knots
,
const
std
::
uint32_t
order
);
PiecewiseLinearConstraint
(
const
uint32_t
dimension
);
virtual
~
PiecewiseLinearConstraint
()
=
default
;
// direct methods
bool
AddInequalityConstraint
(
const
Eigen
::
MatrixXd
&
constraint_matrix
,
const
Eigen
::
MatrixXd
&
constraint_boundary
);
bool
AddEqualityConstraint
(
const
Eigen
::
MatrixXd
&
constraint_matrix
,
const
Eigen
::
MatrixXd
&
constraint_boundary
);
// preset method
/**
* @brief: inequality boundary constraints
* if no boundary, do specify either by std::infinity or let vector.size() =
*0
**/
bool
AddBoundary
(
const
std
::
vector
<
double
>&
x_coord
,
* @brief: inequality boundary constraints
**/
bool
AddBoundary
(
const
std
::
vector
<
uint32_t
>&
index_list
,
const
std
::
vector
<
double
>&
lower_bound
,
const
std
::
vector
<
double
>&
upper_bound
);
bool
AddDerivativeBoundary
(
const
std
::
vector
<
double
>&
x_coord
,
bool
AddDerivativeBoundary
(
const
std
::
vector
<
uint32_t
>&
index_list
,
const
std
::
vector
<
double
>&
lower_bound
,
const
std
::
vector
<
double
>&
upper_bound
);
bool
AddSecondDerivativeBoundary
(
const
std
::
vector
<
double
>&
x_coord
,
bool
AddSecondDerivativeBoundary
(
const
std
::
vector
<
uint32_t
>&
index_list
,
const
std
::
vector
<
double
>&
lower_bound
,
const
std
::
vector
<
double
>&
upper_bound
);
bool
AddThirdDerivativeBoundary
(
const
std
::
vector
<
double
>&
x_coord
,
bool
AddThirdDerivativeBoundary
(
const
std
::
vector
<
uint32_t
>&
index_list
,
const
std
::
vector
<
double
>&
lower_bound
,
const
std
::
vector
<
double
>&
upper_bound
);
/**
* @brief: equality constraint to guarantee joint smoothness
**/
// boundary equality constriant
// constraint on fx, dfx, ddfx ... in vector form; upto third order
* @brief: equality constraints
**/
bool
AddPointConstraint
(
const
double
x
,
const
double
fx
);
bool
AddPointDerivativeConstraint
(
const
double
x
,
const
double
dfx
);
bool
AddPointSecondDerivativeConstraint
(
const
double
x
,
const
double
ddfx
);
bool
AddPointThirdDerivativeConstraint
(
const
double
x
,
const
double
dddfx
);
// guarantee upto values are joint
bool
AddSmoothConstraint
();
// guarantee upto derivative are joint
bool
AddDerivativeSmoothConstraint
();
// guarantee upto second order derivative are joint
bool
AddSecondDerivativeSmoothConstraint
();
// guarantee upto third order derivative are joint
bool
AddThirdDerivativeSmoothConstraint
();
/**
* @brief: Add monotone constraint inequality, guarantee the monotone city at
*evaluated point
**/
// customized monotone inequality constraint at x_coord
bool
AddMonotoneInequalityConstraint
(
const
std
::
vector
<
double
>&
x_coord
);
// default inequality constraint at knots
bool
AddMonotoneInequalityConstraintAtKnots
();
/**
* @brief: output interface inequality constraint
**/
const
AffineConstraint
&
inequality_constraint
()
const
;
const
AffineConstraint
&
equality_constraint
()
const
;
private:
std
::
uint32_t
FindIndex
(
const
double
x
)
const
;
bool
FilterConstraints
(
const
std
::
vector
<
double
>&
x_coord
,
const
std
::
vector
<
double
>&
lower_bound
,
const
std
::
vector
<
double
>&
upper_bound
,
std
::
vector
<
double
>*
const
filtered_lower_bound_x
,
std
::
vector
<
double
>*
const
filtered_lower_bound
,
std
::
vector
<
double
>*
const
filtered_upper_bound_x
,
std
::
vector
<
double
>*
const
filtered_upper_bound
);
void
GeneratePowerX
(
const
double
x
,
const
std
::
uint32_t
order
,
std
::
vector
<
double
>*
const
power_x
)
const
;
* @brief: Add monotone constraint inequality at all indices
**/
bool
AddMonotoneInequalityConstraint
();
private:
AffineConstraint
inequality_constraint_
;
AffineConstraint
equality_constraint_
;
std
::
vector
<
double
>
x_knots_
;
std
::
uint32_t
spline_order_
;
const
uint32_t
dimension_
;
Eigen
::
MatrixXd
inequality_constraint_
;
Eigen
::
MatrixXd
equality_constraint_
;
};
}
// namespace planning
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录