ROS rate in Simulink with standalone code generation

2 次查看(过去 30 天)
Hi everyone,
the following problem I have: I built a simulink model to generate a standalone ros node. It is a simple controller. I would like to publish the data with 10 hz, so I defined the sample time (by the blank message) 0.1.
After building the model and running the ROS-node, I test the publisher frequency with
rostopic hz ....
and I get 9.94, 9.95....
If I implement the same functionality in Python ROS-node, I get the desired 10 hz, so it must be some code generation issue and not the limitation of the target hardware.
Could you help me, how to have a more stable publishing rate in a generated Simulink ROS-node?
Thanks!

回答(1 个)

Josh Chen
Josh Chen 2024-7-18
Hi Balint,
The actual message publishing rate can be affected by many other factors, and it may not be exactly the same as specified sample time. For instance, if the controller itself takes long time to complete one step, the Publish block will wait for the new signal before it can send it to the ROS network.
I notice that this question was posted 4 years ago. We have achieved many performance improvement for both simulation and code generation in ROS Toolbox. Please try the same workflow in the lastest MATLAB/Simulink and see if this issue still exists.
If yes, please feel free to reach out to our customer support team and share more detail (model, reproduction steps) with us. We will be more than happy to look into this issue with you.
Thanks,
Josh

类别

Help CenterFile Exchange 中查找有关 ROS Network Connection and Exploration 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by