You can enable overrun detection for a deployed ROS node. To deploy a ROS node from Simulink®, see Generate a Standalone ROS Node from Simulink®.
An overrun occurs when the deployed Simulink model is still processing the last step, but the next step is requested.
When you enable overrun detection, the deployed ROS node notifies the user through the
ROS_ERROR logging mechanism (see ROS Logging). The error
is output to the ROS console command line. To enable overrun detection on ROS time:
On the Apps tab, under Control Systems, click Robot Operating System (ROS).
In the Robot Operating System (ROS) dialog box that opens up,
Robot Operating System (ROS) from the
ROS Network drop-down. This opens up the
ROS tab in the toolstrip which shows the specified ROS
Network in the Connect section.
In the Prepare section under ROS tab, click Hardware Settings to open the model configuration parameters dialog box. Under Hardware board settings > Operating system/scheduler settings > Operating system options, select Detect task overruns.
After enabling Detect task overruns, you can re-build and deploy your
model. When starting the ROS node, the model waits for the ROS time to be published. When an
overrun is detected, an error is output to the ROS console command line, recorded in the log
file, and published via
/rosout. A typical error is:
[ERROR [1518780859.389633256, 214281.990000000]: !!! Overrun 1 !!!
The model continues executing when the previous step finishes, and waits for the next time step.
When an overrun condition occurs, you can correct it using one of the following approaches:
Simplify the model
Increase the sample times for the model and the blocks in it. For example,
change the Sample time parameter in all of your data source