Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
ef93d365
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,发现更多精彩内容 >>
提交
ef93d365
编写于
7月 14, 2017
作者:
S
siyangy
提交者:
Dong Li
7月 15, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Small code tweaks in can_receiver
上级
39f76495
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
12 deletion
+12
-12
modules/canbus/can_comm/can_receiver.cc
modules/canbus/can_comm/can_receiver.cc
+12
-12
未找到文件。
modules/canbus/can_comm/can_receiver.cc
浏览文件 @
ef93d365
...
...
@@ -57,8 +57,8 @@ void CanReceiver::RecvThreadFunc() {
while
(
IsRunning
())
{
std
::
vector
<
CanFrame
>
buf
;
int32_t
length
=
MAX_CAN_RECV_FRAME_LEN
;
if
(
can_client_
->
Receive
(
&
buf
,
&
length
)
!=
ErrorCode
::
OK
)
{
int32_t
frame_num
=
MAX_CAN_RECV_FRAME_LEN
;
if
(
can_client_
->
Receive
(
&
buf
,
&
frame_num
)
!=
ErrorCode
::
OK
)
{
LOG_IF_EVERY_N
(
ERROR
,
receive_error_count
++
>
ERROR_COUNT_MAX
,
ERROR_COUNT_MAX
)
<<
"Received "
<<
receive_error_count
<<
" error messages."
;
...
...
@@ -67,13 +67,13 @@ void CanReceiver::RecvThreadFunc() {
}
receive_error_count
=
0
;
if
(
buf
.
size
()
!=
static_cast
<
size_t
>
(
length
))
{
if
(
buf
.
size
()
!=
static_cast
<
size_t
>
(
frame_num
))
{
AERROR
<<
"Receiver buf size["
<<
buf
.
size
()
<<
"] does not match can_client returned length["
<<
length
<<
"] does not match can_client returned length["
<<
frame_num
<<
"]."
;
}
if
(
length
==
0
)
{
if
(
frame_num
==
0
)
{
LOG_IF_EVERY_N
(
ERROR
,
receive_none_count
++
>
ERROR_COUNT_MAX
,
ERROR_COUNT_MAX
)
<<
"Received "
<<
receive_none_count
<<
" empty messages."
;
...
...
@@ -82,16 +82,16 @@ void CanReceiver::RecvThreadFunc() {
}
receive_none_count
=
0
;
for
(
int32_t
i
=
0
;
i
<
length
;
++
i
)
{
uint8_t
len
=
buf
.
at
(
i
)
.
len
;
uint32_t
uid
=
buf
.
at
(
i
)
.
id
;
uint8_t
*
data
=
buf
.
at
(
i
)
.
data
;
for
(
const
auto
&
frame
:
buf
)
{
uint8_t
len
=
frame
.
len
;
uint32_t
uid
=
frame
.
id
;
const
uint8_t
*
data
=
frame
.
data
;
struct
timeval
timestamp
;
timestamp
.
tv_sec
=
buf
.
at
(
i
)
.
timestamp
.
tv_sec
;
timestamp
.
tv_usec
=
buf
.
at
(
i
)
.
timestamp
.
tv_usec
;
timestamp
.
tv_sec
=
frame
.
timestamp
.
tv_sec
;
timestamp
.
tv_usec
=
frame
.
timestamp
.
tv_usec
;
pt_manager_
->
Parse
(
uid
,
data
,
len
,
timestamp
);
if
(
enable_log_
)
{
ADEBUG
<<
"recv_can_frame#"
<<
buf
.
at
(
i
)
.
CanFrameString
();
ADEBUG
<<
"recv_can_frame#"
<<
frame
.
CanFrameString
();
}
}
std
::
this_thread
::
yield
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录