Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
ddb317e2
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,发现更多精彩内容 >>
提交
ddb317e2
编写于
7月 17, 2017
作者:
D
Dong Li
提交者:
Jiangtao Hu
7月 17, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
migrated curve1d to apollo planning
上级
191f3b72
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
581 addition
and
30 deletion
+581
-30
modules/monitor/common/tests/test_log.cc
modules/monitor/common/tests/test_log.cc
+31
-0
modules/planning/common/planning_gflags.cc
modules/planning/common/planning_gflags.cc
+2
-1
modules/planning/math/curve1d/BUILD
modules/planning/math/curve1d/BUILD
+52
-0
modules/planning/math/curve1d/curve1d.h
modules/planning/math/curve1d/curve1d.h
+48
-0
modules/planning/math/curve1d/polynomial_curve1d.h
modules/planning/math/curve1d/polynomial_curve1d.h
+39
-0
modules/planning/math/curve1d/quartic_polynomial_curve1d.cc
modules/planning/math/curve1d/quartic_polynomial_curve1d.cc
+114
-0
modules/planning/math/curve1d/quartic_polynomial_curve1d.h
modules/planning/math/curve1d/quartic_polynomial_curve1d.h
+72
-0
modules/planning/math/curve1d/quintic_polynomial_curve1d.cc
modules/planning/math/curve1d/quintic_polynomial_curve1d.cc
+125
-0
modules/planning/math/curve1d/quintic_polynomial_curve1d.h
modules/planning/math/curve1d/quintic_polynomial_curve1d.h
+74
-0
modules/planning/planner/rtk_replay_planner.cc
modules/planning/planner/rtk_replay_planner.cc
+6
-6
modules/planning/planner/rtk_replay_planner_test.cc
modules/planning/planner/rtk_replay_planner_test.cc
+3
-3
modules/planning/planning.cc
modules/planning/planning.cc
+3
-3
modules/planning/planning_node.cc
modules/planning/planning_node.cc
+6
-6
modules/planning/planning_test.cc
modules/planning/planning_test.cc
+6
-11
未找到文件。
modules/monitor/common/tests/test_log.cc
0 → 100644
浏览文件 @
ddb317e2
/******************************************************************************
* 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.
*****************************************************************************/
// @todo: complete this using gmock & gtest, capture logging contents and do
// checks.
#include "apollo/platform/log.h"
using
namespace
apollo
::
platform
::
log
;
int
main
()
{
LogModule
m1
=
{
"test"
,
5
,
10
,
platform_log_printf
};
m1
.
set_log_lvl
(
7
);
PLATFORM_LOG
(
&
m1
,
3
,
"test"
);
return
0
;
}
modules/planning/common/planning_gflags.cc
浏览文件 @
ddb317e2
...
...
@@ -33,5 +33,6 @@ DEFINE_double(replanning_threshold, 2.0,
"The threshold of position deviation "
"that triggers the planner replanning"
);
DEFINE_double
(
trajectory_resolution
,
0.01
,
"The time resolution of "
DEFINE_double
(
trajectory_resolution
,
0.01
,
"The time resolution of "
"output trajectory."
);
modules/planning/math/curve1d/BUILD
0 → 100644
浏览文件 @
ddb317e2
load
(
"//tools:cpplint.bzl"
,
"cpplint"
)
package
(
default_visibility
=
[
"//visibility:public"
])
cc_library
(
name
=
"curve1d"
,
hdrs
=
[
"curve1d.h"
,
],
deps
=
[
],
)
cc_library
(
name
=
"polynomial_curve1d"
,
hdrs
=
[
"polynomial_curve1d.h"
,
],
deps
=
[
":curve1d"
,
],
)
cc_library
(
name
=
"quartic_polynomial_curve1d"
,
srcs
=
[
"quartic_polynomial_curve1d.cc"
,
],
hdrs
=
[
"quartic_polynomial_curve1d.h"
,
],
deps
=
[
"polynomial_curve1d"
,
"@glog//:glog"
,
],
)
cc_library
(
name
=
"quintic_polynomial_curve1d"
,
srcs
=
[
"quintic_polynomial_curve1d.cc"
,
],
hdrs
=
[
"quintic_polynomial_curve1d.h"
,
],
deps
=
[
"polynomial_curve1d"
,
"@glog//:glog"
,
],
)
cpplint
()
modules/planning/math/curve1d/curve1d.h
0 → 100644
浏览文件 @
ddb317e2
/******************************************************************************
* 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 curve1d.h
**/
#ifndef MODULES_PLANNING_MATH_CURVE1D_CURVE1D_H_
#define MODULES_PLANNING_MATH_CURVE1D_CURVE1D_H_
#include <string>
namespace
apollo
{
namespace
planning
{
// Base type for various types of 1-dimensional curves
class
Curve1d
{
public:
Curve1d
()
=
default
;
virtual
~
Curve1d
()
=
default
;
virtual
double
evaluate
(
const
std
::
size_t
order
,
const
double
param
)
const
=
0
;
virtual
double
param_length
()
const
=
0
;
virtual
std
::
string
to_string
()
const
=
0
;
};
}
// namespace planning
}
// namespace apollo
#endif
/* MODULES_PLANNING_MATH_CURVE1D_CURVE1D_H_ */
modules/planning/math/curve1d/polynomial_curve1d.h
0 → 100644
浏览文件 @
ddb317e2
/******************************************************************************
* 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 polynomial_curve1d.h
**/
#ifndef MODULES_PLANNING_MATH_CURVE1D_POLYNOMIAL_CURVE1D_H_
#define MODULES_PLANNING_MATH_CURVE1D_POLYNOMIAL_CURVE1D_H_
#include "modules/planning/math/curve1d/curve1d.h"
namespace
apollo
{
namespace
planning
{
class
PolynomialCurve1d
:
public
Curve1d
{
public:
PolynomialCurve1d
()
=
default
;
virtual
~
PolynomialCurve1d
()
=
default
;
};
}
// namespace planning
}
// namespace apollo
#endif
/* MODULES_PLANNING_MATH_CURVE1D_POLYNOMIAL_CURVE1D_H_ */
modules/planning/math/curve1d/quartic_polynomial_curve1d.cc
0 → 100644
浏览文件 @
ddb317e2
/******************************************************************************
* 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 quartic_polynomial_curve1d.cc
**/
#include "modules/planning/math/curve1d/quartic_polynomial_curve1d.h"
#include <string>
#include "glog/logging.h"
namespace
apollo
{
namespace
planning
{
QuarticPolynomialCurve1d
::
QuarticPolynomialCurve1d
(
const
std
::
array
<
double
,
3
>&
start
,
const
std
::
array
<
double
,
2
>&
end
,
const
double
param
)
:
QuarticPolynomialCurve1d
(
start
[
0
],
start
[
1
],
start
[
2
],
end
[
0
],
end
[
1
],
param
)
{}
QuarticPolynomialCurve1d
::
QuarticPolynomialCurve1d
(
const
double
x0
,
const
double
dx0
,
const
double
ddx0
,
const
double
dx1
,
const
double
ddx1
,
const
double
param
)
{
compute_coefficients
(
x0
,
dx0
,
ddx0
,
dx1
,
ddx1
,
param
);
start_condition_
[
0
]
=
x0
;
start_condition_
[
1
]
=
dx0
;
start_condition_
[
2
]
=
ddx0
;
end_condition_
[
0
]
=
dx1
;
end_condition_
[
1
]
=
ddx1
;
}
QuarticPolynomialCurve1d
::
QuarticPolynomialCurve1d
(
const
QuarticPolynomialCurve1d
&
other
)
{
param_
=
other
.
param_
;
coef_
=
other
.
coef_
;
}
double
QuarticPolynomialCurve1d
::
evaluate
(
const
std
::
size_t
order
,
const
double
p
)
const
{
switch
(
order
)
{
case
0
:
{
return
(((
coef_
[
0
]
*
p
+
coef_
[
1
])
*
p
+
coef_
[
2
])
*
p
+
coef_
[
3
])
*
p
+
coef_
[
4
];
}
case
1
:
{
return
((
4.0
*
coef_
[
0
]
*
p
+
3.0
*
coef_
[
1
])
*
p
+
2.0
*
coef_
[
2
])
*
p
+
coef_
[
3
];
}
case
2
:
{
return
(
12.0
*
coef_
[
0
]
*
p
+
6.0
*
coef_
[
1
])
*
p
+
2.0
*
coef_
[
2
];
}
case
3
:
{
return
24.0
*
coef_
[
0
]
*
p
+
6.0
*
coef_
[
1
];
}
case
4
:
{
return
24.0
*
coef_
[
0
];
}
default:
return
0.0
;
}
}
double
QuarticPolynomialCurve1d
::
param_length
()
const
{
return
param_
;
}
void
QuarticPolynomialCurve1d
::
compute_coefficients
(
const
double
x0
,
const
double
dx0
,
const
double
ddx0
,
const
double
dx1
,
const
double
ddx1
,
const
double
p
)
{
CHECK
(
p
>
0.0
);
param_
=
p
;
coef_
[
4
]
=
x0
;
coef_
[
3
]
=
dx0
;
coef_
[
2
]
=
0.5
*
ddx0
;
double
b0
=
dx1
-
ddx0
*
p
-
dx0
;
double
b1
=
ddx1
-
ddx0
;
double
p2
=
p
*
p
;
double
p3
=
p2
*
p
;
coef_
[
0
]
=
-
0.5
/
p3
*
b0
+
0.25
/
p2
*
b1
;
coef_
[
1
]
=
b0
/
p2
-
b1
/
3.0
/
p
;
}
std
::
string
QuarticPolynomialCurve1d
::
to_string
()
const
{
std
::
string
s
=
""
;
for
(
size_t
i
=
0
;
i
<
coef_
.
size
();
++
i
)
{
s
+=
std
::
to_string
(
coef_
[
i
])
+
"
\t
"
;
}
s
+=
std
::
to_string
(
param_
);
s
+=
"
\n
"
;
return
s
;
}
}
// namespace planning
}
// namespace apollo
modules/planning/math/curve1d/quartic_polynomial_curve1d.h
0 → 100644
浏览文件 @
ddb317e2
/******************************************************************************
* 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 quartic_polynomial_curve1d.h
**/
#ifndef MODULES_PLANNING_MATH_CURVE1D_QUARTIC_POLYNOMIAL_CURVE1D_H_
#define MODULES_PLANNING_MATH_CURVE1D_QUARTIC_POLYNOMIAL_CURVE1D_H_
#include <array>
#include <string>
#include "modules/planning/math/curve1d/polynomial_curve1d.h"
namespace
apollo
{
namespace
planning
{
// 1D quartic polynomial curve: (x0, dx0, ddx0) -- [0, param] --> (dx1, ddx1)
class
QuarticPolynomialCurve1d
:
public
PolynomialCurve1d
{
public:
QuarticPolynomialCurve1d
()
=
default
;
QuarticPolynomialCurve1d
(
const
std
::
array
<
double
,
3
>&
start
,
const
std
::
array
<
double
,
2
>&
end
,
const
double
param
);
QuarticPolynomialCurve1d
(
const
double
x0
,
const
double
dx0
,
const
double
ddx0
,
const
double
dx1
,
const
double
ddx1
,
const
double
param
);
QuarticPolynomialCurve1d
(
const
QuarticPolynomialCurve1d
&
other
);
virtual
~
QuarticPolynomialCurve1d
()
=
default
;
double
evaluate
(
const
std
::
size_t
order
,
const
double
p
)
const
override
;
double
param_length
()
const
override
;
std
::
string
to_string
()
const
override
;
private:
void
compute_coefficients
(
const
double
x0
,
const
double
dx0
,
const
double
ddx0
,
const
double
dx1
,
const
double
ddx1
,
const
double
param
);
double
param_
=
0.0
;
std
::
array
<
double
,
5
>
coef_
{{
0.0
,
0.0
,
0.0
,
0.0
,
0.0
}};
std
::
array
<
double
,
3
>
start_condition_
{{
0.0
,
0.0
,
0.0
}};
std
::
array
<
double
,
2
>
end_condition_
{{
0.0
,
0.0
}};
};
}
// namespace planning
}
// namespace apollo
#endif
/* MODULES_PLANNING_MATH_CURVE1D_QUARTIC_POLYNOMIAL_CURVE1D_H_ */
modules/planning/math/curve1d/quintic_polynomial_curve1d.cc
0 → 100644
浏览文件 @
ddb317e2
/******************************************************************************
* 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 quintic_polynomial_curve1d.cc
**/
#include "modules/planning/math/curve1d/quintic_polynomial_curve1d.h"
#include "glog/logging.h"
namespace
apollo
{
namespace
planning
{
QuinticPolynomialCurve1d
::
QuinticPolynomialCurve1d
(
const
std
::
array
<
double
,
3
>&
start
,
const
std
::
array
<
double
,
3
>&
end
,
const
double
param
)
:
QuinticPolynomialCurve1d
(
start
[
0
],
start
[
1
],
start
[
2
],
end
[
0
],
end
[
1
],
end
[
2
],
param
)
{}
QuinticPolynomialCurve1d
::
QuinticPolynomialCurve1d
(
const
double
x0
,
const
double
dx0
,
const
double
ddx0
,
const
double
x1
,
const
double
dx1
,
const
double
ddx1
,
const
double
param
)
:
param_
(
param
)
{
compute_coefficients
(
x0
,
dx0
,
ddx0
,
x1
,
dx1
,
ddx1
,
param
);
start_condition_
[
0
]
=
x0
;
start_condition_
[
1
]
=
dx0
;
start_condition_
[
2
]
=
ddx0
;
end_condition_
[
0
]
=
x1
;
end_condition_
[
1
]
=
dx1
;
end_condition_
[
2
]
=
ddx1
;
}
QuinticPolynomialCurve1d
::
QuinticPolynomialCurve1d
(
const
QuinticPolynomialCurve1d
&
other
)
{
param_
=
other
.
param_
;
coef_
=
other
.
coef_
;
return
;
}
double
QuinticPolynomialCurve1d
::
evaluate
(
const
size_t
order
,
const
double
p
)
const
{
switch
(
order
)
{
case
0
:
{
return
((((
coef_
[
0
]
*
p
+
coef_
[
1
])
*
p
+
coef_
[
2
])
*
p
+
coef_
[
3
])
*
p
+
coef_
[
4
])
*
p
+
coef_
[
5
];
}
case
1
:
{
return
(((
5.0
*
coef_
[
0
]
*
p
+
4.0
*
coef_
[
1
])
*
p
+
3.0
*
coef_
[
2
])
*
p
+
2.0
*
coef_
[
3
])
*
p
+
coef_
[
4
];
}
case
2
:
{
return
(((
20.0
*
coef_
[
0
]
*
p
+
12.0
*
coef_
[
1
])
*
p
)
+
6.0
*
coef_
[
2
])
*
p
+
2.0
*
coef_
[
3
];
}
case
3
:
{
return
(
60.0
*
coef_
[
0
]
*
p
+
24.0
*
coef_
[
1
])
*
p
+
6.0
*
coef_
[
2
];
}
case
4
:
{
return
120.0
*
coef_
[
0
]
*
p
+
24.0
*
coef_
[
1
];
}
case
5
:
{
return
120.0
*
coef_
[
0
];
}
default:
return
0.0
;
}
}
void
QuinticPolynomialCurve1d
::
compute_coefficients
(
const
double
x0
,
const
double
dx0
,
const
double
ddx0
,
const
double
x1
,
const
double
dx1
,
const
double
ddx1
,
const
double
p
)
{
CHECK
(
p
>
0.0
);
coef_
[
5
]
=
x0
;
coef_
[
4
]
=
dx0
;
coef_
[
3
]
=
ddx0
/
2.0
;
double
p2
=
p
*
p
;
double
p3
=
p
*
p2
;
// the direct analytical method is at least 6 times faster than using matrix
// inversion.
double
c0
=
(
x1
-
0.5
*
p2
*
ddx0
-
dx0
*
p
-
x0
)
/
p3
;
double
c1
=
(
dx1
-
ddx0
*
p
-
dx0
)
/
p2
;
double
c2
=
(
ddx1
-
ddx0
)
/
p
;
coef_
[
0
]
=
(
6.0
*
c0
-
3.0
*
c1
+
0.5
*
c2
)
/
p2
;
coef_
[
1
]
=
(
-
15.0
*
c0
+
7.0
*
c1
-
c2
)
/
p
;
coef_
[
2
]
=
0.5
*
(
20.0
*
c0
-
8.0
*
c1
+
c2
);
return
;
}
double
QuinticPolynomialCurve1d
::
param_length
()
const
{
return
param_
;
}
std
::
string
QuinticPolynomialCurve1d
::
to_string
()
const
{
std
::
string
s
=
""
;
for
(
size_t
i
=
0
;
i
<
coef_
.
size
();
++
i
)
{
s
+=
std
::
to_string
(
coef_
[
i
])
+
"
\t
"
;
}
s
+=
std
::
to_string
(
param_
);
s
+=
"
\n
"
;
return
s
;
}
}
// namespace planning
}
// namespace apollo
modules/planning/math/curve1d/quintic_polynomial_curve1d.h
0 → 100644
浏览文件 @
ddb317e2
/******************************************************************************
* 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 quintic_polynomial_curve1d.h
**/
#ifndef MODULES_PLANNING_MATH_CURVE1D_QUINTIC_POLYNOMIAL_CURVE1D_H_
#define MODULES_PLANNING_MATH_CURVE1D_QUINTIC_POLYNOMIAL_CURVE1D_H_
#include <array>
#include <string>
#include "modules/planning/math/curve1d/polynomial_curve1d.h"
namespace
apollo
{
namespace
planning
{
// 1D quintic polynomial curve: (x0, dx0, ddx0) -- [0, param] --> (x1, dx1,
// ddx1)
class
QuinticPolynomialCurve1d
:
public
PolynomialCurve1d
{
public:
QuinticPolynomialCurve1d
()
=
default
;
QuinticPolynomialCurve1d
(
const
std
::
array
<
double
,
3
>&
start
,
const
std
::
array
<
double
,
3
>&
end
,
const
double
param
);
QuinticPolynomialCurve1d
(
const
double
x0
,
const
double
dx0
,
const
double
ddx0
,
const
double
x1
,
const
double
dx1
,
const
double
ddx1
,
const
double
param
);
QuinticPolynomialCurve1d
(
const
QuinticPolynomialCurve1d
&
other
);
virtual
~
QuinticPolynomialCurve1d
()
=
default
;
double
evaluate
(
const
std
::
size_t
order
,
const
double
p
)
const
override
;
double
param_length
()
const
override
;
std
::
string
to_string
()
const
override
;
private:
void
compute_coefficients
(
const
double
x0
,
const
double
dx0
,
const
double
ddx0
,
const
double
x1
,
const
double
dx1
,
const
double
ddx1
,
const
double
param
);
double
param_
=
0.0
;
std
::
array
<
double
,
6
>
coef_
{{
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
}};
std
::
array
<
double
,
3
>
start_condition_
{{
0.0
,
0.0
,
0.0
}};
std
::
array
<
double
,
3
>
end_condition_
{{
0.0
,
0.0
,
0.0
}};
};
}
// namespace planning
}
// namespace apollo
#endif
/* MODULES_PLANNING_MATH_CURVE1D_QUINTIC_POLYNOMIAL_CURVE1D_H_ */
modules/planning/planner/rtk_replay_planner.cc
浏览文件 @
ddb317e2
...
...
@@ -35,7 +35,6 @@ RTKReplayPlanner::RTKReplayPlanner() {
bool
RTKReplayPlanner
::
Plan
(
const
TrajectoryPoint
&
start_point
,
std
::
vector
<
TrajectoryPoint
>*
ptr_discretized_trajectory
)
{
if
(
complete_rtk_trajectory_
.
empty
()
||
complete_rtk_trajectory_
.
size
()
<
2
)
{
AERROR
<<
"RTKReplayPlanner doesn't have a recorded trajectory or "
"the recorded trajectory doesn't have enough valid trajectory "
...
...
@@ -68,8 +67,8 @@ bool RTKReplayPlanner::Plan(
while
(
ptr_discretized_trajectory
->
size
()
<
FLAGS_rtk_trajectory_forward
)
{
ptr_discretized_trajectory
->
push_back
(
ptr_discretized_trajectory
->
back
());
auto
&
last_point
=
ptr_discretized_trajectory
->
back
();
last_point
.
set_relative_time
(
last_point
.
relative_time
()
+
FLAGS_trajectory_resolution
);
last_point
.
set_relative_time
(
last_point
.
relative_time
()
+
FLAGS_trajectory_resolution
);
}
return
true
;
}
...
...
@@ -97,7 +96,8 @@ void RTKReplayPlanner::ReadTrajectoryFile(const std::string& filename) {
auto
tokens
=
apollo
::
common
::
util
::
StringTokenizer
::
Split
(
line
,
"
\t
"
);
if
(
tokens
.
size
()
<
11
)
{
AERROR
<<
"RTKReplayPlanner parse line failed; the data dimension does not match."
;
AERROR
<<
"RTKReplayPlanner parse line failed; the data dimension does "
"not match."
;
AERROR
<<
line
;
continue
;
}
...
...
@@ -137,8 +137,8 @@ std::size_t RTKReplayPlanner::QueryPositionMatchedPoint(
start_point
.
y
());
std
::
size_t
index_min
=
0
;
for
(
std
::
size_t
i
=
1
;
i
<
trajectory
.
size
();
++
i
)
{
double
d_temp
=
func_distance_square
(
trajectory
[
i
],
start_point
.
x
(),
start_point
.
y
());
double
d_temp
=
func_distance_square
(
trajectory
[
i
],
start_point
.
x
(),
start_point
.
y
());
if
(
d_temp
<
d_min
)
{
d_min
=
d_temp
;
index_min
=
i
;
...
...
modules/planning/planner/rtk_replay_planner_test.cc
浏览文件 @
ddb317e2
...
...
@@ -26,8 +26,7 @@ using apollo::common::TrajectoryPoint;
namespace
apollo
{
namespace
planning
{
class
RTKReplayPlannerTest
:
public
::
testing
::
Test
{
};
class
RTKReplayPlannerTest
:
public
::
testing
::
Test
{};
TEST_F
(
RTKReplayPlannerTest
,
ComputeTrajectory
)
{
FLAGS_rtk_trajectory_filename
=
"modules/planning/testdata/garage.csv"
;
...
...
@@ -54,7 +53,8 @@ TEST_F(RTKReplayPlannerTest, ComputeTrajectory) {
}
TEST_F
(
RTKReplayPlannerTest
,
ErrorTest
)
{
FLAGS_rtk_trajectory_filename
=
"modules/planning/testdata/garage_no_file.csv"
;
FLAGS_rtk_trajectory_filename
=
"modules/planning/testdata/garage_no_file.csv"
;
RTKReplayPlanner
planner
;
FLAGS_rtk_trajectory_filename
=
"modules/planning/testdata/garage_error.csv"
;
RTKReplayPlanner
planner_with_error_csv
;
...
...
modules/planning/planning.cc
浏览文件 @
ddb317e2
...
...
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/planning/planning.h"
#include "modules/common/adapters/adapter_manager.h"
#include "modules/common/time/time.h"
#include "modules/planning/common/planning_gflags.h"
#include "modules/planning/planner_factory.h"
#include "modules/planning/planning.h"
namespace
apollo
{
namespace
planning
{
...
...
@@ -134,8 +134,8 @@ TrajectoryPoint Planning::ComputeStartingPointFromVehicleState(
point
.
set_kappa
(
0.0
);
const
double
speed_threshold
=
0.1
;
if
(
point
.
v
()
>
speed_threshold
)
{
point
.
set_kappa
(
vehicle_state
.
angular_velocity
()
/
vehicle_state
.
linear_velocity
());
point
.
set_kappa
(
vehicle_state
.
angular_velocity
()
/
vehicle_state
.
linear_velocity
());
}
point
.
set_dkappa
(
0.0
);
point
.
set_s
(
0.0
);
...
...
modules/planning/planning_node.cc
浏览文件 @
ddb317e2
...
...
@@ -86,10 +86,12 @@ void PlanningNode::RunOnce() {
planning_cycle_time
;
std
::
vector
<
TrajectoryPoint
>
planning_trajectory
;
bool
res_planning
=
planning_
.
Plan
(
vehicle_state
,
is_on_auto_mode
,
execution_start_time
,
&
planning_trajectory
);
bool
res_planning
=
planning_
.
Plan
(
vehicle_state
,
is_on_auto_mode
,
execution_start_time
,
&
planning_trajectory
);
if
(
res_planning
)
{
TrajectoryPb
trajectory_pb
=
ToTrajectoryPb
(
execution_start_time
,
planning_trajectory
);
TrajectoryPb
trajectory_pb
=
ToTrajectoryPb
(
execution_start_time
,
planning_trajectory
);
AdapterManager
::
PublishPlanningTrajectory
(
trajectory_pb
);
AINFO
<<
"Planning succeeded"
;
}
else
{
...
...
@@ -97,9 +99,7 @@ void PlanningNode::RunOnce() {
}
}
void
PlanningNode
::
Reset
()
{
planning_
.
Reset
();
}
void
PlanningNode
::
Reset
()
{
planning_
.
Reset
();
}
TrajectoryPb
PlanningNode
::
ToTrajectoryPb
(
const
double
header_time
,
...
...
modules/planning/planning_test.cc
浏览文件 @
ddb317e2
...
...
@@ -14,10 +14,10 @@
* limitations under the License.
*****************************************************************************/
#include "modules/planning/common/planning_gflags.h"
#include "modules/planning/planning.h"
#include "modules/planning/
proto/planning.pb
.h"
#include "modules/planning/
common/planning_gflags
.h"
#include "modules/planning/planner_factory.h"
#include "modules/planning/proto/planning.pb.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
...
...
@@ -28,11 +28,9 @@ namespace planning {
using
TrajectoryPb
=
ADCTrajectory
;
using
apollo
::
common
::
TrajectoryPoint
;
class
PlanningTest
:
public
::
testing
::
Test
{
};
class
PlanningTest
:
public
::
testing
::
Test
{};
TEST_F
(
PlanningTest
,
ComputeTrajectory
)
{
FLAGS_rtk_trajectory_filename
=
"modules/planning/testdata/garage.csv"
;
Planning
planning
;
common
::
vehicle_state
::
VehicleState
vehicle_state
;
...
...
@@ -47,8 +45,7 @@ TEST_F(PlanningTest, ComputeTrajectory) {
double
time1
=
0.1
;
planning
.
Plan
(
vehicle_state
,
false
,
time1
,
&
trajectory1
);
EXPECT_EQ
(
trajectory1
.
size
(),
(
std
::
size_t
)
FLAGS_rtk_trajectory_forward
);
EXPECT_EQ
(
trajectory1
.
size
(),
(
std
::
size_t
)
FLAGS_rtk_trajectory_forward
);
const
auto
&
p1_start
=
trajectory1
.
front
();
const
auto
&
p1_end
=
trajectory1
.
back
();
...
...
@@ -59,9 +56,8 @@ TEST_F(PlanningTest, ComputeTrajectory) {
double
time2
=
0.5
;
planning
.
Plan
(
vehicle_state
,
true
,
time2
,
&
trajectory2
);
EXPECT_EQ
(
trajectory2
.
size
(),
(
std
::
size_t
)
FLAGS_rtk_trajectory_forward
+
(
int
)
FLAGS_rtk_trajectory_backward
);
EXPECT_EQ
(
trajectory2
.
size
(),
(
std
::
size_t
)
FLAGS_rtk_trajectory_forward
+
(
int
)
FLAGS_rtk_trajectory_backward
);
const
auto
&
p2_backward
=
trajectory2
.
front
();
const
auto
&
p2_start
=
trajectory2
[
FLAGS_rtk_trajectory_backward
];
...
...
@@ -79,7 +75,6 @@ TEST_F(PlanningTest, ComputeTrajectory) {
}
TEST_F
(
PlanningTest
,
ComputeTrajectoryNoRTKFile
)
{
FLAGS_rtk_trajectory_filename
=
""
;
Planning
planning
;
common
::
vehicle_state
::
VehicleState
vehicle_state
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录