ROS Toolbox / Code Generation / MW_BASERATE_PERIOD
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello Mathworks team, always thank you for the hard work.
I'm now working with ROS Toolbox, making my algorithms and generating code to my linux machine.
I checked that generated ROS Node in Linux PC works well, but one thing the function's period is kind of wierd.
I want to run my Function subsystem working as callback function (every Topic A is subscribed, the function runs).
So I made 'Enable block' in my Function subsystem and connect it with Subscribe block's 'IsNew' signal refer to the tutorials in your pages.
Here's the problem, after generating codes and executing in Linux, Topic 'A' is published per 10ms but my Function runs per 20ms.
And I looked into some generated code, my Function's period is handled by the variable "MW_BASERATE_PERIOD" which value is 0.2.
I checked that my Function runs with period 10ms after I changed that variable to 0.1.
I wonder that why my Function runs with this period and also doesn't run as callback function way.
I look foward to your answer, thanks !
0 commentaires
Réponses (1)
Ganesh Regoti
le 24 Juil 2019
From your question, I understand that there are two sections to be answered
1. MW_BASERATE_PERIOD set to 0.2: It is nothing but the step size of the Simulink model, the default calculation
for step size is clearly mentioned in the below link
But you can manually set the step size in Simulink
For fixed-step solver: Model Configuration Parametes> Solver Details > Fixed-Step Size
For variable step solver: We cannot set the step size to fixed but constraints can be added like max step size, min
step size. Model Configuration Parametes> Solver Details
2.Enable Sub Systems: The enable sub system reacts at the transitions. Suppose the enable block is fed with the
1, then the subsystem continues to run until it is fed with 0. And continues to be in that state until it is fed with 1
again.
So, the enable sub-system doesn’t run as the callback because it can be controlled only at transitions i.e., one can
start or stop the subsystem. There is a clear explanation of Enable Subsystems in the following link
0 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!