Skip to content

Commit 4557917

Browse files
committed
Changes reviewed.
1 parent 9a166fb commit 4557917

16 files changed

Lines changed: 431 additions & 263 deletions

File tree

_docs/tutorials/advanced/zephyr_emulator/index.md

Lines changed: 3 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,7 @@ by testing a Ping Pong application.
2020
ros2 run micro_ros_setup create_firmware_ws.sh zephyr host
2121
```
2222

23-
Once the command is executed, a folder named `firmware` must be present in your workspace.
24-
25-
This step is in charge, among other things, of creating a set of micro-ROS apps for the specific platform you are
26-
addressing.
27-
In the case of Zephyr, these are located at `firmware/zephyr_apps/apps`.
28-
Each app is represented by a folder containing the following files:
29-
30-
* `src/main.c`: This file contains the logic of the application.
31-
* `app-colcon.meta`: This file contains the micro-ROS app specific colcon configuration. Detailed info on how to
32-
configure the RMW via this file can be found
33-
[here](https://micro-ros.github.io/docs/tutorials/core/microxrcedds_rmw_configuration/).
34-
* `CMakeLists.txt`: This is the CMake file containing the script to compile the application.
35-
* `prj.conf`: This is a Zephyr specific app configuration file.
36-
37-
For the user to create its custom application, a folder `<my_app>` will need to be registered in this location,
38-
containing the four files just described.
23+
{% include first_application_common/zephyr_common.md %}
3924

4025
{% include first_application_common/config.md %}
4126

@@ -119,107 +104,7 @@ To start micro-ROS, you just need to run the agent:
119104
ros2 run micro_ros_agent micro_ros_agent udp4 --port 8888
120105
```
121106

122-
## Testing the micro-ROS app
123-
124-
At this point, the micro-ROS app is built and flashed and the board is connected to a micro-ROS agent.
125-
We now want to check that everything is working.
126-
127-
Open a new command line. We are going to listen to the `ping` topic
128-
with ROS 2 to check whether the micro-ROS Ping Pong node is correctly publishing the expected pings:
129-
130-
```bash
131-
source /opt/ros/dashing/setup.bash
132-
133-
# Subscribe to micro-ROS ping topic
134-
ros2 topic echo /microROS/ping
135-
```
136-
137-
You should see the topic messages published by the Ping Pong node every 5 seconds:
138-
139-
```
140-
user@user:~$ ros2 topic echo /microROS/ping
141-
stamp:
142-
sec: 20
143-
nanosec: 867000000
144-
frame_id: '1344887256_1085377743'
145-
---
146-
stamp:
147-
sec: 25
148-
nanosec: 942000000
149-
frame_id: '730417256_1085377743'
150-
---
151-
```
152-
153-
At this point, we know that our app is publishing pings.
154-
Let's check if it also answers to someone else's pings. If this works, it'll publish a pong.
155-
156-
So, first of all, let's subscribe with ROS 2 to the `pong` topic
157-
(notice that initially we don't expect to receive any pong, since none has been sent yet):
158-
159-
```bash
160-
source /opt/ros/dashing/setup.bash
161-
162-
# Subscribe to micro-ROS pong topic
163-
ros2 topic echo /microROS/pong
164-
```
165-
166-
And now, let's publish a `fake_ping` with ROS 2 from yet another command line:
167-
168-
```bash
169-
source /opt/ros/dashing/setup.bash
170-
171-
# Send a fake ping
172-
ros2 topic pub --once /microROS/ping std_msgs/msg/Header '{frame_id: "fake_ping"}'
173-
```
174-
175-
Now, we should see this `fake_ping` in the `ping` subscriber console (the second that we opened),
176-
along with the micro-ROS pings:
177-
178-
```
179-
user@user:~$ ros2 topic echo /microROS/ping
180-
stamp:
181-
sec: 0
182-
nanosec: 0
183-
frame_id: fake_ping
184-
---
185-
stamp:
186-
sec: 305
187-
nanosec: 973000000
188-
frame_id: '451230256_1085377743'
189-
---
190-
stamp:
191-
sec: 310
192-
nanosec: 957000000
193-
frame_id: '2084670932_1085377743'
194-
---
195-
```
196-
197-
Also, we expect that, because of having received the `fake_ping`, the micro-ROS node will answer with a `pong`:
198-
199-
```
200-
user@user:~$ ros2 run micro_ros_setup flash_firmware.sh
201-
Ping send seq 1706097268_1085377743
202-
Ping send seq 181171802_1085377743
203-
Ping send seq 1385567526_1085377743
204-
Ping send seq 926583793_1085377743
205-
Ping send seq 1831510138_1085377743
206-
Ping received with seq fake_ping. Answering.
207-
Ping send seq 1508705084_1085377743
208-
Ping send seq 1702133625_1085377743
209-
Ping send seq 176104820_1085377743
210-
```
211-
212-
As a consequence, in the `pong` subscriber console (the third that we opened),
213-
we should see the micro-ROS app answer to our `fake_ping`:
214-
215-
```
216-
user@user:~$ ros2 topic echo /microROS/pong
217-
stamp:
218-
sec: 0
219-
nanosec: 0
220-
frame_id: fake_ping
221-
---
222-
```
107+
{% include first_application_common/test_app_host.md %}
223108

224109
## Multiple Ping Pong nodes
225110

@@ -237,7 +122,7 @@ cd microros_ws
237122
As soon as all micro-ROS node are up and connected to the micro-ROS agent you will see them interacting:
238123

239124
```
240-
pgarrido@pgarrido$ ./firmware/build/zephyr/zephyr.exe
125+
user@user:~$ ./firmware/build/zephyr/zephyr.exe
241126
*** Booting Zephyr OS build zephyr-v2.2.0-492-gc73cb85b4ae9 ***
242127
UDP mode => ip: 127.0.0.1 - port: 8888
243128
Ping send seq 1711620172_1742614911 <---- This micro-ROS node sends a ping with ping ID "1711620172" and node ID "1742614911"

_docs/tutorials/core/first_application_linux/index.md

Lines changed: 11 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ permalink: /docs/tutorials/core/first_application_linux/
55

66
## Target platform
77

8-
This tutorial teaches you how to try a first micro-ROS application on Linux, by testing a Ping Pong application.
8+
In this tutorial, you’ll learn the use of micro-ROS with Linux by testing a Ping Pong application.
99
In the follow-up tutorial [*First micro-ROS application on an RTOS*](/docs/tutorials/core/first_application_rtos/),
1010
you'll learn how to build and bring this application on a microcontroller running the RTOS NuttX, FreeRTOS, or Zephyr.
11-
Finally in the tutorial [*Zephyr Emulator*](/docs/tutorials/advanced/zephyr_emulator/) you'll learn how to test
11+
Finally, in the tutorial [*Zephyr Emulator*](/docs/tutorials/advanced/zephyr_emulator/) you'll learn how to test
1212
a micro-ROS application on a Zephyr emulator.
1313

1414
{% include first_application_common/build_system.md %}
@@ -24,7 +24,7 @@ This step is in charge, among other things, of creating a set of micro-ROS apps
2424
`src/uros/micro-ROS-demos/rcl`.
2525
Each app is represented by a folder containing the following files:
2626

27-
* `app.c`: The former contains the logic of the application.
27+
* `main.c`: This file contains the logic of the application.
2828
* `CMakeLists.txt`: This is the CMake file containing the script to compile the application.
2929

3030
For the user to create its custom application, a folder `<my_app>` will need to be registered in this location,
@@ -43,9 +43,10 @@ You can check the complete content of this app
4343

4444
{% include first_application_common/pingpong_logic.md %}
4545

46-
The app logic of this demo is contained in
47-
[`app.c`](https://github.com/micro-ROS/micro-ROS-demos/blob/dashing/rcl/ping_pong/main.c).
48-
A thorough review of this file is illustrative of how to create a micro-ROS publisher or subscriber.
46+
The contents of the host app specific files can be found here:
47+
[main.c](https://github.com/micro-ROS/micro-ROS-demos/blob/dashing/rcl/ping_pong/main.c) and
48+
[CMakeLists.txt](https://github.com/micro-ROS/micro-ROS-demos/blob/dashing/rcl/ping_pong/CMakeLists.txt).
49+
A thorough review of these files is illustrative of how to create a micro-ROS app in this RTOS.
4950

5051
## Building the firmware
5152

@@ -83,118 +84,19 @@ source install/local_setup.bash
8384
ros2 run micro_ros_demos_rcl ping_pong
8485
```
8586

86-
## Testing the micro-ROS app
87-
88-
Now, we want to check that everything is working.
89-
90-
Open a new command line. We are going to listen to the `ping` topic
91-
with ROS 2 to check whether the micro-ROS Ping Pong node is correctly publishing the expected pings:
92-
93-
```bash
94-
source /opt/ros/dashing/setup.bash
95-
96-
# Subscribe to micro-ROS ping topic
97-
ros2 topic echo /microROS/ping
98-
```
99-
100-
You should see the topic messages published by the Ping Pong node every 5 seconds:
101-
102-
```
103-
user@user:~$ ros2 topic echo /microROS/ping
104-
stamp:
105-
sec: 20
106-
nanosec: 867000000
107-
frame_id: '1344887256_1085377743'
108-
---
109-
stamp:
110-
sec: 25
111-
nanosec: 942000000
112-
frame_id: '730417256_1085377743'
113-
---
114-
```
115-
116-
At this point, we know that our Linux app is publishing pings.
117-
Let's check if it also answers to someone else's pings. If this works, it'll publish a pong.
118-
119-
So, first of all, let's subscribe with ROS 2 to the `pong` topic
120-
(notice that initially we don't expect to receive any pong, since none has been sent yet):
121-
122-
```bash
123-
source /opt/ros/dashing/setup.bash
124-
125-
# Subscribe to micro-ROS pong topic
126-
ros2 topic echo /microROS/pong
127-
```
128-
129-
And now, let's publish a `fake_ping` with ROS 2 from yet another command line:
130-
131-
```bash
132-
source /opt/ros/dashing/setup.bash
133-
134-
# Send a fake ping
135-
ros2 topic pub --once /microROS/ping std_msgs/msg/Header '{frame_id: "fake_ping"}'
136-
```
137-
138-
Now, we should see this `fake_ping` in the `ping` subscriber console (the second that we opened),
139-
along with the micro-ROS pings:
140-
141-
```
142-
user@user:~$ ros2 topic echo /microROS/ping
143-
stamp:
144-
sec: 0
145-
nanosec: 0
146-
frame_id: fake_ping
147-
---
148-
stamp:
149-
sec: 305
150-
nanosec: 973000000
151-
frame_id: '451230256_1085377743'
152-
---
153-
stamp:
154-
sec: 310
155-
nanosec: 957000000
156-
frame_id: '2084670932_1085377743'
157-
---
158-
```
159-
160-
Also, we expect that, because of having received the `fake_ping`, the micro-ROS node will answer with a `pong`:
161-
162-
```
163-
user@user:~$ ros2 run micro_ros_demos_rcl ping_pong
164-
Ping send seq 1706097268_1085377743
165-
Ping send seq 181171802_1085377743
166-
Ping send seq 1385567526_1085377743
167-
Ping send seq 926583793_1085377743
168-
Ping send seq 1831510138_1085377743
169-
Ping received with seq fake_ping. Answering.
170-
Ping send seq 1508705084_1085377743
171-
Ping send seq 1702133625_1085377743
172-
Ping send seq 176104820_1085377743
173-
```
174-
175-
As a consequence, in the `pong` subscriber console (the third that we opened),
176-
we should see the micro-ROS app answer to our `fake_ping`:
177-
178-
```
179-
user@user:~$ ros2 topic echo /microROS/pong
180-
stamp:
181-
sec: 0
182-
nanosec: 0
183-
frame_id: fake_ping
184-
---
185-
```
87+
{% include first_application_common/test_app_host.md %}
18688

18789
## Multiple Ping Pong nodes
18890

189-
One of the advantages of having an Linux micro-ROS app is that you don't need to buy a bunch of hardware in order to
91+
One of the advantages of having a Linux micro-ROS app is that you don't need to buy a bunch of hardware in order to
19092
test some multi-node micro-ROS apps.
19193
So, with the same micro-ROS agent of the last section, let's open four different command lines and run the following on
19294
each:
19395

19496
```bash
19597
cd microros_ws
19698

197-
source /opt/ros/$ROS_DISTRO/setup.bash
99+
source /opt/ros/dashing/setup.bash
198100
source install/local_setup.bash
199101

200102
ros2 run micro_ros_demos_rcl ping_pong
@@ -203,7 +105,7 @@ ros2 run micro_ros_demos_rcl ping_pong
203105
As soon as all micro-ROS nodes are up and connected to the micro-ROS agent you will see them interacting:
204106

205107
```
206-
user@user$ ros2 run micro_ros_demos_rcl my_brand_new_app
108+
user@user:~$ ros2 run micro_ros_demos_rcl ping_pong
207109
UDP mode => ip: 127.0.0.1 - port: 8888
208110
Ping send seq 1711620172_1742614911 <---- This micro-ROS node sends a ping with ping ID "1711620172" and node ID "1742614911"
209111
Pong for seq 1711620172_1742614911 (1) <---- The first mate pongs my ping

_docs/tutorials/core/first_application_rtos/freertos.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
2-
title: First micro-ROS Application on Zephyr
3-
permalink: /docs/tutorials/core/first_application_rtos/zephyr/
2+
title: First micro-ROS Application on FreeRTOS
3+
permalink: /docs/tutorials/core/first_application_rtos/freertos/
44
redirect_from:
5-
- /docs/tutorials/advanced/zephyr/zephyr_getting_started/
5+
- /docs/tutorials/advanced/freertos/freertos_getting_started/
66
---
77

88
## Target platform
99

1010
In this tutorial, you'll learn the use of micro-ROS with FreeRTOS by testing a Ping Pong application.
11-
1211
{% include first_application_common/target_hardware.md %}
1312
* [USB-to-Serial Cable Female](https://www.olimex.com/Products/Components/Cables/USB-Serial-Cable/USB-SERIAL-F/)
1413

@@ -70,4 +69,4 @@ Make sure to match Olimex Rx with Cable Tx and vice-versa. Remember GND!*
7069

7170
{% include first_application_common/run_app.md %}
7271

73-
{% include first_application_common/test_app.md %}
72+
{% include first_application_common/test_app_rtos.md %}

_docs/tutorials/core/first_application_rtos/nuttx.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@ redirect_from:
55
- /docs/tutorials/advanced/nuttx/nuttx_getting_started/
66
---
77

8-
{% include first_application_rtos_common/section_01_intro.md %}
8+
{% include first_application_common/old_common/section_01_intro.md %}
99

1010
In this tutorial, you'll learn the use of micro-ROS with NuttX.
1111

12-
{% include first_application_rtos_common/section_02_target_hardware_and_workspace.md %}
12+
{% include first_application_common/old_common/section_02_target_hardware_and_workspace.md %}
1313

1414
```bash
1515
# Create step
1616
ros2 run micro_ros_setup create_firmware_ws.sh nuttx olimex-stm32-e407
1717
```
1818

19-
{% include first_application_rtos_common/section_03_configuring_firmware.md %}
19+
{% include first_application_common/old_common/section_03_configuring_firmware.md %}
2020

2121
| RTOS | `[APP]` | `[OPTIONS]` | Configured app |
2222
| :------: | --------------- | ---------------------------- | :------------------------------------------------------------------------------: |
2323
| **NuttX** | **`uros_pingpong`** | | [**Source**](https://github.com/micro-ROS/apps/tree/feature/pingpong_app/examples/uros_pingpong) |
2424
| FreeRTOS | `ping_pong` | `--transport serial --dev 3` | [Source](https://github.com/micro-ROS/freertos_apps/tree/dashing/apps/ping_pong) |
2525
| Zephyr | `ping_pong` | `--transport serial-usb` | [Source](https://github.com/micro-ROS/zephyr_apps/tree/dashing/apps/ping_pong) |
2626

27-
{% include first_application_rtos_common/section_04_demo_description.md %}
27+
{% include first_application_common/old_common/section_04_demo_description.md %}
2828

2929
Create a new app:
3030

@@ -55,7 +55,7 @@ Install required `kconfig-frontends`:
5555
git clone https://bitbucket.org/nuttx/tools.git firmware/tools
5656

5757
pushd firmware/tools/kconfig-frontends
58-
./configure --enable-mconf --disable-nconf --disable-gconf --disable-qconf
58+
./configure --enable-mconf --disable-nconf --disable-gconf --disable-qconf
5959
LD_RUN_PATH=/usr/local/lib && make && sudo make install && sudo ldconfig
6060
popd
6161
```
@@ -94,14 +94,14 @@ Finally create a folder called ``uros_pingpong`` into ``uros_ws/firmware/NuttX/c
9494
ros2 run micro_ros_setup configure_firmware.sh uros_pingpong
9595
```
9696

97-
{% include first_application_rtos_common/section_05_building_flashing_and_running.md %}
97+
{% include first_application_common/old_common/section_05_building_flashing_and_running.md %}
9898

9999
| RTOS | micro-ROS Client to Agent |
100100
| :------: | ------------------------- |
101101
| **NuttX** | **Serial** |
102102
| FreeRTOS | Serial |
103103
| Zephyr | USB |
104104

105-
{% include first_application_rtos_common/section_06_agent.md %}
105+
{% include first_application_common/old_common/section_06_agent.md %}
106106

107-
This completes the First micro-ROS Application on NuttX tutorial. Do you want to [go back](../) and try a different RTOS, i.e. FreeRTOS or Zephyr?
107+
This completes the First micro-ROS Application on NuttX tutorial. Do you want to [go back](../) and try a different RTOS, i.e. FreeRTOS or Zephyr?

0 commit comments

Comments
 (0)