Skip to content

Commit c0ae84a

Browse files
Move programming with rcl and rclc before advanced tutorials. (#339)
* Moved Programming with rcl and rclc tutorial section before Advanced tutorials. Signed-off-by: Ralph Lange <ralph.lange@de.bosch.com> * Added badges for distro status to individual programming with rcl and rclc tutorials. Signed-off-by: Ralph Lange <ralph.lange@de.bosch.com> * Fixed links to programming with rcl and rclc tutorial section. * Updated distro status badges for rclc parameter server. Signed-off-by: Ralph Lange <ralph.lange@de.bosch.com> * Fix code identation Co-authored-by: Antonio cuadros <acuadros1995@gmail.com>
1 parent 3cff4d9 commit c0ae84a

11 files changed

Lines changed: 73 additions & 60 deletions

File tree

_data/docs.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@
5353
- tutorials/core/zephyr_emulator
5454
- tutorials/core/teensy_with_arduino
5555

56+
- title: Programming with rcl and rclc
57+
docs:
58+
- tutorials/programming_rcl_rclc/overview
59+
- tutorials/programming_rcl_rclc/node
60+
- tutorials/programming_rcl_rclc/pub_sub
61+
- tutorials/programming_rcl_rclc/service
62+
- tutorials/programming_rcl_rclc/parameters
63+
- tutorials/programming_rcl_rclc/executor
64+
- tutorials/programming_rcl_rclc/qos
65+
- tutorials/programming_rcl_rclc/micro-ROS
66+
5667
- title: Advanced Tutorials
5768
docs:
5869
- tutorials/advanced/overview
@@ -65,17 +76,6 @@
6576
- tutorials/advanced/benchmarking
6677
- tutorials/advanced/tracing
6778

68-
- title: Programming with rcl and rclc
69-
docs:
70-
- tutorials/programming_rcl_rclc/overview
71-
- tutorials/programming_rcl_rclc/node
72-
- tutorials/programming_rcl_rclc/pub_sub
73-
- tutorials/programming_rcl_rclc/service
74-
- tutorials/programming_rcl_rclc/parameters
75-
- tutorials/programming_rcl_rclc/executor
76-
- tutorials/programming_rcl_rclc/qos
77-
- tutorials/programming_rcl_rclc/micro-ROS
78-
7979
- title: Unmaintained Tutorials
8080
docs:
8181
- tutorials/old/microros_nuttx_bsp

_docs/concepts/client_library/features/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ The micro-ROS Client Library, formed by standard [ROS 2 Client Support Library (
1313
* Lifecycle
1414
* Parameters
1515

16-
Most features are already available in the Foxy release. Please see our [Feature Overview page](/docs/overview/features/) for details on the status. To learn developing your own application nodes with rcl + rclc, please head to the corresponding [programming tutorial](/docs/tutorials/core/programming_rcl_rclc/).
16+
Most features are already available in the Foxy release. Please see our [Feature Overview page](/docs/overview/features/) for details on the status. To learn developing your own application nodes with rcl + rclc, please head to the corresponding [programming tutorial](/docs/tutorials/programming_rcl_rclc/).

_docs/tutorials/core/overview/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ redirect_from:
66
- /docs/tutorials/
77
---
88

9-
This chapter provides the user with a number of tutorials to learn micro-ROS and relevant tools for the different RTOSes supported by micro-ROS. In the [**Advanced Tutorials**](../../advanced/overview/) section, you'll find more advanced tutorials to strenghten your micro-ROS knowledge.
10-
11-
If you are new to micro-ROS, we strongly suggest that you take the tutorials in the following order:
9+
This chapter provides a number of tutorials to learn micro-ROS and relevant tools for the different RTOSes supported by micro-ROS. If you are new to micro-ROS, we strongly suggest that you take the tutorials in the following order:
1210

1311
* [**First micro-ROS application on Linux**](../first_application_linux/)
1412

@@ -18,14 +16,16 @@ If you are new to micro-ROS, we strongly suggest that you take the tutorials in
1816

1917
In this tutorial, you will learn how to build the application from the previous tutorial for an Real-Time Operating System (RTOS). You will see how to flash a microcontroller board with the application and how to communicate with it from a microprocessor running ROS 2 on Linux. (The tutorial covers all three RTOS supported by micro-ROS, namely NuttX, FreeRTOS, and Zephyr. The choice is up to you!)
2018

21-
* [**Programming with rcl and rclc**](../programming_rcl_rclc/)
19+
Then, at this point, you may head over to the next section [**Programming with rcl and rclc**](../../programming_rcl_rclc/), where you 'll learn the concepts of the micro-ROS C API in this tutorial in depth. If you are already familiar with the ROS 2 C++ API or even the underlying ROS Client Support Library (rcl), you'll learn this very quickly.
2220

23-
You'll learn the concepts of the micro-ROS C API in this tutorial in depth. If you are already familiar with the ROS 2 C++ API or even the underlying ROS Client Support Library (rcl), you'll learn this very quickly.
21+
In case you are using the corresponding RTOS or hardware, the following basic tutorials may be interesting before switching to the [**Programming with rcl and rclc**](../../programming_rcl_rclc/) section:
2422

2523
* [**Zephyr Emulator**](../zephyr_emulator/)
2624

2725
In this tutorial, you'll learn the use of micro-ROS with Zephyr emulator by testing a Ping Pong application.
2826

2927
* [**Teensy with Arduino**](../teensy_with_arduino/)
3028

31-
In this tutorial you will learn how to connect Teensy with micro-ROS and ROS2. You will also learn how to install micro-ROS agent in linux systems to communicate with Teensy based arduino board using Arduino IDE. This tutorial will also cover a simple publisher topic published from teensy and subscribed using ROS2 interface.
29+
In this tutorial you will learn how to connect Teensy with micro-ROS and ROS 2. You will also learn how to install micro-ROS agent in linux systems to communicate with Teensy based arduino board using Arduino IDE. This tutorial will also cover a simple publisher topic published from teensy and subscribed using ROS2 interface.
30+
31+
In the [**Advanced Tutorials**](../../advanced/overview/) section, you'll find more advanced tutorials to strenghten your micro-ROS knowledge.

_docs/tutorials/programming_rcl_rclc/executor/executor.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Executor and timers
33
permalink: /docs/tutorials/programming_rcl_rclc/executor/
44
---
55

6+
<img src="https://img.shields.io/badge/Written_for-Foxy-green" style="display:inline"/> <img src="https://img.shields.io/badge/Tested_on-Galactic-green" style="display:inline"/> <img src="https://img.shields.io/badge/Tested_on-Rolling-green" style="display:inline"/>
7+
68
- [Timers](#timers)
79
- [Initialization](#initialization)
810
- [Callback](#callback)

_docs/tutorials/programming_rcl_rclc/micro-ROS/micro-ROS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ title: micro-ROS utilities
33
permalink: /docs/tutorials/programming_rcl_rclc/micro-ROS/
44
---
55

6-
// TODO: Change section name
6+
<!-- TODO: Change section name -->
77

8+
<img src="https://img.shields.io/badge/Written_for-Galactic-green" style="display:inline"/> <img src="https://img.shields.io/badge/Tested_on-Rolling-green" style="display:inline"/>
9+
810
- [Allocators](#allocators)
911
- [Custom allocator](#custom-allocator)
1012
- [Time sync](#time-sync)

_docs/tutorials/programming_rcl_rclc/node/node.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Nodes
33
permalink: /docs/tutorials/programming_rcl_rclc/node/
44
---
55

6+
<img src="https://img.shields.io/badge/Written_for-Foxy-green" style="display:inline"/> <img src="https://img.shields.io/badge/Tested_on-Galactic-green" style="display:inline"/> <img src="https://img.shields.io/badge/Tested_on-Rolling-green" style="display:inline"/>
7+
68
ROS 2 nodes are the main participants on ROS 2 ecosystem. They will communicate between each other using publishers, subscriptions, services, etc. Further information about ROS 2 nodes can be found [here](https://docs.ros.org/en/galactic/Tutorials/Understanding-ROS2-Nodes.html)
79

810

_docs/tutorials/programming_rcl_rclc/overview/index.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ redirect_from:
55
- /docs/tutorials/programming_rcl_rclc/
66
---
77

8-
<img src="https://img.shields.io/badge/Written_for-Foxy-green" style="display:inline"/> <img src="https://img.shields.io/badge/Tested_on-Galactic-green" style="display:inline"/> <img src="https://img.shields.io/badge/Tested_on-Rolling-green" style="display:inline"/>
9-
108
In this section, you'll learn the basics of the micro-ROS C API: **rclc**.
119

1210
The major concepts (publishers, subscriptions, services, timers, ...) are identical with ROS 2. They even rely on the *same* implementation, as the micro-ROS C API is based on the ROS 2 client support library (rcl), enriched with a set of convenience functions by the package [rclc](https://github.com/ros2/rclc/). That is, rclc does not add a new layer of types on top of rcl (like rclcpp and rclpy do) but only provides functions that ease the programming with the rcl types. New types are introduced only for concepts that are missing in rcl, such as the concept of an executor.
@@ -16,5 +14,5 @@ The major concepts (publishers, subscriptions, services, timers, ...) are identi
1614
* [**Services**](../service/)
1715
* [**Parameters**](../parameters/)
1816
* [**Executor and timers**](../executor/)
19-
* [**QoS**](../qos/)
20-
* [**micro-ROS Utils**](../micro-ROS/)
17+
* [**Quality of service**](../qos/)
18+
* [**micro-ROS utilities**](../micro-ROS/)

_docs/tutorials/programming_rcl_rclc/parameters/parameters.md

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ title: Parameter server
33
permalink: /docs/tutorials/programming_rcl_rclc/parameters/
44
---
55

6+
<img src="https://img.shields.io/badge/Written_for-Galactic-green" style="display:inline"/> <img src="https://img.shields.io/badge/Tested_on-Rolling-green" style="display:inline"/>
7+
68
ROS 2 parameters 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)
79

810
Ready to use code related to this tutorial can be found in [`rclc/rclc_examples/src/example_parameter_server.c`](https://github.com/ros2/rclc/blob/master/rclc_examples/src/example_parameter_server.c). Fragments of code from this example is used on this tutorial.
911

10-
Note: micro-ROS parameter server is only supported on ROS2 galactic distribution
12+
Note: micro-ROS parameter server is only supported on ROS 2 Galactic distribution
1113

1214
- [Initialization](#initialization)
1315
- [Memory requirements](#memory-requirements)
@@ -54,6 +56,7 @@ Note: micro-ROS parameter server is only supported on ROS2 galactic distribution
5456
```
5557

5658
## Memory requirements
59+
5760
The parameter server uses 4 services and an optional publisher, this needs to be taken into account on the `rmw-microxredds` package memory configuration:
5861

5962
```json
@@ -132,55 +135,55 @@ rc = rclc_executor_add_parameter_server(&executor, &param_server, NULL);
132135
micro-ROS parameter server supports the following parameter types:
133136

134137
- Boolean:
135-
```c
136-
const char * parameter_name = "parameter_bool";
137-
bool param_value = true;
138+
```c
139+
const char * parameter_name = "parameter_bool";
140+
bool param_value = true;
138141

139-
// Add parameter to the server
140-
rcl_ret_t rc = rclc_add_parameter(&param_server, parameter_name, RCLC_PARAMETER_BOOL);
142+
// Add parameter to the server
143+
rcl_ret_t rc = rclc_add_parameter(&param_server, parameter_name, RCLC_PARAMETER_BOOL);
141144

142-
// Set parameter value (Triggers parameter change callback)
143-
rc = rclc_parameter_set_bool(&param_server, parameter_name, param_value);
145+
// Set parameter value (Triggers parameter change callback)
146+
rc = rclc_parameter_set_bool(&param_server, parameter_name, param_value);
144147

145-
// Get parameter value on param_value
146-
rc = rclc_parameter_get_bool(&param_server, "param1", &param_value);
148+
// Get parameter value on param_value
149+
rc = rclc_parameter_get_bool(&param_server, "param1", &param_value);
147150

148-
if (RCL_RET_OK != rc) {
149-
... // Handle error
150-
return -1;
151-
}
152-
```
151+
if (RCL_RET_OK != rc) {
152+
... // Handle error
153+
return -1;
154+
}
155+
```
153156

154157
- Integer:
155-
```c
156-
const char * parameter_name = "parameter_int";
157-
int param_value = 100;
158+
```c
159+
const char * parameter_name = "parameter_int";
160+
int param_value = 100;
158161

159-
// Add parameter to the server
160-
rcl_ret_t rc = rclc_add_parameter(&param_server, parameter_name, RCLC_PARAMETER_INT);
162+
// Add parameter to the server
163+
rcl_ret_t rc = rclc_add_parameter(&param_server, parameter_name, RCLC_PARAMETER_INT);
161164

162-
// Set parameter value
163-
rc = rclc_parameter_set_int(&param_server, parameter_name, param_value);
165+
// Set parameter value
166+
rc = rclc_parameter_set_int(&param_server, parameter_name, param_value);
164167

165-
// Get parameter value on param_value
166-
rc = rclc_parameter_get_int(&param_server, parameter_name, &param_value);
167-
```
168+
// Get parameter value on param_value
169+
rc = rclc_parameter_get_int(&param_server, parameter_name, &param_value);
170+
```
168171

169172
- Double:
170-
```c
171-
const char * parameter_name = "parameter_double";
172-
double param_value = 0.15;
173-
174-
// Add parameter to the server
175-
rcl_ret_t rc = rclc_add_parameter(&param_server, parameter_name, RCLC_PARAMETER_DOUBLE);
173+
```c
174+
const char * parameter_name = "parameter_double";
175+
double param_value = 0.15;
176176

177-
// Set parameter value
178-
rc = rclc_parameter_set_double(&param_server, parameter_name, param_value);
177+
// Add parameter to the server
178+
rcl_ret_t rc = rclc_add_parameter(&param_server, parameter_name, RCLC_PARAMETER_DOUBLE);
179179

180-
// Get parameter value on param_value
181-
rc = rclc_parameter_get_double(&param_server, parameter_name, &param_value);
182-
```
180+
// Set parameter value
181+
rc = rclc_parameter_set_double(&param_server, parameter_name, param_value);
183182

183+
// Get parameter value on param_value
184+
rc = rclc_parameter_get_double(&param_server, parameter_name, &param_value);
185+
```
186+
184187
## Cleaning up
185188

186189
To destroy an initialized parameter server:

_docs/tutorials/programming_rcl_rclc/pub_sub/pub_sub.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
---
2-
title: Publishers and Subscribers
2+
title: Publishers and subscribers
33
permalink: /docs/tutorials/programming_rcl_rclc/pub_sub/
44
---
55

6+
<img src="https://img.shields.io/badge/Written_for-Foxy-green" style="display:inline"/> <img src="https://img.shields.io/badge/Tested_on-Galactic-green" style="display:inline"/> <img src="https://img.shields.io/badge/Tested_on-Rolling-green" style="display:inline"/>
7+
68
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).
79

810
Ready to use code related to this concepts 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.

_docs/tutorials/programming_rcl_rclc/qos/QoS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Quality of service
33
permalink: /docs/tutorials/programming_rcl_rclc/qos/
44
---
55

6+
<img src="https://img.shields.io/badge/Written_for-Foxy-green" style="display:inline"/> <img src="https://img.shields.io/badge/Tested_on-Galactic-green" style="display:inline"/> <img src="https://img.shields.io/badge/Tested_on-Rolling-green" style="display:inline"/>
7+
68
- [Reliable QoS](#reliable-qos)
79
- [Best Effort](#best-effort)
810
- [Custom QoS configuration](#custom-qos-configuration)

0 commit comments

Comments
 (0)