You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ROS 2 parameter allow the user to create variables on a node and manipulate/read them with different ROS2 commands. Further information about ROS 2 parameters can be found [here](https://docs.ros.org/en/galactic/Tutorials/Parameters/Understanding-ROS2-Parameters.html)
8
7
9
-
## <aname="parameters_server"/>Creating a parameter server
10
-
8
+
Ready to use code related to this tutorial can be found in [`micro-ROS-demos/rclc/parameter_server`](https://github.com/micro-ROS/micro-ROS-demos/blob/galactic/rclc/parameter_server/main.c) folder. Fragments of code from this example is used on this tutorial.
11
9
12
-
```C
13
-
// Parameter server object
14
-
rclc_parameter_server_t param_server;
10
+
Note: micro-ROS parameter server is only supported on ROS2 galactic distribution
15
11
16
-
// Initialize parameter server with default configuration
The variable `RCLC_PARAMETER_EXECUTOR_HANDLES_NUMBER` defines the RCLC executor handles required for a parameter server.
48
+
This needs to be taken into account when initializing the executor and on the colcon memory configuration of the `rmw-microxredds` package, which will need atleast 4 services and 1 publisher:
49
+
50
+
```C
51
+
# colcon.meta example with minimum memory requirements to use parameter server
52
+
{
53
+
"names": {
54
+
"rmw_microxrcedds": {
55
+
"cmake-args": [
56
+
"-DRMW_UXRCE_MAX_NODES=1",
57
+
"-DRMW_UXRCE_MAX_PUBLISHERS=1",
58
+
"-DRMW_UXRCE_MAX_SUBSCRIPTIONS=0",
59
+
"-DRMW_UXRCE_MAX_SERVICES=4",
60
+
"-DRMW_UXRCE_MAX_CLIENTS=0"
61
+
]
62
+
}
63
+
}
64
+
}
65
+
```
66
+
67
+
```C
68
+
// Executor init example with the minimum RCLC executor handles required
Once the parameter server and the executor are initialized, the parameter server must be added to the executor in order to accept parameters commands from ROS2:
106
+
```C
64
107
// Add parameter server to executor including defined callback
ROS 2 publishers and subscribers are the basic communication mechanism between nodes using topics. Further information about ROS 2 publish–subscribe pattern can be found [here](https://docs.ros.org/en/foxy/Tutorials/Topics/Understanding-ROS2-Topics.html)
7
+
8
+
Ready to use code related to this tutorial can be found in [`micro-ROS-demos/rclc/int32_publisher`](https://github.com/micro-ROS/micro-ROS-demos/blob/foxy/rclc/int32_publisher/main.c) and [`micro-ROS-demos/rclc/int32_subscriber`](https://github.com/micro-ROS/micro-ROS-demos/blob/foxy/rclc/int32_subscriber/main.c) folders. Fragments of code from this examples are used on this tutorial.
9
+
6
10
## <aname="pub"/>Publisher
7
11
8
12
### <aname="pub_init"/>Initialization
9
13
10
-
Starting from a code where RCL is initialized and a micro-ROS node is created, there are tree ways to initialize a publisher:
14
+
Starting from a code where RCL is initialized and a micro-ROS node is created, there are tree ways to initialize a publisher depending on the desired quality-of-service configuration:
11
15
12
16
// TODO: explain and link diferences between each approach on QoS section
Reliable publishers will wait for confirmation for each published message, which leads to blocking `rcl_publish` calls. The `rmw-microxrcedds` offer an API to configure the acknowledgement timeout for each publisher:
35
+
36
+
// TODO: move to micro-ROS features section?
37
+
Reliable publishers will wait for confirmation for each published message, which leads to blocking `rcl_publish` calls, `rmw-microxrcedds` offers an API to configure the acknowledgement timeout for each publisher:
Once the subscriber and the executor are initialized, the subscriber callback must be added to the executor to receive incoming publications once the executor is spinning:
215
210
216
211
```C
217
-
// Message object
212
+
// Message object to save publication data
218
213
std_msgs__msg__Int32 msg;
219
214
220
215
// Add subscription to the executor
@@ -234,7 +229,8 @@ Destroys any automatically created infrastructure and deallocates memory.
Copy file name to clipboardExpand all lines: _docs/tutorials/programming_rcl_rclc/service/services.md
+28-2Lines changed: 28 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,8 +33,21 @@ Starting from a code where RCL is initialized and a micro-ROS node is created, t
33
33
}
34
34
```
35
35
36
-
// TODO: Add timeout API for reliable service
36
+
A reliable service server will wait for confirmation for each response sended, which can increase the blocking time of the executor spins, `rmw-microxrcedds` offers an API to configure the acknowledgement timeout for each service:
The default value for all clients is configured at compilation time by the cmake variable `RMW_UXRCE_PUBLISH_RELIABLE_TIMEOUT`.
50
+
38
51
- Best effort:
39
52
40
53
```C
@@ -154,8 +167,21 @@ The service client initialization is almost identical to the server one:
154
167
}
155
168
```
156
169
157
-
// TODO: Add timeout API for reliable service
170
+
A reliable service client will wait for confirmation for each request sended, which can increase the blocking time of the executor spins, `rmw-microxrcedds` offers an API to configure the acknowledgement timeout for each client:
0 commit comments