Skip to content

Commit 3d1bed8

Browse files
alsoramlanting
authored andcommitted
New intra-process communication design (ros2#239)
Signed-off-by: Soragna, Alberto <[email protected]>
1 parent 24f764d commit 3d1bed8

File tree

7 files changed

+625
-0
lines changed

7 files changed

+625
-0
lines changed

articles/intraprocess_communication.md

Lines changed: 498 additions & 0 deletions
Large diffs are not rendered by default.
48.1 KB
Loading
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
@startuml
2+
3+
participant Publisher
4+
participant IntraProcessManager
5+
participant IntraProcessImpl
6+
collections Subscriptions
7+
participant ROS_Middleware
8+
9+
[-> Publisher: publish(unique_msg)
10+
11+
Publisher -> Publisher : promote unique_msg \nto shared_msg
12+
13+
Publisher -> IntraProcessManager : do_intra_process_publish(\nid, shared_msg)
14+
15+
IntraProcessManager -> IntraProcessImpl : get_subscription_ids_for_pub(id)
16+
17+
IntraProcessImpl --> IntraProcessManager : take_shared_ids, take_owned_ids
18+
19+
note left
20+
these are lists of subscriptions
21+
with QoS compatible with publisher
22+
divided according to the type
23+
stored in their buffers
24+
end note
25+
26+
loop for id : take_shared_ids
27+
IntraProcessManager -> IntraProcessImpl : get_subscription(id)
28+
29+
IntraProcessManager -> Subscriptions : add_message_to_buffer(shared_msg)
30+
31+
IntraProcessManager -> Subscriptions : trigger_guard_condition()
32+
end
33+
34+
alt take_ownership_ids.size() > 0
35+
36+
IntraProcessManager -> IntraProcessManager : copy shared_msg \n to unique_msg
37+
38+
loop for id : take_owned_ids
39+
40+
IntraProcessManager -> IntraProcessImpl : get_subscription(id)
41+
42+
IntraProcessManager -> IntraProcessManager : Copy unique_msg\n (except last iter)
43+
44+
IntraProcessManager -> Subscriptions : add_message_to_buffer(unique_msg)
45+
46+
IntraProcessManager -> Subscriptions : trigger_guard_condition()
47+
end
48+
49+
end
50+
51+
Publisher -> ROS_Middleware : do_inter_process_publish(shared_msg.get())
52+
53+
@enduml
61.6 KB
Loading
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
@startuml
2+
3+
participant Publisher
4+
participant IntraProcessManager
5+
participant IntraProcessImpl
6+
collections Subscriptions
7+
8+
[-> Publisher: publish(unique_msg)
9+
10+
Publisher -> IntraProcessManager : do_intra_process_publish(\nid, unique_msg)
11+
12+
IntraProcessManager -> IntraProcessImpl : get_subscription_ids_for_pub(id)
13+
14+
IntraProcessImpl --> IntraProcessManager : take_shared_ids, take_owned_ids
15+
note left
16+
these are lists of subscriptions
17+
with QoS compatible with publisher
18+
divided according to the type
19+
stored in their buffers
20+
end note
21+
22+
alt take_owned_ids.size() == 0
23+
24+
IntraProcessManager -> IntraProcessManager : promote unique_msg \nto shared_msg
25+
26+
loop for id : take_shared_ids
27+
IntraProcessManager -> IntraProcessImpl : get_subscription(id)
28+
29+
IntraProcessManager -> Subscriptions : add_message_to_buffer(shared_msg)
30+
31+
IntraProcessManager -> Subscriptions : trigger_guard_condition()
32+
end
33+
34+
else take_owned_ids.size() > 0 && take_shared_ids.size() <= 1
35+
36+
loop for id : (take_shared_ids + take_owned_ids)
37+
38+
IntraProcessManager -> IntraProcessImpl : get_subscription(id)
39+
40+
IntraProcessManager -> IntraProcessManager : Copy unique_msg\n (except last iter)
41+
42+
IntraProcessManager -> Subscriptions : add_message_to_buffer(unique_msg)
43+
44+
IntraProcessManager -> Subscriptions : trigger_guard_condition()
45+
end
46+
47+
48+
else take_owned_ids.size() > 0 && take_shared_ids.size() > 1
49+
50+
IntraProcessManager -> IntraProcessManager : copy unique_msg to shared_msg
51+
52+
loop for id : take_shared_ids
53+
IntraProcessManager -> IntraProcessImpl : get_subscription(id)
54+
55+
IntraProcessManager -> Subscriptions : add_message_to_buffer(shared_msg)
56+
57+
IntraProcessManager -> Subscriptions : trigger_guard_condition()
58+
end
59+
60+
loop for id : take_owned_ids
61+
62+
IntraProcessManager -> IntraProcessImpl : get_subscription(id)
63+
64+
IntraProcessManager -> IntraProcessManager : Copy unique_msg\n (except last iter)
65+
66+
IntraProcessManager -> Subscriptions : add_message_to_buffer(unique_msg)
67+
68+
IntraProcessManager -> Subscriptions : trigger_guard_condition()
69+
end
70+
71+
72+
end
73+
74+
@enduml
47 KB
Loading
42.4 KB
Loading

0 commit comments

Comments
 (0)