Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions _data/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@
- tutorials/core/zephyr_emulator
- tutorials/core/teensy_with_arduino

- title: Programming with rcl and rclc
docs:
- tutorials/programming_rcl_rclc/overview
- tutorials/programming_rcl_rclc/node
- tutorials/programming_rcl_rclc/pub_sub
- tutorials/programming_rcl_rclc/service
- tutorials/programming_rcl_rclc/parameters
- tutorials/programming_rcl_rclc/executor
- tutorials/programming_rcl_rclc/qos
- tutorials/programming_rcl_rclc/micro-ROS

- title: Advanced Tutorials
docs:
- tutorials/advanced/overview
Expand All @@ -65,17 +76,6 @@
- tutorials/advanced/benchmarking
- tutorials/advanced/tracing

- title: Programming with rcl and rclc
docs:
- tutorials/programming_rcl_rclc/overview
- tutorials/programming_rcl_rclc/node
- tutorials/programming_rcl_rclc/pub_sub
- tutorials/programming_rcl_rclc/service
- tutorials/programming_rcl_rclc/parameters
- tutorials/programming_rcl_rclc/executor
- tutorials/programming_rcl_rclc/qos
- tutorials/programming_rcl_rclc/micro-ROS

- title: Unmaintained Tutorials
docs:
- tutorials/old/microros_nuttx_bsp
Expand Down
2 changes: 1 addition & 1 deletion _docs/concepts/client_library/features/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ The micro-ROS Client Library, formed by standard [ROS 2 Client Support Library (
* Lifecycle
* Parameters

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/).
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/).
12 changes: 6 additions & 6 deletions _docs/tutorials/core/overview/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ redirect_from:
- /docs/tutorials/
---

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.

If you are new to micro-ROS, we strongly suggest that you take the tutorials in the following order:
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:

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

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

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!)

* [**Programming with rcl and rclc**](../programming_rcl_rclc/)
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.

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.
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:

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

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

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

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.
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.

In the [**Advanced Tutorials**](../../advanced/overview/) section, you'll find more advanced tutorials to strenghten your micro-ROS knowledge.
2 changes: 2 additions & 0 deletions _docs/tutorials/programming_rcl_rclc/executor/executor.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: Executor and timers
permalink: /docs/tutorials/programming_rcl_rclc/executor/
---

<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"/>

- [Timers](#timers)
- [Initialization](#initialization)
- [Callback](#callback)
Expand Down
4 changes: 3 additions & 1 deletion _docs/tutorials/programming_rcl_rclc/micro-ROS/micro-ROS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ title: micro-ROS utilities
permalink: /docs/tutorials/programming_rcl_rclc/micro-ROS/
---

// TODO: Change section name
<!-- TODO: Change section name -->

<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"/>

- [Allocators](#allocators)
- [Custom allocator](#custom-allocator)
- [Time sync](#time-sync)
Expand Down
2 changes: 2 additions & 0 deletions _docs/tutorials/programming_rcl_rclc/node/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: Nodes
permalink: /docs/tutorials/programming_rcl_rclc/node/
---

<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"/>

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)


Expand Down
6 changes: 2 additions & 4 deletions _docs/tutorials/programming_rcl_rclc/overview/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ redirect_from:
- /docs/tutorials/programming_rcl_rclc/
---

<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"/>

In this section, you'll learn the basics of the micro-ROS C API: **rclc**.

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.
Expand All @@ -16,5 +14,5 @@ The major concepts (publishers, subscriptions, services, timers, ...) are identi
* [**Services**](../service/)
* [**Parameters**](../parameters/)
* [**Executor and timers**](../executor/)
* [**QoS**](../qos/)
* [**micro-ROS Utils**](../micro-ROS/)
* [**Quality of service**](../qos/)
* [**micro-ROS utilities**](../micro-ROS/)
75 changes: 39 additions & 36 deletions _docs/tutorials/programming_rcl_rclc/parameters/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ title: Parameter server
permalink: /docs/tutorials/programming_rcl_rclc/parameters/
---

<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"/>

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)

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.

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

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

## Memory requirements

The parameter server uses 4 services and an optional publisher, this needs to be taken into account on the `rmw-microxredds` package memory configuration:

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

- Boolean:
```c
const char * parameter_name = "parameter_bool";
bool param_value = true;
```c
const char * parameter_name = "parameter_bool";
bool param_value = true;

// Add parameter to the server
rcl_ret_t rc = rclc_add_parameter(&param_server, parameter_name, RCLC_PARAMETER_BOOL);
// Add parameter to the server
rcl_ret_t rc = rclc_add_parameter(&param_server, parameter_name, RCLC_PARAMETER_BOOL);

// Set parameter value (Triggers parameter change callback)
rc = rclc_parameter_set_bool(&param_server, parameter_name, param_value);
// Set parameter value (Triggers parameter change callback)
rc = rclc_parameter_set_bool(&param_server, parameter_name, param_value);

// Get parameter value on param_value
rc = rclc_parameter_get_bool(&param_server, "param1", &param_value);
// Get parameter value on param_value
rc = rclc_parameter_get_bool(&param_server, "param1", &param_value);

if (RCL_RET_OK != rc) {
... // Handle error
return -1;
}
```
if (RCL_RET_OK != rc) {
... // Handle error
return -1;
}
```

- Integer:
```c
const char * parameter_name = "parameter_int";
int param_value = 100;
```c
const char * parameter_name = "parameter_int";
int param_value = 100;

// Add parameter to the server
rcl_ret_t rc = rclc_add_parameter(&param_server, parameter_name, RCLC_PARAMETER_INT);
// Add parameter to the server
rcl_ret_t rc = rclc_add_parameter(&param_server, parameter_name, RCLC_PARAMETER_INT);

// Set parameter value
rc = rclc_parameter_set_int(&param_server, parameter_name, param_value);
// Set parameter value
rc = rclc_parameter_set_int(&param_server, parameter_name, param_value);

// Get parameter value on param_value
rc = rclc_parameter_get_int(&param_server, parameter_name, &param_value);
```
// Get parameter value on param_value
rc = rclc_parameter_get_int(&param_server, parameter_name, &param_value);
```

- Double:
```c
const char * parameter_name = "parameter_double";
double param_value = 0.15;

// Add parameter to the server
rcl_ret_t rc = rclc_add_parameter(&param_server, parameter_name, RCLC_PARAMETER_DOUBLE);
```c
const char * parameter_name = "parameter_double";
double param_value = 0.15;

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

// Get parameter value on param_value
rc = rclc_parameter_get_double(&param_server, parameter_name, &param_value);
```
// Set parameter value
rc = rclc_parameter_set_double(&param_server, parameter_name, param_value);

// Get parameter value on param_value
rc = rclc_parameter_get_double(&param_server, parameter_name, &param_value);
```

## Cleaning up

To destroy an initialized parameter server:
Expand Down
4 changes: 3 additions & 1 deletion _docs/tutorials/programming_rcl_rclc/pub_sub/pub_sub.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
title: Publishers and Subscribers
title: Publishers and subscribers
permalink: /docs/tutorials/programming_rcl_rclc/pub_sub/
---

<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"/>

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).

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.
Expand Down
2 changes: 2 additions & 0 deletions _docs/tutorials/programming_rcl_rclc/qos/QoS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: Quality of service
permalink: /docs/tutorials/programming_rcl_rclc/qos/
---

<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"/>

- [Reliable QoS](#reliable-qos)
- [Best Effort](#best-effort)
- [Custom QoS configuration](#custom-qos-configuration)
Expand Down
2 changes: 2 additions & 0 deletions _docs/tutorials/programming_rcl_rclc/service/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: Services
permalink: /docs/tutorials/programming_rcl_rclc/service/
---

<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"/>

ROS 2 services are another communication mechanism between nodes. Services implement a client-server paradigm based on ROS 2 messages and types. Further information about ROS 2 services can be found [here](https://index.ros.org/doc/ros2/Tutorials/Services/Understanding-ROS2-Services/)

Ready to use code related to this concepts can be found in [`micro-ROS-demos/rclc/addtwoints_server`](https://github.com/micro-ROS/micro-ROS-demos/blob/foxy/rclc/addtwoints_server/main.c) and [`micro-ROS-demos/rclc/addtwoints_client`](https://github.com/micro-ROS/micro-ROS-demos/blob/foxy/rclc/addtwoints_client/main.c) folders. Fragments of code from this examples are used on this tutorial.
Expand Down