Skip to content

Commit 26e8456

Browse files
Add embeddedRTPS as experimental middleware (backport #95) (#97)
* Add embeddedRTPS as experimental middleware (#95) * Add embeddedRTPS as experimental middleware * Set default middleware * Update examples * Update toolchain * Fix uart config * Update toolchain * Update CI * Update * Fix * Update samples * Update * Add rmw_rtps options to .meta * Update colcon.meta and add service msg repo * Add service example Co-authored-by: Antonio cuadros <acuadros1995@gmail.com> (cherry picked from commit 2179f0b) # Conflicts: # libmicroros.mk * Fix conflict * Update Co-authored-by: Pablo Garrido <pablogs9@gmail.com>
1 parent 0cc2b84 commit 26e8456

32 files changed

Lines changed: 617 additions & 175 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,14 @@ jobs:
7474
sed -i 's/DRMW_UXRCE_TRANSPORT=udp/DRMW_UXRCE_TRANSPORT=custom/' colcon.meta
7575
cd examples/int32_publisher_custom_transport
7676
idf.py set-target ${{ matrix.idf_target }}
77+
idf.py build
78+
79+
- name: EmbeddedRTPS
80+
shell: bash
81+
run: |
82+
. $IDF_PATH/export.sh
83+
cd micro_ros_espidf_component
84+
make -f libmicroros.mk clean
85+
cd examples/int32_publisher_embeddedrtps
86+
idf.py set-target ${{ matrix.idf_target }}
7787
idf.py build

.github/workflows/nightly.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,15 @@ jobs:
6969
sed -i 's/DRMW_UXRCE_TRANSPORT=udp/DRMW_UXRCE_TRANSPORT=custom/' colcon.meta
7070
cd examples/int32_publisher_custom_transport
7171
idf.py set-target ${{ matrix.idf_target }}
72+
idf.py build
73+
74+
- name: EmbeddedRTPS
75+
if: ${{ matrix.branch == 'galactic' }}
76+
shell: bash
77+
run: |
78+
. $IDF_PATH/export.sh
79+
cd micro_ros_espidf_component
80+
make -f libmicroros.mk clean
81+
cd examples/int32_publisher_embeddedrtps
82+
idf.py set-target ${{ matrix.idf_target }}
7283
idf.py build

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ if(NOT EXISTS "${EXTRA_ROS_PACKAGES}")
1818
set(EXTRA_ROS_PACKAGES "${COMPONENT_DIR}/extra_packages")
1919
endif()
2020

21+
if(${CONFIG_MICRO_ROS_ESP_EMBEDDEDRTPS_MIDDLEWARE})
22+
message(STATUS "Using embeddedRTPS middleware")
23+
set(MIDDLEWARE "embeddedrtps")
24+
else()
25+
message(STATUS "Using Micro XRCE-DDS middleware")
26+
set(MIDDLEWARE "microxrcedds")
27+
endif()
28+
29+
# message(FATAL_ERROR "Failed to get cmake properties")
30+
2131
externalproject_add(libmicroros_project
2232
PREFIX ${CMAKE_BINARY_DIR}/libmicroros-prefix
2333
SOURCE_DIR ${COMPONENT_DIR}
@@ -31,6 +41,7 @@ externalproject_add(libmicroros_project
3141
X_CFLAGS=${CMAKE_C_FLAGS}
3242
X_CXX=${CMAKE_CXX_COMPILER}
3343
X_CXXFLAGS=${CMAKE_CXX_FLAGS}
44+
MIDDLEWARE=${MIDDLEWARE}
3445
BUILD_DIR=${CMAKE_BINARY_DIR}
3546
IDF_PATH=${IDF_PATH}
3647
IDF_TARGET=${IDF_TARGET}

Kconfig.projbuild

Lines changed: 109 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,70 @@
11
menu "micro-ROS Settings"
22

3-
config MICRO_ROS_AGENT_IP
4-
string "micro-ROS Agent IP"
5-
default "192.168.1.100"
6-
help
7-
micro-ROS Agent IP.
3+
#####################################
4+
# CHOOSE MICRO-ROS MIDDLEWARE #
5+
#####################################
6+
7+
choice
8+
prompt "micro-ROS middleware"
9+
default MICRO_ROS_ESP_XRCE_DDS_MIDDLEWARE
10+
config MICRO_ROS_ESP_XRCE_DDS_MIDDLEWARE
11+
bool "micro-ROS over eProsima Micro XRCE-DDS"
12+
config MICRO_ROS_ESP_EMBEDDEDRTPS_MIDDLEWARE
13+
bool "micro-ROS over embeddedRTPS (EXPERIMENTAL)"
14+
endchoice
815

9-
config MICRO_ROS_AGENT_PORT
10-
string "micro-ROS Agent Port"
11-
default "8888"
12-
help
13-
micro-ROS Agent port.
16+
##################################
17+
# CHOOSE NETWORK INTERFACE #
18+
##################################
1419

15-
choice
20+
choice
1621
prompt "micro-ROS network interface select"
1722
config MICRO_ROS_ESP_NETIF_WLAN
18-
bool "micro-ROS over network uses WLAN netif"
23+
bool "WLAN interface"
1924
config MICRO_ROS_ESP_NETIF_ENET
20-
bool "micro-ROS over network uses Ethernet netif"
25+
bool "Ethernet interface"
26+
if MICRO_ROS_ESP_XRCE_DDS_MIDDLEWARE
27+
config MICRO_ROS_ESP_UART_TRANSPORT
28+
bool "Micro XRCE-DDS over UART. Check int32_publisher_custom_transport"
29+
endif
2130
endchoice
22-
23-
menu "UART Settings (for serial transport)"
2431

25-
config MICROROS_UART_TXD
26-
int "UART TX pin"
27-
range -1 33
28-
default -1
29-
help
30-
Select Tx Down pin for uart connection or -1 for no change (Only used if serial transport is used for microros).
3132

32-
config MICROROS_UART_RXD
33-
int "UART RX pin"
34-
range -1 33
35-
default -1
36-
help
37-
Select Rx Down pin for uart connection or -1 for no change (Only used if serial transport is used for microros).
33+
#####################
34+
# WLAN CONFIG #
35+
#####################
3836

39-
config MICROROS_UART_RTS
40-
int "UART RTS pin"
41-
range -1 33
42-
default -1
43-
help
44-
Select RTS Down pin for uart connection or -1 for no change (Only used if serial transport is used for microros).
37+
if MICRO_ROS_ESP_NETIF_WLAN
4538

46-
config MICROROS_UART_CTS
47-
int "UART CTS pin"
48-
range -1 33
49-
default -1
50-
help
51-
Select CTS Down pin for uart connection or -1 for no change (Only used if serial transport is used for microros).
39+
menu "WiFi Configuration"
5240

41+
config ESP_WIFI_SSID
42+
string "WiFi SSID"
43+
default "myssid"
44+
help
45+
SSID (network name) for the example to connect to.
46+
47+
config ESP_WIFI_PASSWORD
48+
string "WiFi Password"
49+
default "mypassword"
50+
help
51+
WiFi password (WPA or WPA2) for the example to use.
52+
53+
config ESP_MAXIMUM_RETRY
54+
int "Maximum retry"
55+
default 5
56+
help
57+
Set the Maximum retry to avoid station reconnecting to the AP unlimited when the AP is really inexistent.
5358
endmenu
5459

60+
endif # MICRO_ROS_ESP_NETIF_WLAN
61+
62+
#########################
63+
# ETHERNET CONFIG #
64+
#########################
65+
66+
if MICRO_ROS_ESP_NETIF_ENET
67+
5568
menu "Ethernet Configuration"
5669
config MICRO_ROS_USE_SPI_ETHERNET
5770
bool
@@ -203,25 +216,66 @@ menu "Ethernet Configuration"
203216
Set PHY address according your board schematic.
204217
endmenu
205218

206-
menu "WiFi Configuration"
219+
endif # MICRO_ROS_ESP_NETIF_ENET
207220

208-
config ESP_WIFI_SSID
209-
string "WiFi SSID"
210-
default "myssid"
211-
help
212-
SSID (network name) for the example to connect to.
221+
#########################
222+
# XRCE-DDS CONFIG #
223+
#########################
213224

214-
config ESP_WIFI_PASSWORD
215-
string "WiFi Password"
216-
default "mypassword"
217-
help
218-
WiFi password (WPA or WPA2) for the example to use.
225+
if MICRO_ROS_ESP_XRCE_DDS_MIDDLEWARE && !MICRO_ROS_ESP_UART_TRANSPORT
226+
227+
config MICRO_ROS_AGENT_IP
228+
string "micro-ROS Agent IP"
229+
default "192.168.1.100"
230+
help
231+
micro-ROS Agent IP.
232+
233+
config MICRO_ROS_AGENT_PORT
234+
string "micro-ROS Agent Port"
235+
default "8888"
236+
help
237+
micro-ROS Agent port.
238+
239+
endif
240+
241+
242+
#####################
243+
# UART CONFIG #
244+
#####################
245+
246+
if MICRO_ROS_ESP_UART_TRANSPORT
247+
menu "UART Settings"
248+
249+
config MICROROS_UART_TXD
250+
int "UART TX pin"
251+
range -1 33
252+
default -1
253+
help
254+
Select Tx Down pin for uart connection or -1 for no change (Only used if serial transport is used for microros).
255+
256+
config MICROROS_UART_RXD
257+
int "UART RX pin"
258+
range -1 33
259+
default -1
260+
help
261+
Select Rx Down pin for uart connection or -1 for no change (Only used if serial transport is used for microros).
262+
263+
config MICROROS_UART_RTS
264+
int "UART RTS pin"
265+
range -1 33
266+
default -1
267+
help
268+
Select RTS Down pin for uart connection or -1 for no change (Only used if serial transport is used for microros).
269+
270+
config MICROROS_UART_CTS
271+
int "UART CTS pin"
272+
range -1 33
273+
default -1
274+
help
275+
Select CTS Down pin for uart connection or -1 for no change (Only used if serial transport is used for microros).
219276

220-
config ESP_MAXIMUM_RETRY
221-
int "Maximum retry"
222-
default 5
223-
help
224-
Set the Maximum retry to avoid station reconnecting to the AP unlimited when the AP is really inexistent.
225277
endmenu
226278

279+
endif # MICRO_ROS_ESP_UART_TRANSPORT
280+
227281
endmenu

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ This component needs `colcon` and other Python 3 packages inside the IDF virtual
1111
pip3 install catkin_pkg lark-parser empy colcon-common-extensions
1212
```
1313

14+
## Middlewares available
15+
16+
This package support the usage of micro-ROS on top of two different middlewares:
17+
- [eProsima Micro XRCE-DDS](https://micro-xrce-dds.docs.eprosima.com/en/latest/): the default micro-ROS middleware.
18+
- [embeddedRTPS](https://github.com/embedded-software-laboratory/embeddedRTPS): an experimental implementation of a RTPS middleware compatible with ROS 2.
19+
20+
In order to select it, use `idf.py menuconfig` and go to `micro-ROS Settings > micro-ROS middleware`
1421
## Usage
1522

1623
You can clone this repo directly in the `components` folder of your project.
@@ -28,9 +35,9 @@ cd examples/int32_publisher
2835
idf.py set-target esp32
2936
idf.py menuconfig
3037
# Set your micro-ROS configuration and WiFi credentials under micro-ROS Settings
31-
idf.py build
32-
idf.py flash
33-
idf.py monitor
38+
idf.py build
39+
idf.py flash
40+
idf.py monitor
3441
```
3542

3643
To clean and rebuild all the micro-ROS library:

colcon.meta

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
},
1515
"rcutils": {
1616
"cmake-args": [
17+
"-DBUILD_SHARED=OFF",
1718
"-DENABLE_TESTING=OFF",
1819
"-DRCUTILS_NO_FILESYSTEM=ON",
1920
"-DRCUTILS_NO_THREAD_SUPPORT=ON",
@@ -44,6 +45,15 @@
4445
"-DRMW_UXRCE_MAX_HISTORY=1"
4546
]
4647
},
48+
"embeddedrtps": {
49+
"cmake-args": [
50+
"-DERTPS_MAX_PUBLISHERS=2",
51+
"-DERTPS_MAX_SUBSCRIPTIONS=2",
52+
"-DERTPS_MAX_SERVICES=1",
53+
"-DERTPS_MAX_CLIENTS=1",
54+
"-DERTPS_MAX_HISTORY=10"
55+
]
56+
},
4757
"tracetools": {
4858
"cmake-args": [
4959
"-DTRACETOOLS_DISABLED=ON",

0 commit comments

Comments
 (0)