Real-time ROS2 customised messages perform slow pub/sub speed

7 views (last 30 days)
Dear ,
I develop a simulink program aiming to connect to an external computer in the same ROS2 domain and exchange data over pub/sub protocol. I also use "Real-Time synchronization" block in "Simulink Desktop Real-Time" to set to program running in real-time.
Both pub/sub work fine at the rate 100Hz using default messages type such as std_msgs/Float64, std_msgs_msgs/Int32, etc. without any missed tick. However, it gets really slow when I switch to custom defined messages, even for a very simple one containing only 1 std_msgs/Int32 value. The "missed tick" value increases to 300-500 and the clock of the program violates the real-time. I tried to use Gbit Ethernet connection between two computers but the performance just slightly improve. The 'missed tick' only drops to zero as I reduce the rate to 2-3 Hz which is too slow for my objective.
What could I do to improve the pub/sub speed using custom defined messages in Simulink?
Thank you

Answers (1)

Jagadeesh Konakalla
Jagadeesh Konakalla on 7 Dec 2020
Hi Le,
Which version of MATLAB that you are using ?
Thanks
  2 Comments
Jagadeesh Konakalla
Jagadeesh Konakalla on 8 Dec 2020
Hi Li,
There are some updates in the MATLAB Release 2020b Update 2 which related to performance improvements. I recommend you to install the update 2 version of R2020b.
Let me know if that does not work for you.
Jagadeesh K.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!