Skip to content

Commit 0186384

Browse files
authored
Merge pull request #460 from ApexAI/iox-#337-create-PeriodicTask
Iox #337 create periodic task
2 parents 56e2f18 + 1d37360 commit 0186384

File tree

26 files changed

+425
-101
lines changed

26 files changed

+425
-101
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ build/
22
build_out_of_tree/
33
install/
44
/CMakeLists.txt
5+
clangd/
56
.vscode
67
/**/*.user
78
iceoryx_utils/doc/html/

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ The coverage scan applies to Quality level 3 and partly level 2 with branch cove
149149
For having a coverage report iceoryx needs to be compiled with coverage flags and the tests needs to be executed.
150150
You can do this with one command in iceroyx folder like this:
151151
```
152-
./tools/iceoryx_build_test.sh clean buildall -c <testlevel>
152+
./tools/iceoryx_build_test.sh clean build-all -c <testlevel>
153153
```
154-
Optionally you can use buildall option to get coverage for extensions like DDS or C-Binding.
154+
Optionally you can use build-all option to get coverage for extensions like DDS or C-Binding.
155155
The -c flag indicates that you want to have a coverage report and you can pass there the needed testlevel. Per default the testlevel is set to 'all'.
156156
example:
157157
```
158-
./tools/iceoryx_build_test.sh buildall clean -c unit
158+
./tools/iceoryx_build_test.sh build-all clean -c unit
159159
```
160160
For having only reports for unit-test. In the script tools/gcov/lcov_generate.sh is the initial scan, filtering and report generation automatically done.
161161

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ An example for such a "porcelain" API would be [ROS2](https://www.ros.org/). Oth
5454

5555
## Build and install
5656

57-
You can find the build and installation guidelines [here](doc/installation-guide.md).
57+
You can find the build and installation guidelines [here](doc/website/getting-started/installation.md).
5858

5959
## Examples
6060

61-
After you've built all the necessary things, you can continue playing around with the [examples](./iceoryx_examples).
61+
After you've built all the necessary things, you can continue playing around with the [examples](./iceoryx_examples/README.md).
6262

6363
## Build and run in a Docker environment
6464

doc/website/getting-started/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ The script currently only works for Linux and QNX, it is planned to offer a mult
104104
2. Build everything
105105
```
106106
cd iceoryx
107-
./tools/iceoryx_build_test.sh build_all
107+
./tools/iceoryx_build_test.sh build-all
108108
```
109109

110110
You can use the help for getting an overview over the available options:

iceoryx_examples/icedelivery/README.md

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
## Introduction
44

5-
This example showcases a one-way data transmission setup with zero-copy inter-process communication (IPC) on iceoryx.
6-
It provides publisher and subscriber applications. They come in two API flavours (untyped and typed).
5+
This example showcases a data transmission setup with zero-copy inter-process communication (IPC) on iceoryx.
6+
It provides publisher and subscriber applications. They come in two C++ API flavours (untyped and typed). Check icedelivery_on_c for the C API
77

88
## Run icedelivery
99

10-
Create three terminals and run one command in each of them. Choose one publisher and one subscriber and mix the typed and untyped versions.
10+
Create different terminals and run one command in each of them. Choose at least one publisher and one subscriber for having a data communication. You can also mix the typed and untyped versions. And if you feel like crazy today you start several publishers and subscribers from icedelivery and icedelivery_on_c (needs the default n:m communication, not possible if you build with the ONE_TO_MANY option)
1111
```sh
1212
# If installed and available in PATH environment variable
1313
iox-roudi
@@ -46,31 +46,27 @@ RouDi is ready for clients
4646
```
4747
2020-12-20 16:05:01.837 [ Debug ]: Application registered management segment 0x7fd6d39e3000 with size 64244064 to id 1
4848
2020-12-20 16:26:42.791 [ Info ]: Application registered payload segment 0x7f377c4e6000 with size 149134400 to id 2
49-
Sent {five,two} times value: (1, 1, 1)
50-
Sent {five,two} times value: (2, 2, 2)
51-
Sent {five,two} times value: (3, 3, 3)
49+
Sent {five,two} times value: 1
50+
Sent {five,two} times value: 2
51+
Sent {five,two} times value: 3
5252
```
5353

5454
### Subscriber application (typed)
5555
```
5656
2020-12-20 16:26:58.839 [ Debug ] Application registered management segment 0x7f6353c04000 with size 64244064 to id 1
5757
2020-12-20 16:26:58.839 [ Info ] Application registered payload segment 0x7f634ab8c000 with size 149134400 to id 2
5858
Not subscribed!
59-
Got value: (2, 2, 2)
60-
Got value: (2, 2, 2)
61-
Got value: (2, 2, 2)
62-
Got value: (2, 2, 2)
63-
Got value: (2, 2, 2)
64-
Didn't get a value, but do something anyway.
65-
Didn't get a value, but do something anyway.
66-
Didn't get a value, but do something anyway.
67-
Didn't get a value, but do something anyway.
68-
Didn't get a value, but do something anyway.
69-
Got value: (3, 3, 3)
70-
Got value: (3, 3, 3)
71-
Got value: (3, 3, 3)
72-
Got value: (3, 3, 3)
73-
Got value: (3, 3, 3)
59+
Got value: 2
60+
Got value: 2
61+
Got value: 2
62+
Got value: 2
63+
Got value: 2
64+
65+
Got value: 3
66+
Got value: 3
67+
Got value: 3
68+
Got value: 3
69+
Got value: 3
7470
7571
```
7672

@@ -79,18 +75,12 @@ Got value: (3, 3, 3)
7975
2020-12-20 16:26:58.839 [ Debug ] Application registered management segment 0x7f6353c04000 with size 64244064 to id 1
8076
2020-12-20 16:26:58.839 [ Info ] Application registered payload segment 0x7f634ab8c000 with size 149134400 to id 2
8177
Not subscribed!
82-
Got value: (2, 2, 2)
83-
Got value: (2, 2, 2)
84-
Didn't get a value, but do something anyway.
85-
Didn't get a value, but do something anyway.
86-
Didn't get a value, but do something anyway.
87-
Didn't get a value, but do something anyway.
88-
Didn't get a value, but do something anyway.
89-
Didn't get a value, but do something anyway.
90-
Didn't get a value, but do something anyway.
91-
Didn't get a value, but do something anyway.
92-
Got value: (3, 3, 3)
93-
Got value: (3, 3, 3)
78+
Got value: 2
79+
Got value: 2
80+
81+
82+
Got value: 3
83+
Got value: 3
9484
```
9585

9686
## Code walkthrough
@@ -293,8 +283,7 @@ need to take care about all cases, but it is advised to do so.
293283
In the `and_then` case the content of the sample is printed to the command line:
294284
```cpp
295285
auto object = static_cast<const RadarObject*>(sample->get());
296-
std::cout << "Got value: (" << object->x << ", " << object->y << ", " << object->z << ")"
297-
<< std::endl;
286+
std::cout << "Got value: " << object->x << std::endl;
298287
```
299288

300289
Please note the `static_cast` before reading out the data. It is necessary, because the untyped subscriber is unaware

iceoryx_examples/icedelivery/iox_publisher_typed.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ int main()
4242
iox::popo::TypedPublisher<RadarObject> typedPublisher({"Radar", "FrontLeft", "Object"});
4343
typedPublisher.offer();
4444

45-
float_t ct = 0.0;
45+
double ct = 0.0;
4646
while (!killswitch)
4747
{
4848
++ct;
@@ -96,7 +96,7 @@ int main()
9696
typedPublisher.publishResultOf(getRadarObject, ct);
9797
typedPublisher.publishResultOf([&ct](RadarObject* object) { *object = RadarObject(ct, ct, ct); });
9898

99-
std::cout << "Sent five times value: (" << ct << ", " << ct << ", " << ct << ")" << std::endl;
99+
std::cout << "Sent five times value: " << ct << std::endl;
100100

101101
std::this_thread::sleep_for(std::chrono::seconds(1));
102102
}

iceoryx_examples/icedelivery/iox_publisher_untyped.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ int main()
3737
iox::popo::UntypedPublisher untypedPublisher({"Radar", "FrontLeft", "Object"});
3838
untypedPublisher.offer();
3939

40-
float_t ct = 0.0;
40+
double ct = 0.0;
4141
while (!killswitch)
4242
{
4343
++ct;
@@ -73,7 +73,7 @@ int main()
7373
// Do something with error
7474
});
7575

76-
std::cout << "Sent two times value: (" << ct << ", " << ct << ", " << ct << ")" << std::endl;
76+
std::cout << "Sent two times value: " << ct << std::endl;
7777

7878
std::this_thread::sleep_for(std::chrono::seconds(1));
7979
}

iceoryx_examples/icedelivery/iox_publisher_with_history.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int main()
4141
iox::popo::TypedPublisher<RadarObject> typedPublisher({"Radar", "FrontLeft", "Object"}, publisherOptions);
4242
typedPublisher.offer();
4343

44-
float_t ct = 0.0;
44+
double ct = 0.0;
4545
while (!killswitch)
4646
{
4747
++ct;
@@ -55,6 +55,8 @@ int main()
5555
sample.publish();
5656
});
5757

58+
std::cout << "Sent value: " << ct << std::endl;
59+
5860
std::this_thread::sleep_for(std::chrono::milliseconds(400));
5961
}
6062

iceoryx_examples/icedelivery/iox_subscriber_typed.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,9 @@ int main()
4949
{
5050
typedSubscriber.take()
5151
.and_then([](iox::popo::Sample<const RadarObject>& object) {
52-
std::cout << "Got value: (" << object->x << ", " << object->y << ", " << object->z << ")"
53-
<< std::endl;
52+
std::cout << "Got value: " << object->x << std::endl;
5453
})
55-
.if_empty([] { std::cout << "Didn't get a value, but do something anyway." << std::endl; })
54+
.if_empty([] { std::cout << std::endl; })
5655
.or_else([](iox::popo::ChunkReceiveError) { std::cout << "Error receiving chunk." << std::endl; });
5756
}
5857
else

iceoryx_examples/icedelivery/iox_subscriber_untyped.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ int main()
5050
untypedSubscriber.take()
5151
.and_then([](iox::popo::Sample<const void>& sample) {
5252
auto object = static_cast<const RadarObject*>(sample.get());
53-
std::cout << "Got value: (" << object->x << ", " << object->y << ", " << object->z << ")"
54-
<< std::endl;
53+
std::cout << "Got value: " << object->x << std::endl;
5554
})
56-
.if_empty([] { std::cout << "Didn't get a value, but do something anyway." << std::endl; })
55+
.if_empty([] { std::cout << std::endl; })
5756
.or_else([](iox::popo::ChunkReceiveError) { std::cout << "Error receiving chunk." << std::endl; });
5857
}
5958
else

0 commit comments

Comments
 (0)