Azzera filtri
Azzera filtri

ROS rate in Simulink with standalone code generation

19 visualizzazioni (ultimi 30 giorni)
Balint Varga
Balint Varga il 8 Dic 2020
Risposto: Josh Chen il 18 Lug 2024 alle 2:03
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!

Risposte (1)

Josh Chen
Josh Chen il 18 Lug 2024 alle 2:03
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

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by