source: pacpustutorials/exercises/exercise_2/exercise_2.txt@ 9

Last change on this file since 9 was 9, checked in by DHERBOMEZ Gérald, 9 years ago

update tutorials

File size: 2.2 KB
Line 
1author: Gerald Dherbomez
2copyright: Heudiasyc UMR UTC/CNRS 7253
3
4Exercise 2: Managing the communication of components together
5-------------------------------------------------------------
6
7
8Exercise 2.1: communication between components
9----------------------------------------------
10
11In this exercise we will develop a new component with one input and one output. The component should add a specific number defined as a parameter to the input value and provide the result as output. Before sending the result on the output it must wait for 1 second. The component will print to the terminal the result of the addition too.
12
13Write the code of this component in a new plugin but use the same pacpus project as the exercise 1. Build and install the plugin in the PACPUS_ROOT/bin folder and execute the plugin with the PacpusSensor application.
14
15Indication:
16- Now, the tree of your project may be something like that:
17
18pacpustutorials
19 |
20 |--> exercises
21 |
22 |--> exercise_1
23 |
24 |--> CMakeLists.txt
25 |--> MessageComponent.h
26 |--> MessageComponent.cpp
27 |
28 |--> exercise_2
29 |
30 |--> CMakeLists.txt
31 |--> AdditionComponent.h
32 |--> AdditionComponent.cpp
33 |
34 |--> build
35 |
36 |--> build_linux.sh
37 |
38 |--> CMakeLists.txt
39
40
41
42Exercise 2.2: communication of variable size data
43-----------------------------------------------
44Create a new component in the same plugin as the previous one (exercise 2.1). It will have the same functionnality with the difference that it can do an addition on a vector of input values.
45
46Build, install and run this new component.
47
48Indication :
49- you can use the QVector class as input/output type.
50
51
52
53Exercise 2.3: Threaded component
54--------------------------------
55From the component written in exercise 2.2 create a new component with the same interface. The addition must be done in a separate thread.
56
57Build, install and run this new component.
58
59Indication :
60- Your component must inherit from the QThread class.
61- Take care of the protection of the data to guarantee a thread safe execution.
62
63
64
Note: See TracBrowser for help on using the repository browser.