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
This tutorial aims to create a new micro-ROS application on with **[Zephyr RTOS](https://www.zephyrproject.org/)** emulator (also known as [Native POSIX](https://docs.zephyrproject.org/latest/boards/posix/native_posix/doc/index.html)).
6
+
This tutorial aims at creating a new micro-ROS application on with **[Zephyr RTOS](https://www.zephyrproject.org/)** emulator (also known as [Native POSIX](https://docs.zephyrproject.org/latest/boards/posix/native_posix/doc/index.html)).
7
+
8
+
To follow this tutorial, it is assumed that the user is already familiar with the **[First micro-ROS Application on an RTOS](https://micro-ros.github.io/docs/tutorials/core/first_application_rtos/)** tutorial. The target app in this tutorial is the same ping pong app.
9
+
Another requirement is that the user has a basic knowledge of micro-ROS and ROS 2.
@@ -13,244 +16,39 @@ This tutorial aims to create a new micro-ROS application on with **[Zephyr RTOS]
13
16
14
17
This tutorial requires no hardware beyond a Linux host computer.
15
18
16
-
## Adding a new micro-ROS app
17
-
18
-
First of all, make sure that you have a **ROS 2** installation.
19
-
20
-
***TIP:** if you are familiar with Docker containers, this image may be useful: [ros:dashing](https://hub.docker.com/layers/ros/library/ros/dashing/images/sha256-b796c14ea663537129897769aa6c715a851ca08dffd4875ef2ecaa31a4dbd431?context=explore)*
21
-
22
-
On the **ROS 2** installation open a command line and follow these steps:
23
-
24
-
```bash
25
-
# Source the ROS 2 installation
26
-
source /opt/ros/$ROS_DISTRO/setup.bash
27
-
28
-
# Create a workspace and download the micro-ROS tools
Now, let's create a firmware workspace that targets all the required code and tools for Zephyr emulator:
21
+
Once the micro-ROS build system is ready, let's create a new Zephyr firmware for the host platform:
55
22
56
23
```bash
57
24
# Create firmware step
58
25
ros2 run micro_ros_setup create_firmware_ws.sh zephyr host
59
26
```
60
27
61
-
Now you have all the required tools to compile micro-ROS and Zephyr. At this point, you must know that the micro-ROS build system is a four-step workflow:
62
-
63
-
<!-- TODO (pablogs9): Remove and link to build-system tutorial when done -->
64
-
1.**Create**: retrieves all the required packages for a specific RTOS and hardware platform.
65
-
2.**Configure**: configures the downloaded packages with options such as the micro-ROS application, the selected transport layer or the micro-ROS agent IP address (in network transports).
66
-
3.**Build**: generates a binary file ready for being loaded in the hardware.
67
-
4.**Flash**: load the micro-ROS software in the hardware.
68
-
69
-
micro-ROS apps for Zephyr emulator are located at `firmware/zephyr_apps/apps`. In order to create a new application, create a new folder containing two files: the app code (inside a `src` folder) and the RMW configuration. You will also need some other Zephyr related files: a `CMakeLists.txt` to define the building process and a `prj.conf` where Zephyr is configured. You have these two files [here](https://github.com/micro-ROS/zephyr_apps/tree/dashing/apps/host_ping_pong), for now, it is ok to copy them.
28
+
micro-ROS apps for Zephyr emulator are located at `firmware/zephyr_apps/apps`. In order to create a new application, create a new folder containing two files: the app code (inside a `src` folder) and the RMW configuration. You will also need some other Zephyr related files: a `CMakeLists.txt` to define the building process and a `prj.conf` where Zephyr is configured. There is a sample proyect [here](https://github.com/micro-ROS/zephyr_apps/tree/dashing/apps/host_ping_pong), for now, it is ok to copy them.
For this example we are going to create a ping pong app where a node sends a ping package with a unique identifier using a publisher and the same package is received by a pong subscriber. The node will also answer to pings received from other nodes with a pong message:
To start creating this app, lets configure the RMW with the required static memory. You can read more about RMW and Micro XRCE-DDS Configuration [here](/docs/tutorials/core/microxrcedds_rmw_configuration/). The `app-colcon.meta` should look like:
91
-
92
-
```
93
-
{
94
-
"names": {
95
-
"rmw_microxrcedds": {
96
-
"cmake-args": [
97
-
"-DRMW_UXRCE_MAX_NODES=1",
98
-
"-DRMW_UXRCE_MAX_PUBLISHERS=2",
99
-
"-DRMW_UXRCE_MAX_SUBSCRIPTIONS=2",
100
-
"-DRMW_UXRCE_MAX_SERVICES=0",
101
-
"-DRMW_UXRCE_MAX_CLIENTS=0",
102
-
"-DRMW_UXRCE_MAX_HISTORY=4",
103
-
]
104
-
}
105
-
}
106
-
}
107
-
```
108
-
109
-
Meanwhile `src/app.c` should look like the following code:
The contents of the files can be found here: [app.c](https://github.com/micro-ROS/zephyr_apps/blob/dashing/apps/host_ping_pong/src/main.c), [app-colcon.meta](https://github.com/micro-ROS/zephyr_apps/blob/dashing/apps/host_ping_pong/app-colcon.meta), [CMakeLists.txt](https://github.com/micro-ROS/zephyr_apps/blob/dashing/apps/host_ping_pong/CMakeLists.txt) and [prj.conf](https://github.com/micro-ROS/zephyr_apps/blob/dashing/apps/host_ping_pong/prj.conf).
248
46
249
-
Once the new folder is created, let's configure our new app with a UDP transport that looks for the agent on the port UDP/8888 at localhost:
47
+
Once the app folder is created, let's configure our new app with a UDP transport that looks for the agent on the port UDP/8888 at localhost:
0 commit comments