Skip to content

The sendable size is smaller than Twitter. #32

Closed
@smoriemb

Description

@smoriemb

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions