Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
af2bc3d7
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,发现更多精彩内容 >>
提交
af2bc3d7
编写于
12月 05, 2018
作者:
G
gruminions
提交者:
Jiangtao Hu
12月 13, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
framework: use default config while user does not write corresponding config
上级
7e35aadd
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
54 addition
and
64 deletion
+54
-64
cyber/conf/cyber.pb.conf
cyber/conf/cyber.pb.conf
+24
-24
cyber/proto/transport_conf.proto
cyber/proto/transport_conf.proto
+5
-5
cyber/transport/message/history.h
cyber/transport/message/history.h
+13
-25
cyber/transport/message/message_test.cc
cyber/transport/message/message_test.cc
+0
-2
cyber/transport/receiver/hybrid_receiver.h
cyber/transport/receiver/hybrid_receiver.h
+6
-2
cyber/transport/rtps/participant.cc
cyber/transport/rtps/participant.cc
+0
-3
cyber/transport/transmitter/hybrid_transmitter.h
cyber/transport/transmitter/hybrid_transmitter.h
+6
-3
未找到文件。
cyber/conf/cyber.pb.conf
浏览文件 @
af2bc3d7
...
...
@@ -6,30 +6,30 @@ log_conf {
color_log_to_stderr
:
true
}
transport_conf
{
shm_conf
{
# "multicast" "condition"
notifier_type
:
"multicast"
shm_locator
{
ip
:
"239.255.0.100"
port
:
8888
}
}
participant_attr
{
lease_duration
:
12
announcement_period
:
3
domain_id_gain
:
200
port_base
:
10000
}
communication_mode
{
same_proc
:
INTRA
diff_proc
:
SHM
diff_host
:
RTPS
}
resource_limit
{
max_history_depth
:
1000
}
}
#
transport_conf {
#
shm_conf {
#
# "multicast" "condition"
#
notifier_type: "multicast"
#
shm_locator {
#
ip: "239.255.0.100"
#
port: 8888
#
}
#
}
#
participant_attr {
#
lease_duration: 12
#
announcement_period: 3
#
domain_id_gain: 200
#
port_base: 10000
#
}
#
communication_mode {
#
same_proc: INTRA
#
diff_proc: SHM
#
diff_host: RTPS
#
}
#
resource_limit {
#
max_history_depth: 1000
#
}
#
}
run_mode_conf
{
run_mode
:
MODE_REALITY
...
...
cyber/proto/transport_conf.proto
浏览文件 @
af2bc3d7
...
...
@@ -20,10 +20,10 @@ message ShmConf {
};
message
RtpsParticipantAttr
{
optional
int32
lease_duration
=
1
;
optional
int32
announcement_period
=
2
;
optional
uint32
domain_id_gain
=
3
;
optional
uint32
port_base
=
4
;
optional
int32
lease_duration
=
1
[
default
=
12
]
;
optional
int32
announcement_period
=
2
[
default
=
3
]
;
optional
uint32
domain_id_gain
=
3
[
default
=
200
]
;
optional
uint32
port_base
=
4
[
default
=
10000
]
;
};
message
CommunicationMode
{
...
...
@@ -33,7 +33,7 @@ message CommunicationMode {
};
message
ResourceLimit
{
optional
uint32
max_history_depth
=
1
;
optional
uint32
max_history_depth
=
1
[
default
=
1000
]
;
};
message
TransportConf
{
...
...
cyber/transport/message/history.h
浏览文件 @
af2bc3d7
...
...
@@ -51,26 +51,24 @@ class History {
void
Add
(
const
MessagePtr
&
msg
,
const
MessageInfo
&
msg_info
);
void
Clear
();
void
GetCachedMessage
(
std
::
vector
<
CachedMessage
>*
msgs
);
size_t
GetSize
();
void
GetCachedMessage
(
std
::
vector
<
CachedMessage
>*
msgs
)
const
;
size_t
GetSize
()
const
;
uint32_t
depth
()
const
{
return
depth_
;
}
uint32_t
max_depth
()
const
{
return
max_depth_
;
}
bool
is_full
()
const
{
return
is_full_
;
}
private:
bool
enabled_
;
uint32_t
depth_
;
uint32_t
max_depth_
;
bool
is_full_
;
std
::
list
<
CachedMessage
>
msgs_
;
std
::
mutex
msgs_mutex_
;
mutable
std
::
mutex
msgs_mutex_
;
};
template
<
typename
MessageT
>
History
<
MessageT
>::
History
(
const
HistoryAttributes
&
attr
)
:
enabled_
(
false
),
max_depth_
(
1000
)
,
is_full_
(
false
)
{
auto
global_conf
=
common
::
GlobalData
::
Instance
()
->
Config
();
:
enabled_
(
false
),
max_depth_
(
1000
)
{
auto
&
global_conf
=
common
::
GlobalData
::
Instance
()
->
Config
();
if
(
global_conf
.
has_transport_conf
()
&&
global_conf
.
transport_conf
().
has_resource_limit
())
{
max_depth_
=
...
...
@@ -99,16 +97,9 @@ void History<MessageT>::Add(const MessagePtr& msg,
return
;
}
std
::
lock_guard
<
std
::
mutex
>
lock
(
msgs_mutex_
);
if
(
is_full_
)
{
msgs_
.
pop_front
();
}
msgs_
.
emplace_back
(
msg
,
msg_info
);
if
(
!
is_full_
)
{
if
(
msgs_
.
size
()
==
depth_
)
{
is_full_
=
true
;
}
while
(
msgs_
.
size
()
>
depth_
)
{
msgs_
.
pop_front
();
}
}
...
...
@@ -119,22 +110,19 @@ void History<MessageT>::Clear() {
}
template
<
typename
MessageT
>
void
History
<
MessageT
>::
GetCachedMessage
(
std
::
vector
<
CachedMessage
>*
msgs
)
{
void
History
<
MessageT
>::
GetCachedMessage
(
std
::
vector
<
CachedMessage
>*
msgs
)
const
{
if
(
msgs
==
nullptr
)
{
return
;
}
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
msgs_mutex_
);
msgs
->
reserve
(
msgs_
.
size
());
for
(
auto
&
item
:
msgs_
)
{
msgs
->
emplace_back
(
item
);
}
}
std
::
lock_guard
<
std
::
mutex
>
lock
(
msgs_mutex_
);
msgs
->
reserve
(
msgs_
.
size
());
msgs
->
insert
(
msgs
->
begin
(),
msgs_
.
begin
(),
msgs_
.
end
());
}
template
<
typename
MessageT
>
size_t
History
<
MessageT
>::
GetSize
()
{
size_t
History
<
MessageT
>::
GetSize
()
const
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
msgs_mutex_
);
return
msgs_
.
size
();
}
...
...
cyber/transport/message/message_test.cc
浏览文件 @
af2bc3d7
...
...
@@ -94,7 +94,6 @@ TEST(HistoryTest, history_test) {
history
.
Add
(
message
,
message_info
);
EXPECT_EQ
(
1
,
history
.
GetSize
());
message_info
.
set_seq_num
(
1
);
EXPECT_FALSE
(
history
.
is_full
());
int
depth
=
10
;
HistoryAttributes
attr2
(
proto
::
QosHistoryPolicy
::
HISTORY_KEEP_LAST
,
depth
);
...
...
@@ -106,7 +105,6 @@ TEST(HistoryTest, history_test) {
message_info
.
set_seq_num
(
i
);
history2
.
Add
(
message
,
message_info
);
}
EXPECT_TRUE
(
history2
.
is_full
());
std
::
vector
<
History
<
RawMessage
>::
CachedMessage
>
messages
;
history2
.
GetCachedMessage
(
nullptr
);
history2
.
GetCachedMessage
(
&
messages
);
...
...
cyber/transport/receiver/hybrid_receiver.h
浏览文件 @
af2bc3d7
...
...
@@ -170,8 +170,12 @@ void HybridReceiver<M>::InitMode() {
template
<
typename
M
>
void
HybridReceiver
<
M
>::
ObtainConfig
()
{
auto
&
global_conf
=
common
::
GlobalData
::
Instance
()
->
Config
();
RETURN_IF
(
!
global_conf
.
has_transport_conf
());
RETURN_IF
(
!
global_conf
.
transport_conf
().
has_communication_mode
());
if
(
!
global_conf
.
has_transport_conf
())
{
return
;
}
if
(
!
global_conf
.
transport_conf
().
has_communication_mode
())
{
return
;
}
mode_
->
CopyFrom
(
global_conf
.
transport_conf
().
communication_mode
());
mapping_table_
[
SAME_PROC
]
=
mode_
->
same_proc
();
...
...
cyber/transport/rtps/participant.cc
浏览文件 @
af2bc3d7
...
...
@@ -81,9 +81,6 @@ void Participant::CreateFastRtpsParticipant(
if
(
global_conf
.
has_transport_conf
()
&&
global_conf
.
transport_conf
().
has_participant_attr
())
{
part_attr_conf
->
CopyFrom
(
global_conf
.
transport_conf
().
participant_attr
());
}
else
{
AERROR
<<
"No rtps participant attr conf."
;
return
;
}
eprosima
::
fastrtps
::
ParticipantAttributes
attr
;
...
...
cyber/transport/transmitter/hybrid_transmitter.h
浏览文件 @
af2bc3d7
...
...
@@ -182,9 +182,12 @@ void HybridTransmitter<M>::InitMode() {
template
<
typename
M
>
void
HybridTransmitter
<
M
>::
ObtainConfig
()
{
auto
&
global_conf
=
common
::
GlobalData
::
Instance
()
->
Config
();
RETURN_IF
(
!
global_conf
.
has_transport_conf
());
RETURN_IF
(
!
global_conf
.
transport_conf
().
has_communication_mode
());
if
(
!
global_conf
.
has_transport_conf
())
{
return
;
}
if
(
!
global_conf
.
transport_conf
().
has_communication_mode
())
{
return
;
}
mode_
->
CopyFrom
(
global_conf
.
transport_conf
().
communication_mode
());
mapping_table_
[
SAME_PROC
]
=
mode_
->
same_proc
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录