ROS rate in Simulink with standalone code generation
3 views (last 30 days)
Show older comments
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!
0 Comments
Answers (1)
Josh Chen
on 18 Jul 2024
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
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!