Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
38e5c5ee
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 搜索 >>
提交
38e5c5ee
编写于
7月 25, 2017
作者:
A
Aaron Xiao
提交者:
Dong Li
7月 25, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use StrCat to construct string. (#259)
上级
6405bfa1
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
199 addition
and
135 deletion
+199
-135
modules/common/math/BUILD
modules/common/math/BUILD
+2
-0
modules/common/math/aabox2d.cc
modules/common/math/aabox2d.cc
+4
-6
modules/common/math/box2d.cc
modules/common/math/box2d.cc
+5
-7
modules/common/math/kalman_filter.h
modules/common/math/kalman_filter.h
+9
-10
modules/common/math/line_segment2d.cc
modules/common/math/line_segment2d.cc
+3
-6
modules/common/math/vec2d.cc
modules/common/math/vec2d.cc
+3
-5
modules/common/util/BUILD
modules/common/util/BUILD
+13
-3
modules/common/util/file.h
modules/common/util/file.h
+1
-1
modules/common/util/string_util.cc
modules/common/util/string_util.cc
+30
-0
modules/common/util/string_util.h
modules/common/util/string_util.h
+62
-0
modules/common/util/string_util_test.cc
modules/common/util/string_util_test.cc
+2
-1
modules/common/util/util.cc
modules/common/util/util.cc
+0
-5
modules/common/util/util.h
modules/common/util/util.h
+0
-24
modules/control/controller/lat_controller.cc
modules/control/controller/lat_controller.cc
+20
-17
modules/dreamview/backend/websocket/BUILD
modules/dreamview/backend/websocket/BUILD
+1
-0
modules/dreamview/backend/websocket/websocket.cc
modules/dreamview/backend/websocket/websocket.cc
+4
-7
modules/map/pnc_map/path.cc
modules/map/pnc_map/path.cc
+7
-13
modules/monitor/hwmonitor/hw/esdcan/esdcan_checker.cc
modules/monitor/hwmonitor/hw/esdcan/esdcan_checker.cc
+2
-4
modules/perception/obstacle/base/BUILD
modules/perception/obstacle/base/BUILD
+1
-0
modules/perception/obstacle/base/object.cc
modules/perception/obstacle/base/object.cc
+16
-15
modules/planning/common/speed/st_point.cc
modules/planning/common/speed/st_point.cc
+5
-5
modules/planning/reference_line/reference_point.cc
modules/planning/reference_line/reference_point.cc
+9
-6
未找到文件。
modules/common/math/BUILD
浏览文件 @
38e5c5ee
...
...
@@ -49,6 +49,7 @@ cc_library(
],
deps
=
[
"//modules/common:log"
,
"//modules/common/util:string_util"
,
],
)
...
...
@@ -165,6 +166,7 @@ cc_library(
deps
=
[
"//modules/common:log"
,
"//modules/common/math:matrix_operations"
,
"//modules/common/util:string_util"
,
"@eigen//:eigen"
,
],
)
...
...
modules/common/math/aabox2d.cc
浏览文件 @
38e5c5ee
...
...
@@ -18,9 +18,9 @@
#include <algorithm>
#include <cmath>
#include <sstream>
#include "modules/common/log.h"
#include "modules/common/util/string_util.h"
#include "modules/common/math/math_utils.h"
...
...
@@ -146,11 +146,9 @@ void AABox2d::MergeFrom(const Vec2d &other_point) {
}
std
::
string
AABox2d
::
DebugString
()
const
{
std
::
ostringstream
sout
;
sout
<<
"aabox2d ( center = "
<<
center_
.
DebugString
()
<<
" length = "
<<
length_
<<
" width = "
<<
width_
<<
" )"
;
sout
.
flush
();
return
sout
.
str
();
return
util
::
StrCat
(
"aabox2d ( center = "
,
center_
.
DebugString
(),
" length = "
,
length_
,
" width = "
,
width_
,
" )"
);
}
}
// namespace math
...
...
modules/common/math/box2d.cc
浏览文件 @
38e5c5ee
...
...
@@ -18,10 +18,10 @@
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
#include "modules/common/log.h"
#include "modules/common/util/string_util.h"
#include "modules/common/math/math_utils.h"
#include "modules/common/math/polygon2d.h"
...
...
@@ -303,12 +303,10 @@ void Box2d::RotateFromCenter(const double rotate_angle) {
void
Box2d
::
Shift
(
const
Vec2d
&
shift_vec
)
{
center_
+=
shift_vec
;
}
std
::
string
Box2d
::
DebugString
()
const
{
std
::
ostringstream
sout
;
sout
<<
"box2d ( center = "
<<
center_
.
DebugString
()
<<
" heading = "
<<
heading_
<<
" length = "
<<
length_
<<
" width = "
<<
width_
<<
" )"
;
sout
.
flush
();
return
sout
.
str
();
return
util
::
StrCat
(
"box2d ( center = "
,
center_
.
DebugString
(),
" heading = "
,
heading_
,
" length = "
,
length_
,
" width = "
,
width_
,
" )"
);
}
}
// namespace math
...
...
modules/common/math/kalman_filter.h
浏览文件 @
38e5c5ee
...
...
@@ -22,13 +22,13 @@
#ifndef MODULES_COMMON_MATH_KALMAN_FILTER_H_
#define MODULES_COMMON_MATH_KALMAN_FILTER_H_
#include <sstream>
#include <string>
#include "Eigen/Dense"
#include "modules/common/log.h"
#include "modules/common/math/matrix_operations.h"
#include "modules/common/util/string_util.h"
/**
* @namespace apollo::common::math
...
...
@@ -266,15 +266,14 @@ inline void KalmanFilter<T, XN, ZN, UN>::Correct(
template
<
typename
T
,
unsigned
int
XN
,
unsigned
int
ZN
,
unsigned
int
UN
>
inline
std
::
string
KalmanFilter
<
T
,
XN
,
ZN
,
UN
>::
DebugString
()
const
{
Eigen
::
IOFormat
clean_fmt
(
4
,
0
,
", "
,
" "
,
"["
,
"]"
);
std
::
ostringstream
strs
;
strs
<<
"F = "
<<
F_
.
format
(
clean_fmt
)
<<
"
\n
"
;
strs
<<
"B = "
<<
B_
.
format
(
clean_fmt
)
<<
"
\n
"
;
strs
<<
"H = "
<<
H_
.
format
(
clean_fmt
)
<<
"
\n
"
;
strs
<<
"Q = "
<<
Q_
.
format
(
clean_fmt
)
<<
"
\n
"
;
strs
<<
"R = "
<<
R_
.
format
(
clean_fmt
)
<<
"
\n
"
;
strs
<<
"x = "
<<
x_
.
format
(
clean_fmt
)
<<
"
\n
"
;
strs
<<
"P = "
<<
P_
.
format
(
clean_fmt
)
<<
"
\n
"
;
return
strs
.
str
();
return
util
::
StrCat
(
"F = "
,
F_
.
format
(
clean_fmt
),
"
\n
"
"B = "
,
B_
.
format
(
clean_fmt
),
"
\n
"
"H = "
,
H_
.
format
(
clean_fmt
),
"
\n
"
"Q = "
,
Q_
.
format
(
clean_fmt
),
"
\n
"
"R = "
,
R_
.
format
(
clean_fmt
),
"
\n
"
"x = "
,
x_
.
format
(
clean_fmt
),
"
\n
"
"P = "
,
P_
.
format
(
clean_fmt
),
"
\n
"
);
}
}
// namespace math
...
...
modules/common/math/line_segment2d.cc
浏览文件 @
38e5c5ee
...
...
@@ -18,10 +18,10 @@
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
#include "modules/common/log.h"
#include "modules/common/util/string_util.h"
#include "modules/common/math/math_utils.h"
...
...
@@ -214,11 +214,8 @@ double LineSegment2d::GetPerpendicularFoot(const Vec2d &point,
}
std
::
string
LineSegment2d
::
DebugString
()
const
{
std
::
ostringstream
sout
;
sout
<<
"segment2d ( start = "
<<
start_
.
DebugString
()
<<
" end = "
<<
end_
.
DebugString
()
<<
" )"
;
sout
.
flush
();
return
sout
.
str
();
return
util
::
StrCat
(
"segment2d ( start = "
,
start_
.
DebugString
(),
" end = "
,
end_
.
DebugString
(),
" )"
);
}
}
// namespace math
...
...
modules/common/math/vec2d.cc
浏览文件 @
38e5c5ee
...
...
@@ -17,8 +17,9 @@
#include "modules/common/math/vec2d.h"
#include <cmath>
#include <sstream>
#include "modules/common/log.h"
#include "modules/common/util/string_util.h"
namespace
apollo
{
namespace
common
{
...
...
@@ -110,10 +111,7 @@ bool Vec2d::operator==(const Vec2d &other) const {
Vec2d
operator
*
(
const
double
ratio
,
const
Vec2d
&
vec
)
{
return
vec
*
ratio
;
}
std
::
string
Vec2d
::
DebugString
()
const
{
std
::
ostringstream
sout
;
sout
<<
"vec2d ( x = "
<<
x_
<<
" y = "
<<
y_
<<
" )"
;
sout
.
flush
();
return
sout
.
str
();
return
util
::
StrCat
(
"vec2d ( x = "
,
x_
,
" y = "
,
y_
,
" )"
);
}
}
// namespace math
...
...
modules/common/util/BUILD
浏览文件 @
38e5c5ee
...
...
@@ -26,14 +26,24 @@ cc_library(
hdrs
=
[
"lru_cache.h"
],
)
cc_library
(
name
=
"string_util"
,
srcs
=
[
"string_util.cc"
,
],
hdrs
=
[
"string_util.h"
,
],
)
cc_test
(
name
=
"util_test"
,
name
=
"
string_
util_test"
,
size
=
"small"
,
srcs
=
[
"util_test.cc"
,
"
string_
util_test.cc"
,
],
deps
=
[
":util"
,
":
string_
util"
,
"@gtest//:main"
,
],
)
...
...
modules/common/util/file.h
浏览文件 @
38e5c5ee
...
...
@@ -32,7 +32,7 @@
#include "google/protobuf/io/zero_copy_stream_impl.h"
#include "google/protobuf/text_format.h"
#include "modules/common/log.h"
#include "modules/common/util/util.h"
#include "modules/common/util/
string_
util.h"
/**
* @namespace apollo::common::util
...
...
modules/common/util/string_util.cc
0 → 100644
浏览文件 @
38e5c5ee
/******************************************************************************
* 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.
*****************************************************************************/
#include "modules/common/util/string_util.h"
namespace
apollo
{
namespace
common
{
namespace
util
{
bool
EndWith
(
const
std
::
string
&
original
,
const
std
::
string
&
pattern
)
{
return
original
.
length
()
>=
pattern
.
length
()
&&
original
.
substr
(
original
.
length
()
-
pattern
.
length
())
==
pattern
;
}
}
// namespace util
}
// namespace common
}
// namespace apollo
modules/common/util/string_util.h
0 → 100644
浏览文件 @
38e5c5ee
/******************************************************************************
* 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 Some string util functions.
*/
#ifndef MODULES_COMMON_STRING_UTIL_H_
#define MODULES_COMMON_STRING_UTIL_H_
#include <sstream>
#include <string>
/**
* @namespace apollo::common::util
* @brief apollo::common::util
*/
namespace
apollo
{
namespace
common
{
namespace
util
{
/**
* @brief Check if a string ends with a pattern.
* @param original The original string. To see if it ends with some
* specified pattern.
* @param pattern The target pattern. To see if the original string ends
* with it.
* @return Whether the original string ends with the specified pattern.
*/
bool
EndWith
(
const
std
::
string
&
original
,
const
std
::
string
&
pattern
);
/**
* @brief Concat parameters to a string, e.g.: StrCat("age = ", 32)
* @return String of concated parameters.
*/
template
<
typename
...
T
>
std
::
string
StrCat
(
const
T
&
...
args
)
{
std
::
ostringstream
oss
;
// Expand args and pass to oss.
std
::
initializer_list
<
char
>
{(
oss
<<
args
,
' '
)
...
};
return
oss
.
str
();
}
}
// namespace util
}
// namespace common
}
// namespace apollo
#endif // MODULES_COMMON_STRING_UTIL_H_
modules/common/util/util_test.cc
→
modules/common/util/
string_
util_test.cc
浏览文件 @
38e5c5ee
...
...
@@ -14,7 +14,8 @@
* limitations under the License.
*****************************************************************************/
#include "modules/common/util/util.h"
#include "modules/common/util/string_util.h"
#include "gtest/gtest.h"
namespace
apollo
{
...
...
modules/common/util/util.cc
浏览文件 @
38e5c5ee
...
...
@@ -24,11 +24,6 @@ namespace util {
using
SLPoint
=
apollo
::
common
::
SLPoint
;
bool
EndWith
(
const
std
::
string
&
original
,
const
std
::
string
&
pattern
)
{
return
original
.
length
()
>=
pattern
.
length
()
&&
original
.
substr
(
original
.
length
()
-
pattern
.
length
())
==
pattern
;
}
SLPoint
MakeSLPoint
(
const
double
s
,
const
double
l
)
{
SLPoint
sl
;
sl
.
set_s
(
s
);
...
...
modules/common/util/util.h
浏览文件 @
38e5c5ee
...
...
@@ -23,8 +23,6 @@
#define MODULES_COMMON_UTIL_H_
#include <iostream>
#include <string>
#include <sstream>
#include <utility>
#include "modules/common/proto/path_point.pb.h"
...
...
@@ -37,28 +35,6 @@ namespace apollo {
namespace
common
{
namespace
util
{
/**
* @brief Check if a string ends with a pattern.
* @param original The original string. To see if it ends with some
* specified pattern.
* @param pattern The target pattern. To see if the original string ends
* with it.
* @return Whether the original string ends with the specified pattern.
*/
bool
EndWith
(
const
std
::
string
&
original
,
const
std
::
string
&
pattern
);
/**
* @brief Concat parameters to a string, e.g.: StrCat("age = ", 32)
* @return String of concated parameters.
*/
template
<
typename
...
T
>
std
::
string
StrCat
(
const
T
&
...
args
)
{
std
::
ostringstream
oss
;
// Expand args and pass to oss.
std
::
initializer_list
<
char
>
{(
oss
<<
args
,
' '
)
...
};
return
oss
.
str
();
}
/**
* @brief create a SL point
* @param s the s value
...
...
modules/control/controller/lat_controller.cc
浏览文件 @
38e5c5ee
...
...
@@ -19,7 +19,6 @@
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
...
...
@@ -30,6 +29,7 @@
#include "modules/common/math/linear_quadratic_regulator.h"
#include "modules/common/math/math_utils.h"
#include "modules/common/time/time.h"
#include "modules/common/util/string_util.h"
#include "modules/control/common/control_gflags.h"
namespace
apollo
{
...
...
@@ -119,24 +119,27 @@ bool LatController::LoadControlConf(const ControlConf *control_conf) {
void
LatController
::
ProcessLogs
(
const
SimpleLateralDebug
*
debug
,
const
canbus
::
Chassis
*
chassis
)
{
std
::
stringstream
log_stream
;
log_stream
<<
debug
->
lateral_error
()
<<
","
<<
debug
->
ref_heading
()
<<
","
<<
VehicleState
::
instance
()
->
heading
()
<<
","
<<
debug
->
heading_error
()
<<
","
<<
debug
->
heading_error_rate
()
<<
","
<<
debug
->
lateral_error_rate
()
<<
","
<<
debug
->
curvature
()
<<
","
<<
debug
->
steer_angle
()
<<
","
<<
debug
->
steer_angle_feedforward
()
<<
","
<<
debug
->
steer_angle_lateral_contribution
()
<<
","
<<
debug
->
steer_angle_lateral_rate_contribution
()
<<
","
<<
debug
->
steer_angle_heading_contribution
()
<<
","
<<
debug
->
steer_angle_heading_rate_contribution
()
<<
","
<<
debug
->
steer_angle_feedback
()
<<
","
<<
chassis
->
steering_percentage
()
<<
","
<<
VehicleState
::
instance
()
->
linear_velocity
();
const
std
::
string
log_str
=
apollo
::
common
::
util
::
StrCat
(
debug
->
lateral_error
(),
","
,
debug
->
ref_heading
(),
","
,
VehicleState
::
instance
()
->
heading
(),
","
,
debug
->
heading_error
(),
","
,
debug
->
heading_error_rate
(),
","
,
debug
->
lateral_error_rate
(),
","
,
debug
->
curvature
(),
","
,
debug
->
steer_angle
(),
","
,
debug
->
steer_angle_feedforward
(),
","
,
debug
->
steer_angle_lateral_contribution
(),
","
,
debug
->
steer_angle_lateral_rate_contribution
(),
","
,
debug
->
steer_angle_heading_contribution
(),
","
,
debug
->
steer_angle_heading_rate_contribution
(),
","
,
debug
->
steer_angle_feedback
(),
","
,
chassis
->
steering_percentage
(),
","
,
VehicleState
::
instance
()
->
linear_velocity
());
if
(
FLAGS_enable_csv_debug
)
{
steer_log_file_
<<
log_str
eam
.
str
()
<<
std
::
endl
;
steer_log_file_
<<
log_str
<<
std
::
endl
;
}
AINFO
<<
"Steer_Control_Detail: "
<<
log_str
eam
.
str
()
;
AINFO
<<
"Steer_Control_Detail: "
<<
log_str
;
}
void
LatController
::
LogInitParameters
()
{
...
...
modules/dreamview/backend/websocket/BUILD
浏览文件 @
38e5c5ee
...
...
@@ -12,6 +12,7 @@ cc_library(
],
deps
=
[
"//modules/common:log"
,
"//modules/common/util:string_util"
,
"//third_party/json"
,
"@civetweb//:civetweb++"
,
],
...
...
modules/dreamview/backend/websocket/websocket.cc
浏览文件 @
38e5c5ee
...
...
@@ -15,10 +15,10 @@ limitations under the License.
#include "modules/dreamview/backend/websocket/websocket.h"
#include <sstream>
#include <vector>
#include "modules/common/log.h"
#include "modules/common/util/string_util.h"
namespace
apollo
{
namespace
dreamview
{
...
...
@@ -74,13 +74,10 @@ bool WebSocketHandler::SendData(const std::string &data, Connection *conn) {
}
else
if
(
ret
<
0
)
{
msg
=
"Send Error"
;
}
else
{
std
::
ostringstream
os
;
os
<<
"Expect to send "
<<
data
.
size
()
<<
" bytes. But sent "
<<
ret
<<
" bytes"
;
msg
=
os
.
str
();
msg
=
apollo
::
common
::
util
::
StrCat
(
"Expect to send "
,
data
.
size
(),
" bytes. But sent "
,
ret
,
" bytes"
);
}
AWARN
<<
"Failed to send data via websocket connection. Reason: "
<<
msg
;
AWARN
<<
"Failed to send data via websocket connection. Reason: "
<<
msg
;
return
false
;
}
...
...
modules/map/pnc_map/path.cc
浏览文件 @
38e5c5ee
...
...
@@ -25,6 +25,7 @@
#include "modules/common/math/math_utils.h"
#include "modules/common/math/polygon2d.h"
#include "modules/common/math/vec2d.h"
#include "modules/common/util/string_util.h"
namespace
apollo
{
namespace
hdmap
{
...
...
@@ -60,21 +61,17 @@ std::string LaneWaypoint::debug_string() const {
if
(
lane
==
nullptr
)
{
return
"(lane is null)"
;
}
std
::
ostringstream
sout
;
sout
<<
"id = "
<<
lane
->
id
().
id
()
<<
" s = "
<<
s
;
sout
.
flush
();
return
sout
.
str
();
return
apollo
::
common
::
util
::
StrCat
(
"id = "
,
lane
->
id
().
id
(),
" s = "
,
s
);
}
std
::
string
LaneSegment
::
debug_string
()
const
{
if
(
lane
==
nullptr
)
{
return
"(lane is null)"
;
}
std
::
ostringstream
sout
;
sout
<<
"id = "
<<
lane
->
id
().
id
()
<<
" start_s = "
<<
start_s
<<
" end_s = "
<<
end_s
;
sout
.
flush
();
return
sout
.
str
();
return
apollo
::
common
::
util
::
StrCat
(
"id = "
,
lane
->
id
().
id
(),
" "
"start_s = "
,
start_s
,
" "
"end_s = "
,
end_s
);
}
std
::
string
MapPathPoint
::
debug_string
()
const
{
...
...
@@ -121,10 +118,7 @@ std::string Path::debug_string() const {
}
std
::
string
PathOverlap
::
debug_string
()
const
{
std
::
ostringstream
sout
;
sout
<<
object_id
<<
" "
<<
start_s
<<
" "
<<
end_s
;
sout
.
flush
();
return
sout
.
str
();
return
apollo
::
common
::
util
::
StrCat
(
object_id
,
" "
,
start_s
,
" "
,
end_s
);
}
Path
::
Path
(
std
::
vector
<
MapPathPoint
>
path_points
)
...
...
modules/monitor/hwmonitor/hw/esdcan/esdcan_checker.cc
浏览文件 @
38e5c5ee
...
...
@@ -16,10 +16,10 @@
#include "modules/monitor/hwmonitor/hw/esdcan/esdcan_checker.h"
#include <sstream>
#include <utility>
#include <vector>
#include "modules/common/util/string_util.h"
#include "modules/monitor/hwmonitor/hw/esdcan/esdcan_err_str.h"
#include "modules/monitor/hwmonitor/hw/hw_log_module.h"
...
...
@@ -30,9 +30,7 @@ namespace hw {
const
char
EsdCanChecker
::
ESD_CAN_NAME
[]
=
"ESD_CAN"
;
EsdCanChecker
::
EsdCanChecker
(
int
id
)
:
can_id_
(
id
)
{
std
::
ostringstream
os
;
os
<<
ESD_CAN_NAME
<<
"-"
<<
id
;
name_
=
os
.
str
();
name_
=
apollo
::
common
::
util
::
StrCat
(
ESD_CAN_NAME
,
"-"
,
id
);
}
hw
::
Status
EsdCanChecker
::
esdcan_result_to_hw_status
(
NTCAN_RESULT
ntstatus
)
{
...
...
modules/perception/obstacle/base/BUILD
浏览文件 @
38e5c5ee
...
...
@@ -11,6 +11,7 @@ cc_library(
"//modules/perception/common:perception_common"
,
"//modules/perception/proto:perception_proto"
,
"//modules/common:common"
,
"//modules/common/util:string_util"
,
"@eigen//:eigen"
,
],
)
...
...
modules/perception/obstacle/base/object.cc
浏览文件 @
38e5c5ee
...
...
@@ -15,15 +15,13 @@
*****************************************************************************/
#include "modules/perception/obstacle/base/object.h"
#include <sstream>
#include "modules/common/macro.h"
#include "modules/common/log.h"
#include "modules/common/util/string_util.h"
namespace
apollo
{
namespace
perception
{
using
std
::
ostringstream
;
using
std
::
string
;
using
std
::
vector
;
using
Eigen
::
Vector3d
;
...
...
@@ -95,18 +93,21 @@ void Object::clone(const Object& rhs) {
}
string
Object
::
to_string
()
const
{
ostringstream
oss
;
oss
<<
"Object[id: "
<<
id
<<
", track_id: "
<<
track_id
<<
", cloud_size: "
<<
cloud
->
size
()
<<
", direction: "
<<
direction
.
transpose
()
<<
", center: "
<<
center
.
transpose
()
<<
" velocity: "
<<
velocity
.
transpose
()
<<
", width: "
<<
width
<<
", length: "
<<
length
<<
", height: "
<<
height
<<
", polygon_size: "
<<
polygon
.
size
()
<<
", type: "
<<
type
<<
", is_background: "
<<
is_background
<<
"]"
;
// << ", tracking_time: " << GLOG_TIMESTAMP(tracking_time)
// << ", latest_tracked_time: " << GLOG_TIMESTAMP(latest_tracked_time) << "]";
return
oss
.
str
();
return
apollo
::
common
::
util
::
StrCat
(
"Object[id: "
,
id
,
", "
"track_id: "
,
track_id
,
", "
"cloud_size: "
,
cloud
->
size
(),
", "
"direction: "
,
direction
.
transpose
(),
", "
"center: "
,
center
.
transpose
(),
", "
"velocity: "
,
velocity
.
transpose
(),
", "
"width: "
,
width
,
", "
"length: "
,
length
,
", "
"height: "
,
height
,
", "
"polygon_size: "
,
polygon
.
size
(),
", "
"type: "
,
type
,
", "
"is_background: "
,
is_background
,
"]"
);
// "tracking_time: ", GLOG_TIMESTAMP(tracking_time)
// "latest_tracked_time: ", GLOG_TIMESTAMP(latest_tracked_time)
}
bool
Object
::
serialize
(
PerceptionObstacle
*
pb_obj
)
const
{
...
...
modules/planning/common/speed/st_point.cc
浏览文件 @
38e5c5ee
...
...
@@ -21,7 +21,8 @@
#include "modules/planning/common/speed/st_point.h"
#include <iomanip>
#include <sstream>
#include "modules/common/util/string_util.h"
namespace
apollo
{
namespace
planning
{
...
...
@@ -37,10 +38,9 @@ void STPoint::set_s(const double s) { return set_y(s); }
void
STPoint
::
set_t
(
const
double
t
)
{
return
set_x
(
t
);
}
std
::
string
STPoint
::
DebugString
()
const
{
std
::
ostringstream
sout
;
sout
<<
"{
\"
s
\"
: "
<<
std
::
setprecision
(
6
)
<<
s
()
<<
",
\"
t
\"
: "
<<
std
::
setprecision
(
6
)
<<
t
()
<<
" }"
;
return
sout
.
str
();
return
apollo
::
common
::
util
::
StrCat
(
"{
\"
s
\"
: "
,
std
::
setprecision
(
6
),
s
(),
", "
"
\"
t
\"
: "
,
std
::
setprecision
(
6
),
t
(),
" }"
);
}
}
// namespace planning
...
...
modules/planning/reference_line/reference_point.cc
浏览文件 @
38e5c5ee
...
...
@@ -21,6 +21,7 @@
#include <string>
#include <vector>
#include "modules/common/util/string_util.h"
#include "modules/planning/reference_line/reference_point.h"
namespace
apollo
{
...
...
@@ -77,12 +78,14 @@ double ReferencePoint::lower_bound() const { return lower_bound_; }
double
ReferencePoint
::
upper_bound
()
const
{
return
upper_bound_
;
}
const
std
::
string
ReferencePoint
::
DebugString
()
const
{
std
::
stringstream
ss
;
ss
<<
"{x: "
<<
std
::
fixed
<<
x
()
<<
", y: "
<<
y
()
<<
", theta: "
<<
heading
()
<<
", kappa: "
<<
kappa
()
<<
", dkappa: "
<<
dkappa
()
<<
", upper_bound: "
<<
upper_bound
()
<<
", lower_bound: "
<<
lower_bound
()
<<
"}"
;
return
ss
.
str
();
return
apollo
::
common
::
util
::
StrCat
(
"{x: "
,
std
::
fixed
,
x
(),
", "
"y: "
,
y
(),
", "
"theta: "
,
heading
(),
", "
"kappa: "
,
kappa
(),
", "
"dkappa: "
,
dkappa
(),
", "
"upper_bound: "
,
upper_bound
(),
", "
"lower_bound: "
,
lower_bound
(),
"}"
);
}
}
// namespace planning
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录