Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
f3ad8ba2
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,发现更多精彩内容 >>
提交
f3ad8ba2
编写于
12月 25, 2017
作者:
Q
Qi Luo
提交者:
Dong Li
12月 25, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Control : Polish MPC controller (#2067)
上级
d17818ea
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
8 deletion
+9
-8
modules/control/controller/mpc_controller.cc
modules/control/controller/mpc_controller.cc
+9
-8
未找到文件。
modules/control/controller/mpc_controller.cc
浏览文件 @
f3ad8ba2
...
...
@@ -173,7 +173,7 @@ Status MPCController::Init(const ControlConf *control_conf) {
matrix_state_
=
Matrix
::
Zero
(
basic_state_size_
,
1
);
matrix_k_
=
Matrix
::
Zero
(
1
,
basic_state_size_
);
// TODO(QiL): Change it to configs
matrix_r_
=
Matrix
::
Identity
(
controls_
,
controls_
);
matrix_q_
=
Matrix
::
Zero
(
basic_state_size_
,
basic_state_size_
);
...
...
@@ -231,7 +231,7 @@ void MPCController::LoadMPCGainScheduler(
mpc_controller_conf
.
feedforwardterm_gain_scheduler
();
const
auto
&
steer_weight_gain_scheduler
=
mpc_controller_conf
.
steer_weight_gain_scheduler
();
AINFO
<<
"
Lateral
control gain scheduler loaded"
;
AINFO
<<
"
MPC
control gain scheduler loaded"
;
Interpolation1D
::
DataType
xy1
,
xy2
,
xy3
,
xy4
;
for
(
const
auto
&
scheduler
:
lat_err_gain_scheduler
.
scheduler
())
{
xy1
.
push_back
(
std
::
make_pair
(
scheduler
.
speed
(),
scheduler
.
ratio
()));
...
...
@@ -248,19 +248,19 @@ void MPCController::LoadMPCGainScheduler(
lat_err_interpolation_
.
reset
(
new
Interpolation1D
);
CHECK
(
lat_err_interpolation_
->
Init
(
xy1
))
<<
"Fail to load lateral error gain scheduler"
;
<<
"Fail to load lateral error gain scheduler
for MPC controller
"
;
heading_err_interpolation_
.
reset
(
new
Interpolation1D
);
CHECK
(
heading_err_interpolation_
->
Init
(
xy2
))
<<
"Fail to load heading error gain scheduler"
;
<<
"Fail to load heading error gain scheduler
for MPC controller
"
;
feedforwardterm_interpolation_
.
reset
(
new
Interpolation1D
);
CHECK
(
feedforwardterm_interpolation_
->
Init
(
xy2
))
<<
"Fail to load feedforwardterm gain scheduler"
;
<<
"Fail to load feedforwardterm gain scheduler
for MPC controller
"
;
steer_weight_interpolation_
.
reset
(
new
Interpolation1D
);
CHECK
(
steer_weight_interpolation_
->
Init
(
xy2
))
<<
"Fail to load steer weight gain scheduler"
;
<<
"Fail to load steer weight gain scheduler
for MPC controller
"
;
}
Status
MPCController
::
ComputeControlCommand
(
...
...
@@ -335,12 +335,12 @@ Status MPCController::ComputeControlCommand(
matrix_ad_
,
matrix_bd_
,
matrix_cd_
,
matrix_q_updated_
,
matrix_r_updated_
,
lower_bound
,
upper_bound
,
matrix_state_
,
reference
,
mpc_eps_
,
mpc_max_iteration_
,
&
control
)
!=
true
)
{
AERROR
<<
"MPC failed"
;
AERROR
<<
"MPC
solver
failed"
;
}
double
mpc_end_timestamp
=
Clock
::
NowInSeconds
();
ADEBUG
<<
"MPC core: calculation time is: "
ADEBUG
<<
"MPC core
algorithm
: calculation time is: "
<<
(
mpc_end_timestamp
-
mpc_start_timestamp
)
*
1000
<<
" ms."
;
// TODO(QiL): evaluate whether need to add spline smoothing after the result
...
...
@@ -349,6 +349,7 @@ Status MPCController::ComputeControlCommand(
steer_single_direction_max_degree_
*
100
;
double
steer_angle
=
steer_angle_feedback
+
steer_angle_feedforwardterm_updated_
;
// Clamp the steer angle to -100.0 to 100.0
steer_angle
=
common
::
math
::
Clamp
(
steer_angle
,
-
100.0
,
100.0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录