Slow getting ROS2 messages in simulink in real time

Dear,
I want to get the value of an external sensor in real time via ROS2. However, in practice, even when the rate is set to 100 Hz, the values are updated only about once every 3 seconds.
Is this difficult when using custom messages?
I also tried using "Simulink Desktop Real-Time" but it did not make much difference.

6 commentaires

Hi,
Which version of MATLAB that you are using ?
Please share the simulink model and custom messages that you are using. Also let me know how you are publishing and mesuring the frequency of messages ?
Thanks,
Jagadeesh K
健
le 7 Mar 2023
Thanks for the quick reply .
I am using version 2022a. 
The custom message used stores information as shown in the image, and "analog_input" is extracted and used in Simulink. This is a fixed-length array of type int16 with 8 elements.
When viewed on the terminal of the ubuntu PC, it is updated at 100 Hz.
Finally, I'll post an image of the entire simulink model
健
le 7 Mar 2023
When I output a sine wave to the PWM synchronized to ROS2, it was also updated about once every 3 seconds.
This made me think that the exchange between ROS2 and simulink may not be happening at high frequency, but is there some setting I need to do?
I would like to take a look at the Simulink Model settings like Sample Time of the model, QoS Settings of pub/sub blocks. So, please send us the simulink model and custom messages to further debug this issue.
I recommend you to contact us through the MATLAB support for further guidance.
健
le 7 Mar 2023
sub(input sensor) settings.
QoS was the same for the others.
Nupur
Nupur le 25 Juin 2024
Déplacé(e) : Angelo Yeo le 1 Nov 2024
@健 Could you explain how you used 'Simulink Deaktop Real-Time' with ROS2?

Connectez-vous pour commenter.

Réponses (0)

Catégories

Produits

Version

R2022a

Question posée :

健
le 6 Mar 2023

Déplacé(e) :

le 1 Nov 2024

Community Treasure Hunt

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

Start Hunting!

Translated by