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

The sendable size is smaller than Twitter. #32

Closed
smoriemb opened this issue Jan 2, 2023 · 3 comments
Closed

The sendable size is smaller than Twitter. #32

smoriemb opened this issue Jan 2, 2023 · 3 comments

Comments

@smoriemb
Copy link
Contributor

smoriemb commented Jan 2, 2023

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.

@takasehideki
Copy link
Member

takasehideki commented Jan 3, 2023

Yes, I agree with your idea.
It is definitely useful that mROS2 will be able to handle messages larger than the size of Twitter :D
Please make a PR about this. We will check and review whether a new feature works properly and does not affect existing apps/features.

@smoriemb
Copy link
Contributor Author

smoriemb commented Jan 5, 2023

Thanks for your consideration.

I've created some related below.
[embeddedRTPS]
mROS-base/embeddedRTPS#11
[mROS2]
mROS-base/mros2#36
[mROS2 on Mbed]
#33
[Host example]
mROS-base/mros2-host-examples#14

@takasehideki
Copy link
Member

closing by #33 with @smoriemb's fantastic work 🎉

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