How to make ROS subscribe block ensure that each message of a customized ROS topic is caught from Gazebo

3 visualizzazioni (ultimi 30 giorni)
Hi I am running a world file on Gazebo in a Ubuntu Virtual Machine and running a Simulink Controller model on my Windows host. The topics are published on the Ubuntu machine at a rate of 5 Hz with a model step of <max_step_size>0.0001000</max_step_size;<real_time_factor>0.1</real_time_factor>;<real_time_update_rate>1000.000000</real_time_update_rate>. And in the Simulink I have given the ROS Subsribe block "Length of Subsribe Callback Queue" as 5. Still, some messages gets dropped and the subscriber block of simulink is not able to catch all the msgs published by the ROS topic from Ubuntu Virtual Machine. Can anyone suggest me where I am doing wrong?

Risposte (1)

Josh Chen
Josh Chen il 25 Ott 2022
Hi Hirak,
If I understand correctly, you are running the Simulink controller through Simulink simulation instead of code generation. Note that "Length of Subscribe Callback Queue" has no impact on simulation. This parameter is only valid in code genration workflow. For Simulink simulation, the message queue is always one.
May I ask which solver type and step size did you set for the Simulink model? This could be because of the step size of Simulink is too big compared with the "real_time_update_rate" and "real_time_fator" you set on Gazebo. If this is the case, consider changing the solver type to "Fixed-step", expand the Solver details, and set the Fixed-step size to a smaller value.
If this is not the case, could you please reach out to our technical support team and share a reproducible model so that we can take a closer look?
Hope this helps,
Josh

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by