Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pub/sub directly between two STMs ? #38

Open
yamati-kz opened this issue Jul 17, 2023 · 4 comments
Open

How to pub/sub directly between two STMs ? #38

yamati-kz opened this issue Jul 17, 2023 · 4 comments

Comments

@yamati-kz
Copy link

I'm trying it, but it doesn't work. I'm happy to receive advice.

pub/sub is working between STM32 NUCLEO-H743ZI2 and ubuntu. But pub/sub doesn't work directly between STM32 NUCLEO-H743ZI2.
Two STM32 NUCLEO-H743ZI2 are connected to the router with a LAN cable. And the IP address is fixed by the MAC address on the router. The two STMs have different IP addresses.

@yamati-kz yamati-kz changed the title How to pub/sub directly between two STMs. How to pub/sub directly between two STMs ?. Jul 17, 2023
@yamati-kz yamati-kz changed the title How to pub/sub directly between two STMs ?. How to pub/sub directly between two STMs ? Jul 17, 2023
@yamati-kz
Copy link
Author

It's a test report.
When connecting mros2-host-examples (ubuntu 20.04 Foxy) with STM32, two logs are output to the serial log.
[MROS2LIB] publisher matched with remote subscriber
[MROS2LIB] subscriber matched with remote publisher

However, when trying to pub/sub between STM32s, these two logs do not appear.

--------- When connecting mros2-host-examples (ubuntu 20.04 Foxy) with STM32, two logs are output to the serial log. -------
mbed mros2 start!
app name: echoback_string
[MROS2LIB] mros2_init task start
mROS 2 initialization is completed

[MROS2LIB] create_node
[MROS2LIB] start creating participant
[MROS2LIB] successfully created participant
[MROS2LIB] create_publisher complete.
[MROS2LIB] create_subscription complete.
[MROS2LIB] Initilizing Domain complete
ready to pub/sub message

publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 0'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 1'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 2'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 3'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 4'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 5'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 6'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 7'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 8'
[MROS2LIB] publisher matched with remote subscriber
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 9'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 10'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 11'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 12'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 13'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 14'
subscribed msg: 'Hello, world! 0'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 15'
subscribed msg: 'Hello, world! 1'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 16'
subscribed msg: 'Hello, world! 2'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 17'
subscribed msg: 'Hello, world! 3'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 18'
subscribed msg: 'Hello, world! 4'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 19'
subscribed msg: 'Hello, world! 5'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 20'
subscribed msg: 'Hello, world! 6'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 21'
subscribed msg: 'Hello, world! 7'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 22'
[MROS2LIB] subscriber matched with remote publisher
subscribed msg: 'Hello, world! 8'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_H743ZI2 2nd : 23'

@takasehideki
Copy link
Member

@yamati-kz If we want multiple mros2 boards to communicate directly with each other, we need to set BASE_GUID_PREFIX to different values. This may be the same with #39
https://github.com/mROS-base/mros2-mbed/blob/main/include/rtps/config.h#L44

Actually, I have not tried this yet. However, this information was given to me by a cool engineer at eSol who developed the following demo, so I think it is a solid solution. Please try it out!
https://twitter.com/takasehideki/status/1584488359808102402

@yamati-kz
Copy link
Author

I tried, but direct communication with multiple mros2 boards was not successful.
The value of BASE_GUID_PREFIX is unchanged for the first board. I set a different value for the second board. Evaluated with mros2-mbed v0.5.4.

I tried setting it to a value like this.
/mros2-mbed/platform/rtps/config.h
// first board
const GuidPrefix_t BASE_GUID_PREFIX{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12};

// second board
const GuidPrefix_t BASE_GUID_PREFIX{21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32};

@yamati-kz
Copy link
Author

yamati-kz commented Apr 17, 2024

I tried Publish directly from mros2-esp32 to mros2-esp-32, and Pub/Sub was successful.
At this time, BASE_GUID_PREFIX has the same value. Evaluated with mros2-esp32 v0.5.3.
I used ESP32-C6-DevKitC-1 and M5Stack Core2 ESP32 IoT Development Kit for AWS IoT Kit
ESP-IDF v5.2.1, M5Unified 0.1.14, M5GFX

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants