Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
8e046e7c
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,发现更多精彩内容 >>
提交
8e046e7c
编写于
2月 07, 2019
作者:
D
deidaraho
提交者:
Qi Luo
2月 07, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
planning: fix cost jacobian in open space smoother
上级
ae6d3ea1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
17 deletion
+28
-17
modules/planning/open_space/trajectory_smoother/distance_approach_ipopt_interface.cc
.../trajectory_smoother/distance_approach_ipopt_interface.cc
+25
-10
modules/planning/open_space/trajectory_smoother/distance_approach_problem.cc
...en_space/trajectory_smoother/distance_approach_problem.cc
+3
-7
未找到文件。
modules/planning/open_space/trajectory_smoother/distance_approach_ipopt_interface.cc
浏览文件 @
8e046e7c
...
@@ -117,19 +117,19 @@ bool DistanceApproachIPOPTInterface::get_nlp_info(int& n, int& m,
...
@@ -117,19 +117,19 @@ bool DistanceApproachIPOPTInterface::get_nlp_info(int& n, int& m,
ADEBUG
<<
"get_nlp_info"
;
ADEBUG
<<
"get_nlp_info"
;
// n1 : states variables, 4 * (N+1)
// n1 : states variables, 4 * (N+1)
int
n1
=
4
*
(
horizon_
+
1
);
int
n1
=
4
*
(
horizon_
+
1
);
AINFO
<<
"n1: "
<<
n1
;
// n2 : control inputs variables
// n2 : control inputs variables
int
n2
=
2
*
horizon_
;
int
n2
=
2
*
horizon_
;
AINFO
<<
"n2: "
<<
n2
;
// n3 : sampling time variables
// n3 : sampling time variables
int
n3
=
horizon_
+
1
;
int
n3
=
horizon_
+
1
;
AINFO
<<
"n3: "
<<
n3
;
// n4 : dual multiplier associated with obstacle shape
// n4 : dual multiplier associated with obstacle shape
lambda_horizon_
=
obstacles_edges_num_
.
sum
()
*
(
horizon_
+
1
);
lambda_horizon_
=
obstacles_edges_num_
.
sum
()
*
(
horizon_
+
1
);
AINFO
<<
"lambda_horizon_: "
<<
lambda_horizon_
;
// n5 : dual multipier associated with car shape, obstacles_num*4 * (N+1)
// n5 : dual multipier associated with car shape, obstacles_num*4 * (N+1)
miu_horizon_
=
obstacles_num_
*
4
*
(
horizon_
+
1
);
miu_horizon_
=
obstacles_num_
*
4
*
(
horizon_
+
1
);
AINFO
<<
"miu_horizon_: "
<<
miu_horizon_
;
// m1 : dynamics constatins
// m1 : dynamics constatins
int
m1
=
4
*
horizon_
;
int
m1
=
4
*
horizon_
;
...
@@ -445,10 +445,26 @@ bool DistanceApproachIPOPTInterface::eval_f(int n, const double* x, bool new_x,
...
@@ -445,10 +445,26 @@ bool DistanceApproachIPOPTInterface::eval_f(int n, const double* x, bool new_x,
bool
DistanceApproachIPOPTInterface
::
eval_grad_f
(
int
n
,
const
double
*
x
,
bool
DistanceApproachIPOPTInterface
::
eval_grad_f
(
int
n
,
const
double
*
x
,
bool
new_x
,
double
*
grad_f
)
{
bool
new_x
,
double
*
grad_f
)
{
if
(
!
FLAGS_enable_hand_derivative
)
{
if
(
distance_approach_config_
.
enable_hand_derivative
())
{
gradient
(
tag_f
,
n
,
x
,
grad_f
);
}
else
{
eval_grad_f_hand
(
n
,
x
,
new_x
,
grad_f
);
eval_grad_f_hand
(
n
,
x
,
new_x
,
grad_f
);
if
(
distance_approach_config_
.
enable_derivative_check
())
{
// check gradients
int
kN
=
n
;
double
grad_f_check
[
kN
];
std
::
fill
(
grad_f_check
,
grad_f_check
+
n
,
0.0
);
gradient
(
tag_f
,
n
,
x
,
grad_f_check
);
double
delta_v
=
1e-6
;
for
(
int
i
=
0
;
i
<
n
;
++
i
)
{
if
(
std
::
abs
(
grad_f_check
[
i
]
-
grad_f
[
i
])
>
delta_v
)
{
AERROR
<<
"cost gradient not match at: "
<<
i
<<
", grad by hand: "
<<
grad_f
[
i
]
<<
", grad by adolc: "
<<
grad_f_check
[
i
];
}
}
}
}
else
{
gradient
(
tag_f
,
n
,
x
,
grad_f
);
}
}
return
true
;
return
true
;
}
}
...
@@ -487,13 +503,12 @@ bool DistanceApproachIPOPTInterface::eval_grad_f_hand(int n, const double* x,
...
@@ -487,13 +503,12 @@ bool DistanceApproachIPOPTInterface::eval_grad_f_hand(int n, const double* x,
// 2. objective to minimize u square
// 2. objective to minimize u square
for
(
int
i
=
0
;
i
<
horizon_
;
++
i
)
{
for
(
int
i
=
0
;
i
<
horizon_
;
++
i
)
{
grad_f
[
control_index
]
+=
2
*
weight_input_steer_
*
x
[
control_index
];
grad_f
[
control_index
]
+=
2
*
weight_input_steer_
*
x
[
control_index
];
grad_f
[
control_index
]
+=
2
*
weight_input_a_
*
x
[
control_index
+
1
];
grad_f
[
control_index
+
1
]
+=
2
*
weight_input_a_
*
x
[
control_index
+
1
];
control_index
+=
2
;
control_index
+=
2
;
}
}
// 3. objective to minimize input change rate for first horizon
// 3. objective to minimize input change rate for first horizon
// assume: x[time_index] > 0
// assume: x[time_index] > 0
control_index
=
control_start_index_
;
control_index
=
control_start_index_
;
double
last_time_steer_rate
=
double
last_time_steer_rate
=
(
x
[
control_index
]
-
last_time_u_
(
0
,
0
))
/
x
[
time_index
]
/
ts_
;
(
x
[
control_index
]
-
last_time_u_
(
0
,
0
))
/
x
[
time_index
]
/
ts_
;
...
...
modules/planning/open_space/trajectory_smoother/distance_approach_problem.cc
浏览文件 @
8e046e7c
...
@@ -85,13 +85,9 @@ bool DistanceApproachProblem::Solve(
...
@@ -85,13 +85,9 @@ bool DistanceApproachProblem::Solve(
app
->
Options
()
->
SetStringValue
(
"recalc_y"
,
app
->
Options
()
->
SetStringValue
(
"recalc_y"
,
planner_open_space_config_
.
distance_approach_config
().
\
planner_open_space_config_
.
distance_approach_config
().
\
ipopt_config
().
ipopt_recalc_y
());
ipopt_config
().
ipopt_recalc_y
());
if
(
FLAGS_enable_derivative_check
)
{
app
->
Options
()
->
SetNumericValue
(
"mu_init"
,
AINFO
<<
"checking jacobians ..."
;
planner_open_space_config_
.
distance_approach_config
().
\
app
->
Options
()
->
SetStringValue
(
"derivative_test"
,
ipopt_config
().
ipopt_mu_init
());
"first-order"
);
app
->
Options
()
->
SetStringValue
(
"derivative_test_print_all"
,
"No"
);
}
Ipopt
::
ApplicationReturnStatus
status
=
app
->
Initialize
();
Ipopt
::
ApplicationReturnStatus
status
=
app
->
Initialize
();
if
(
status
!=
Ipopt
::
Solve_Succeeded
)
{
if
(
status
!=
Ipopt
::
Solve_Succeeded
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录