Git Product home page Git Product logo

mros2-mbed's Introduction

build_app build_board

mros2-mbed

mROS 2 (mros2 as casually codename) realizes a agent-less and lightweight runtime environment compatible with ROS 2 for embedded devices. mROS 2 mainly offers pub/sub APIs compatible with rclcpp for embedded devices.

mROS 2 consists of communication library for pub/sub APIs, RTPS protocol, UDP/IP stack, and real-time kernel. This repository provides the reference implementation of mROS 2 that can be operated on the Mbed enabled board. Please also check mros2 repository for more details and another implementations.

Supported environment

  • Mbed device
  • Host environment
  • Network setting
    • When running by default, make sure both the device and the host are connected to the wired network with the following setting, since they are statically configured to the board.
      • IP address: 192.168.11.x (.2 will be assigned to the board)
      • Netmask: 255.255.255.0
      • Gateway: 192.168.11.1
        • You can configure these setting to yours by editing platform/mros2-platform.h.
        • If you want to use DHCP connection, please comment out the #define MROS2_IP_ADDRESS_STATIC line in platform/mros2-platform.h.
    • The firewall on the host (Ubuntu) needs to be disabled for ROS 2 (DDS) communication (e.g. $ sudo ufw disable).
    • If the host is connected to the Internet with other network adapters, communication with mros2 may not work properly. In that case, please turn off them.

Getting Started

  1. Prepare these items below.
  • Host PC having an Ethernet port whose network is set to the above and a docker environment.
  • Mbed board having an Ethernet port (listed above).
  1. Build Mbed executable binary using the Docker environment for Mbed CLI2.
    (You can also use the native environment where MBed CLI2 could work well. Please add native to 4th arg. (see the example instruction to prepare native env))
git clone https://github.com/mROS-base/mros2-mbed
cd mros2-mbed
#(Please replace the [TARGET] with the ones as below.)
# +-------------------+----------------+
# | Your target board | [TARGET]       |
# +-------------------+----------------+
# | NUCLEO-F767ZI     | NUCLEO_F767ZI  |
# | NUCLEO-H743ZI2    | NUCLEO_H743ZI2 |
# | NUCLEO-F429ZI     | NUCLEO_F429ZI  |
# | NUCLEO-F746ZG     | NUCLEO_F746ZG  |
# | F746NG-Discovery  | DISCO_F746NG   |
# | F769NI-Discovery  | DISCO_F769NI   |
# | Arch Max v1.1     | ARCH_MAX       |
# | GR-MANGO          | GR_MANGO       |
# +-------------------+----------------+
./build.bash all [TARGET] echoback_string

After that, you will find an executable binary is created in the path below.

cmake_build/[TARGET]/develop/GCC_ARM/mros2-mbed.bin
  1. Connect the PC and Mbed Board with USB and LAN cables.
  2. Open Serial Console of the Mbed board. (115200bps)
  3. Copy the executable binary above to the Mbed Board. (you may find it in the Nautilus file manager as NODE_F429ZI, F767ZI or DAPLINK.)
mros2-mbed start!
app name: echoback_string
Successfully connected to network
  IP Address: 192.168.11.2
[MROS2LIB] set IP address for RTPS communication
[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_F767ZI: 0'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 1'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 2'
publishing msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 3'
...(SNIPPED)...
  1. One of the easiest way to operate the host is using Docker. On the host terminal, type the command below.
docker run --rm -it --net=host ros:humble /bin/bash \
  -c "source /opt/ros/humble/setup.bash &&
  cd &&
  git clone https://github.com/mROS-base/mros2-host-examples &&
  cd mros2-host-examples &&
  colcon build --packages-select mros2_echoreply_string &&
  source install/setup.bash &&
  ros2 run mros2_echoreply_string echoreply_node"

Then, we can confirm the communication between the host and Mbed board via ROS 2 topic.

Cloning into 'mros2-host-examples'...
remote: Enumerating objects: 831, done.
remote: Counting objects: 100% (85/85), done.
remote: Compressing objects: 100% (68/68), done.
remote: Total 831 (delta 46), reused 26 (delta 15), pack-reused 746
Receiving objects: 100% (831/831), 96.01 KiB | 7.38 MiB/s, done.
Resolving deltas: 100% (448/448), done.
Starting >>> mros2_echoreply_string
Finished <<< mros2_echoreply_string [9.02s]                     

Summary: 1 package finished [9.17s]
[INFO] [1666012200.122092282] [mros2_echoreply_node]: 
Subscribed msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 7'
[INFO] [1666012200.122210443] [mros2_echoreply_node]: 
Publishing msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 7'
[INFO] [1666012201.127168943] [mros2_echoreply_node]: 
Subscribed msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 8'
[INFO] [1666012201.127216518] [mros2_echoreply_node]: 
Publishing msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 8'
[INFO] [1666012202.132162620] [mros2_echoreply_node]: 
Subscribed msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 9'
[INFO] [1666012202.132208473] [mros2_echoreply_node]: 
Publishing msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 9'
[INFO] [1666012203.137265544] [mros2_echoreply_node]: 
...(SNIPPED)...

serial console on the board

...(SNIPPED)...
publishing msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 5'                   
publishing msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 6'                   
[MROS2LIB] subscriber matched with remote publisher                             
[MROS2LIB] publisher matched with remote subscriber                             
publishing msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 7'                   
subscribed msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 7'                   
publishing msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 8'                   
subscribed msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 8'                   
publishing msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 9'                   
subscribed msg: 'Hello from mros2-mbed onto NUCLEO_F767ZI: 9'                   
...(SNIPPED)...

Examples

This repository contains some example applications in workspace/ to communicate with ROS 2 nodes on the host. You can switch the example by specifying the third argument of build.bash. Of course you can also create a new program file and specify it as your own application.

Please also check mROS-base/mros2-host-examples repository for more detail about the host examples.

echoback_string (default)

  • Description:
    • The mROS 2 node on the embedded board publishes string (std_msgs::msg::String) message to /to_linux topic.
    • (The node on the host will echoreply this message as it is.)
    • The mROS 2 node subscribes the replied message from /to_stm topic.
  • Host operation:
    • $ ros2 run mros2_echoreply_string echoreply_node

echoreply_string

  • Description:
    • The mROS 2 node on the embedded board subscribes string (std_msgs::msg::String) message from /to_stm topic.
    • And then publishes this string message as it is to /to_linux as the reply.
  • Host operation:
    • at first terminal: $ ros2 run mros2_echoback_string sub_node
    • and then, at second terminal: $ ros2 run mros2_echoback_string pub_node
    • or, at one terminal:
      • $ ros2 launch mros2_echoback_string pubsub.launch.py

pub_float32

  • Description:
    • The mROS 2 node on the embedded board publishes float32 (std_msgs::msg::Float32) message to /to_linux topic.
      • Note that this application just print whether the value of message is less than 0.0, between 0.0 and 1.0, or greater than 1.0.
      • If you want to print float value in serial console, you need to add "target.printf_lib": "std" into mbed_app.json (see detail). Note that linking std lib will increase the size of Flash memory.
  • Host operation:
    • $ ros2 run mros2_sub_float32 sub_node
    • or, $ ros2 launch mros2_sub_float32 sub.launch.py

sub_uint16

  • Description:
    • The mROS 2 node on the embedded board subscribes uint16 (std_msgs::msg::UInt16) message from /to_stm topic.
  • Host operation:
    • $ ros2 run mros2_pub_uint16 pub_node
    • or, $ ros2 launch mros2_pub_uint16 pub.launch.py

pub_twist

  • Description:
  • Host operation:
    • $ ros2 run mros2_sub_twist sub_node
    • or, $ ros2 launch mros2_sub_twist sub.launch.py

sub_pose

  • Description:
  • Host operation:
    • $ ros2 run mros2_pub_pose pub_node
    • or, $ ros2 launch mros2_pub_pose pub.launch.py

mturtle_teleop

  • Description:
    • This is a sample application along with mturtlesim (mros2 dedicated version of turtlesim).
    • The mROS 2 node on the embedded board publishes Twist (geometry_msgs::msg::Twist) message to /turtle1/cmd_vel topic, according to the input from keyboard via serial console.
  • Please see mturtle_teleop/README.md for more detail including host operation.

mturtle_teleop_joy

  • Description:
    • This is a sample application along with mturtlesim (mros2 dedicated version of turtlesim).
    • The mROS 2 node on the embedded board publishes Twist (geometry_msgs::msg::Twist) message to /turtle1/cmd_vel topic, according to the input from Joystick module.
  • Please see mturtle_teleop_joy/README.md for more detail including host operation.

pub_long_string_sub_crc

  • Description:
    • This sample application is an example to demonstrate the fragmented message feature added by the Pull-Request below. #32
    • The mROS 2 node on the embedded board publishes too long string (std_msgs::msg::String) message prepared in long_text.txt to the /to_linux topic.
    • (The node on the host will calculate the CRC value of subscribed long string, and publish the value as the reply.)
    • The mROS 2 node subscribes uint32 (std_msgs::msg::UInt32) message as the calculated CRC value from /to_stm topic.
  • Host operation:
    • $ ros2 run mros2_sub_long_string_pub_crc sub_long_string_pub_crc_node

pub_camera_image

  • Description:
    • This sample application is an example to demonstrate the fragmented message feature added by the Pull-Request below. #32
    • The mROS 2 node on the embedded board publishes an Image (sensor_msgs::msg::Image) message to the /to_linux topic.
    • This sample uses the DCMI I/F of STM32 MCU as a camera I/F. The camera module to be used is the prevalence one like below. https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4166233
      • If you don't have the camera module but want to try publishing image, you can use pub_image sample instead (that publises a dummy image defined in mros_image.h).
    • For some NUCLEO boards (e.g., NUCELO-F429ZI), you might have to solder two pin headers on both PA8 and PB7 to connect them to XCLK and VSYNC respectively. The whole of the pin connections between the MCU and the camera module should be below.
      MCU         Camera module
      3.3V    ---      3V3
      GND     ---      GND
      PB9     ---      SDA
      PB8     ---      SCL
      PB7     ---      VSYNC
      PA4     ---      HSYNC(or HREF)
      PA6     ---      PIXCLK(or PCLK)
      PA8     ---      XCLK
      PE6     ---      D7
      PE5     ---      D6
      PB6     ---      D5
      PE4     ---      D4
      PC9     ---      D3
      PC8     ---      D2
      PC7     ---      D1
      PC6     ---      D0
      PA0     --       Reset
      GND     ---      PWNDN
      
      refs: https://www.stmcu.jp/design/document/users_manual/52234/
  • Host operation:
    • $ rqt
    • And then, subscribe to the topic /to_linux and visualize it by Image View on the GUI like below.
      Movie Sample

Note: File(s) for the application

The main source of the application is app.cpp. You can change and/or add filename by editing ${APP_SRCS} in CMakeLists.txt.

If you have several directories that contain application code files, you also need to edit CMakeLists.txt (see details in comment).

Generating header files for custom MsgTypes

If you want to use your own customized message type followed by the ROS 2 manner, please refer to mros2#generating-header-files-for-custom-msgtypes section. (this section was moved because it is common feature for mROS 2).

Tips 1: Configure the network

platform/rtps/config.h is the configuration file for embeddedRTPS. We may be able to realize the RTPS communication to the appropriate configuration by editting this file.
For lwIP (UDP/IP) configuration, you may need to edit mbed_app.json according to your application requirement. Note that we have added some cofigurations for mros2 (UDP and RTPS) communication.

We should seek the appropreate configurations or how to fit them to the demand of applications. Please let us know about them if you have any opinions or awesome knowledges!

Tips 2: Development with the latest mros2 repo (a.k.a memo for me)

When using the docker environment for build, it will try to clone mros2/ dir/repo automatically during the cmake process. To prevent this, we can simply clone code from GitHub as the development mode and/or add # to the beginning of mros2.lib.

Tips 3: Getting started in 5 minutes with the online compiler

Caution: Although you can easily try out the basic features of mros2 online, this environment has not been fully maintained. Note that new features such as uniquely defined message types are not available.

We also provide an online development environment for mros2-mbed. By using the following Codes on Keil Studio Cloud (a.k.a Mbed Online Complier), you can try out the power of mros2 just in 5 minute. (we wish :D

Please feel free to let us know in Issues on this repository if you have any troubles or causes.

Submodules and Licenses

The source code of this repository itself is published under Apache License 2.0.
Please note that this repository requires the following stacks as the submodules, and also check their Licenses.

  • mros2: the pub/sub APIs compatible with ROS 2 Rclcpp
    • embeddedRTPS: RTPS communication layer (including lwIP and Micro-CDR)
  • Mbed OS 6: an open source embedded operating system designed specifically for the "things" in the Internet of Things

mros2-mbed's People

Contributors

hakuturu583 avatar s-hosoai avatar smoriemb avatar takasehideki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mros2-mbed's Issues

"Hello, World!" fails at 2nd time

I tried the "Hello, world!" procedure written in the Getting Started of README.md.

Environment

Mbed device

  • STM32 NUCLEO-F767ZI

Host environment

  • ROS 2 Foxy on Ubuntu 20.04 LTS

Detail

Succeeded pub/sub "Hello, world!" between the mbed device and the host for the first time, however, after stopping the host program with Ctrl-C and restarting the host program (STEP 6), the pub/sub communication fails.

The command line (STEP 6) is below:

docker run --rm -it --net=host ros:foxy /bin/bash
-c "source /opt/ros/foxy/setup.bash &&
cd &&
git clone https://github.com/mROS-base/mros2-host-examples &&
cd mros2-host-examples &&
colcon build --packages-select mros2_echoback_string &&
source install/setup.bash &&
(ros2 run mros2_echoback_string sub_node &) &&
echo 'wait for sub_node connection' &&
sleep 10 &&
ros2 run mros2_echoback_string pub_node"

The last part of the serial console is below:

subscribed msg: 'Hello, world! 65'
publishing msg: 'Hello, world! 65'
subscribed msg: 'Hello, world! 66'
publishing msg: 'Hello, world! 66'
Adding IPv4 Locator 192.168.11.10[MROS2LIB] publisher matched with remote subscriber
[MROS2LIB] publisher matched with remote subscriber

How to pub/sub directly between two STMs ?

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.

I tried with DISCO-L475VG-IOT01A (B-L475E-IOT01A) but it doesn't work.

Test report only. no need to improve mros2-mbed.

The reason why it doesn't work is probably not enough RAM.

mros2-mbed V0.4.1
Boards : STM32 Discovery kit IoT node : DISCO-L475VG-IOT01A (B-L475E-IOT01A)

sample source code.

#include "ISM43362Interface.h"

int main() {

ISM43362Interface wifi;
wifi.set_dhcp(false);
wifi.set_network(IP_ADDRESS, SUBNET_MASK, DEFAULT_GATEWAY );
int ret = wifi.connect("SSID", "p@ssw0rd", NSAPI_SECURITY_WPA_WPA2);
if (ret != 0 ) {
printf("Failed to connect\n");
} else {
printf("Connected to Wi-Fi network\n");
}

printf("mbed mros2 start!\r\n");
printf("app name: echoback_string\r\n");
mros2::init(0, NULL);

mros2::Node node = mros2::Node::create_node("mros2_node_stmwifi");
mros2::Publisher pub = node.create_publisher<std_msgs::msg::String>("to_linux", 10);
mros2::Subscriber sub = node.create_subscription<std_msgs::msg::String>("to_STMwifi", 10, userCallback);

}

Below is the serial log,

Connected to Wi-Fi network

mbed mros2 start!
app name: echoback_string
[MROS2LIB] mros2_init task start

++ MbedOS Error Info ++
Error Status: 0x80010133 Code: 307 Module: 1
Error Message: Mutex: 0x0, Parameter error
Location: 0x8005047
Error Value: 0x0
Current Thread: mROS2Thread Id: 0x10003E90 Entry: 0x80079E1 StackSize: 0x1388 StackMem: 0x10003ED8 SP: 0x100005C0
For more info, visit: https://mbed.com/s/error?error=0x80010133&tgt=DISCO_L475VG_IOT01A

mbed studioのエラーの解決

mbed studioでこのリポジトリをimportし、mbed studioで環境を作ろうとしたのですが、色々問題があったので報告します。

rtpsがない

https://github.com/mROS-base/embeddedRTPS
のincludeの中身をprogramのplatform/rtps ないに設置(config.hしかないところ)
srcとthirdpartをmros2/embeddedRTPS/ ないに設置

string.hが読み込めない

これはサードパーティーの問題で、mbedのstringとかぶっているので、
/mros2/embeddedRTPS/thirdparty/Micro-CDR/include/ucdr/types/ ないのstring.hをucdr_string.hに改名
/mros2/embeddedRTPS/thirdparty/Micro-CDR/src/c/types ないのstring.cを ucdr_string.cに改名
/mros2/embeddedRTPS/thirdparty/Micro-CDR/include/ucdr/microcdr.hの 24行目
#include <ucdr/types/string.h>を
#include <ucdr/types/ucdr_string.h>に変更

でエラーはでなくなります.

connection from multiple nodes (terminals) on the host failed

environment

  • host: Humble (directly installed) / Ubuntu22 / RPi4
    • open two terminals (terminalA/B)
  • device: NUCLEO_F767ZI

operation

  1. launch device with mros2-mbed for echoreply_string (RESET or connect USB)
  2. launch host nodes on terminalA by ros2 launch mros2_echoback_string pubsub.launch
  3. launch host on terminalB by ros2 launch mros2_echoback_string pubsub.launch

expected behavior
nodes on both terminalA and terminalB could communicate mros2-mbed at the same time.

current behavior (cause)
2. could connect, but when 3. operates, mros2-mbed causes Fault error(?).

log

device: (picocom)

<<operation 1.>>
app name: echoreply_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. data memory address=0x20015688         
[MROS2LIB] Initilizing Domain complete                                          
ready to pub/sub message                                                        

<<operation 2.>>                                                                                
subscribed msg: 'Hello, world! 0'                                               
publishing msg: 'Hello, world! 0'                                               
subscribed msg: 'Hello, world! 1'                                               
publishing msg: 'Hello, world! 1'                                               
subscribed msg: 'Hello, world! 2'                                               
publishing msg: 'Hello, world! 2'                                               
subscribed msg: 'Hello, world! 3'                                               
publishing msg: 'Hello, world! 3'                                               
subscribed msg: 'Hello, world! 4'                                               
publishing msg: 'Hello, world! 4'                                               
subscribed msg: 'Hello, world! 5'                                               
publishing msg: 'Hello, world! 5'                                               
subscribed msg: 'Hello, world! 6'                                               
publishing msg: 'Hello, world! 6'                                               
subscribed msg: 'Hello, world! 7'                                               
publishing msg: 'Hello, world! 7'                                               
[MROS2LIB] publisher matched with remote subscriber                             
subscribed msg: 'Hello, world! 8'                                               
publishing msg: 'Hello, world! 8'                                               
[MROS2LIB] subscriber matched with remote publisher                             
subscribed msg: 'Hello, world! 9'                                               
publishing msg: 'Hello, world! 9'                                               
subscribed msg: 'Hello, world! 10'                                              
publishing msg: 'Hello, world! 10'                                              
subscribed msg: 'Hello, world! 11'                                              
publishing msg: 'Hello, world! 11'                                              
subscribed msg: 'Hello, world! 12'                                              
publishing msg: 'Hello, world! 12'                                              
subscribed msg: 'Hello, world! 13'                                              
publishing msg: 'Hello, world! 13'                                              
                                                                                
<<operation 3.>>                                                                                
++ MbedOS Fault Handler ++                                                      
                                                                                
FaultType: HardFault                                                            
                                                                                
Context:                                                                        
R   0: 20017624                                                                 
R   1: 2294322D                                                                 
R   2: FFFFFFFF                                                                 
R   3: 00000001                                                                 
R   4: 20017614                                                                 
R   5: 00000004                                                                 
R   6: 00000000                                                                 
R   7: 2000CC34                                                                 
R   8: 2000CA8C                                                                 
R   9: 00000000                                                                 
R  10: 00000000                                                                 
R  11: 00000000                                                                 
R  12: 20017624                                                                 
SP   : 20017600                                                                 
LR   : 0801637F                                                                 
PC   : 0801DAAE                                                                 
xPSR : 810B0000                                                                 
PSP  : 20017598                                                                 
MSP  : 2007FFC0                                                                 
CPUID: 411FC270                                                                 
HFSR : 40000000                                                                 
MMFSR: 00000000                                                                 
BFSR : 00000082                                                                 
UFSR : 00000000                                                                 
DFSR : 0000000B                                                                 
AFSR : 00000000                                                                 
BFAR : 2294322D                                                                 
Mode : Thread                                                                   
Priv : Privileged                                                               
Stack: PSP                                                                      
                                                                                
-- MbedOS Fault Handler --                                                      
                                                                                
                                                                                
                                                                                
++ MbedOS Error Info ++                                                         
Error Status: 0x80FF013D Code: 317 Module: 255                                  
Error Message: Fault exception                                                  
Location: 0x801DAAE                                                             
Error Value: 0x200001F8                                                         
Current Thread: ReaderThread Id: 0x20008848 Entry: 0x80180B7 StackSize: 0x1000  
For more info, visit: https://mbed.com/s/error?error=0x80FF013D&tgt=NUCLEO_F767I
-- MbedOS Error Info --                                                         
                                                                                
= System will be rebooted due to a fatal error =                                
= Reboot count(=3) reached maximum, system will halt after rebooting =�

reconnection from the host failed

environment

  • host: Humble (directly installed) / Ubuntu22 / RPi4
  • device: NUCLEO_F767ZI

operation

  1. launch device with mros2-mbed for echoreply_string (RESET or connect USB)
  2. launch host nodes by ros2 launch mros2_echoback_string pubsub.launch
  3. SIGINT 2.
  4. relaunch host by ros2 launch mros2_echoback_string pubsub.launch

expected behavior
2. could connect both pub/sub, then 4. could reconnect for pub/sub communication.

current behavior (cause)
2. could connect, but 4. could only connect for pub, not connect for sub.

log

device: (picocom)

<<operation 1.>>
app name: echoreply_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. data memory address=0x20015688         
[MROS2LIB] Initilizing Domain complete                                          
ready to pub/sub message                                                        
<<operation 2.>>                                                                                
subscribed msg: 'Hello, world! 0'                                               
publishing msg: 'Hello, world! 0'                                               
subscribed msg: 'Hello, world! 1'                                               
publishing msg: 'Hello, world! 1'                                               
subscribed msg: 'Hello, world! 2'                                               
publishing msg: 'Hello, world! 2'                                               
subscribed msg: 'Hello, world! 3'                                               
publishing msg: 'Hello, world! 3'                                               
subscribed msg: 'Hello, world! 4'                                               
publishing msg: 'Hello, world! 4'                                               
subscribed msg: 'Hello, world! 5'                                               
publishing msg: 'Hello, world! 5'                                               
subscribed msg: 'Hello, world! 6'                                               
publishing msg: 'Hello, world! 6'                                               
[MROS2LIB] publisher matched with remote subscriber                             
subscribed msg: 'Hello, world! 7'                                               
publishing msg: 'Hello, world! 7'                                               
[MROS2LIB] subscriber matched with remote publisher                             
subscribed msg: 'Hello, world! 8'                                               
publishing msg: 'Hello, world! 8'                                               
subscribed msg: 'Hello, world! 9'                                               
publishing msg: 'Hello, world! 9'                                               
subscribed msg: 'Hello, world! 10'                                              
publishing msg: 'Hello, world! 10'                                              
<<operation 3.>>                                                                                
<<operation 4.>>                                                                                
[MemoryPool] RESSOURCE LIMIT EXCEEDED                                           
[MemoryPool] RESSOURCE LIMIT EXCEEDED                                           
[MemoryPool] RESSOURCE LIMIT EXCEEDED                                           
[MemoryPool] RESSOURCE LIMIT EXCEEDED                                           
subscribed msg: 'Hello, world! 0'                                               
publishing msg: 'Hello, world! 0'                                               
subscribed msg: 'Hello, world! 1'                                               
publishing msg: 'Hello, world! 1'                                               
subscribed msg: 'Hello, world! 2'                                               
publishing msg: 'Hello, world! 2'                                               
subscribed msg: 'Hello, world! 3'                                               
publishing msg: 'Hello, world! 3'                                               
subscribed msg: 'Hello, world! 4'                                               
publishing msg: 'Hello, world! 4'                                               
subscribed msg: 'Hello, world! 5'                                               
publishing msg: 'Hello, world! 5'                                               
subscribed msg: 'Hello, world! 6'                                               
publishing msg: 'Hello, world! 6'                                               
subscribed msg: 'Hello, world! 7'                                               
publishing msg: 'Hello, world! 7'                                               
[MROS2LIB] subscriber matched with remote publisher                             
subscribed msg: 'Hello, world! 8'                                               
publishing msg: 'Hello, world! 8'                                               
subscribed msg: 'Hello, world! 9'                                               
publishing msg: 'Hello, world! 9'                                               

host

<<operation 2.>>
$ ros2 launch mros2_echoback_string pubsub.launch.py 
[INFO] [launch]: All log files can be found below /home/ubuntu/.ros/log/2022-10-14-13-15-30-659521-ubuntu22-35457
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [stdbuf-1]: process started with pid [35458]
[INFO] [stdbuf-2]: process started with pid [35460]
[stdbuf-1] [INFO] [1665753332.251201577] [pub_mros2]: Publishing msg: 'Hello, world! 0'
[stdbuf-1] [INFO] [1665753333.251270294] [pub_mros2]: Publishing msg: 'Hello, world! 1'
[stdbuf-1] [INFO] [1665753334.251276970] [pub_mros2]: Publishing msg: 'Hello, world! 2'
[stdbuf-1] [INFO] [1665753335.251301128] [pub_mros2]: Publishing msg: 'Hello, world! 3'
[stdbuf-1] [INFO] [1665753336.251255208] [pub_mros2]: Publishing msg: 'Hello, world! 4'
[stdbuf-1] [INFO] [1665753337.251259028] [pub_mros2]: Publishing msg: 'Hello, world! 5'
[stdbuf-1] [INFO] [1665753338.251277661] [pub_mros2]: Publishing msg: 'Hello, world! 6'
[stdbuf-1] [INFO] [1665753339.251290423] [pub_mros2]: Publishing msg: 'Hello, world! 7'
[stdbuf-2] [INFO] [1665753339.259231180] [mros2_sub]: Subscribed msg: 'Hello, world! 7'
[stdbuf-1] [INFO] [1665753340.251298998] [pub_mros2]: Publishing msg: 'Hello, world! 8'
[stdbuf-2] [INFO] [1665753340.259199884] [mros2_sub]: Subscribed msg: 'Hello, world! 8'
[stdbuf-1] [INFO] [1665753341.251372387] [pub_mros2]: Publishing msg: 'Hello, world! 9'
[stdbuf-2] [INFO] [1665753341.259377163] [mros2_sub]: Subscribed msg: 'Hello, world! 9'
[stdbuf-1] [INFO] [1665753342.251336792] [pub_mros2]: Publishing msg: 'Hello, world! 10'
[stdbuf-2] [INFO] [1665753342.261875374] [mros2_sub]: Subscribed msg: 'Hello, world! 10'
<<operation 3.>>
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[stdbuf-1] [INFO] [1665753342.950610219] [rclcpp]: signal_handler(signum=2)
[stdbuf-2] [INFO] [1665753342.950629294] [rclcpp]: signal_handler(signum=2)
[INFO] [stdbuf-2]: process has finished cleanly [pid 35460]
[INFO] [stdbuf-1]: process has finished cleanly [pid 35458]
<<operation 4.>>
$ ros2 launch mros2_echoback_string pubsub.launch.py 
[INFO] [launch]: All log files can be found below /home/ubuntu/.ros/log/2022-10-14-13-15-45-533175-ubuntu22-35482
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [stdbuf-1]: process started with pid [35483]
[INFO] [stdbuf-2]: process started with pid [35485]
[stdbuf-1] [INFO] [1665753347.126703494] [pub_mros2]: Publishing msg: 'Hello, world! 0'
[stdbuf-1] [INFO] [1665753348.126706880] [pub_mros2]: Publishing msg: 'Hello, world! 1'
[stdbuf-1] [INFO] [1665753349.126702914] [pub_mros2]: Publishing msg: 'Hello, world! 2'
[stdbuf-1] [INFO] [1665753350.126727558] [pub_mros2]: Publishing msg: 'Hello, world! 3'
[stdbuf-1] [INFO] [1665753351.126724757] [pub_mros2]: Publishing msg: 'Hello, world! 4'
[stdbuf-1] [INFO] [1665753352.126746400] [pub_mros2]: Publishing msg: 'Hello, world! 5'
[stdbuf-1] [INFO] [1665753353.126817154] [pub_mros2]: Publishing msg: 'Hello, world! 6'

DHCP may not work fine

When I tackled to realize #42, I found RTPS communication with DHCP seems not to be working fine. The network configuration can be successfully completed and ping to the IP by DHCP is surely communicated, but the RTPS communication does not seem to be working. We need to observe this issue deeply.

The sendable size is smaller than Twitter.

The current implementation serializes the messages into the fixed-size buffer. The buffer size is only 100 bytes. So, the maximum sendable size is limited up to the size.
This is so small that mROS is unable to send large messages such as camera images.

Even if we modified the implementation to increase the buffer size, we would bump into another upper limit of MTU size.
So, we'd better add an additional implementation to send large messages using the fragmented serialized data feature of RTPS.

I implemented a prototype as below.
https://github.com/smoriemb/mros2-mbed/tree/feature/mros2-frag-msg-proto

You can check the actual behavior using a sample recv_long_string_send_crc.
This sample mROS2 node publishes a long string(one-4th of README.md) . And then it subscribes to a CRC32 value to check if the message is correctly received by the host's ROS2 node.

[build] 
$ git clone https://github.com/smoriemb/mros2-mbed -b feature/mros2-frag-msg-proto
$ cd mros2-mbed
$ ./build.bash all ARCH_MAX pub_long_string_sub_crc

[target board's console ouput]
mbed mros2 start!                                                               
app name: pub_long_string_sub_crc                                               
[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 message whose CRC(len=4343) is 0x9ee942fe                            
publishing message whose CRC(len=4343) is 0x9ee942fe      
...(SNIPPED)...
publishing message whose CRC(len=4343) is 0x9ee942fe                            
CRC is OK: 0x9ee942fe                                                           
publishing message whose CRC(len=4343) is 0x9ee942fe                            
CRC is OK: 0x9ee942fe                                

[host side]
$ docker run --rm -it --net=host ros:humble /bin/bash \
  -c "source /opt/ros/humble/setup.bash &&
  cd &&
  git clone https://github.com/smoriemb/mros2-host-examples -b feature/mros2-frag-msg-proto &&
  cd mros2-host-examples &&
  colcon build --packages-select mros2_sub_long_string_pub_crc &&
  source install/setup.bash &&
  ros2 run mros2_sub_long_string_pub_crc sub_long_string_pub_crc_node"
...(SNIPPED)...
After that, you will find an executable binary is created in the path below.
```
cmake_build/[TARGET]/develop/GCC_ARM/mros2-mbed.bin
```
3. Connect the PC and Mbed Board with USB and LAN cables.
4. Open Serial Console of the Mbed board. (11520'
[INFO] [1672620699.043805970] [recv_long_string_send_crc_node]: 

[INFO] [1672620699.043870846] [recv_long_string_send_crc_node]: ========================
[INFO] [1672620699.043961928] [recv_long_string_send_crc_node]: CRC: 0x9ee942fe
[INFO] [1672620699.044025071] [recv_long_string_send_crc_node]: ========================
...(SNIPPED)...

Could you kindly check the code roughly? And, if it is enough useful to discuss, I'd like to make pull requests for each related repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.