What is Sample Time and How Does it Work?
What is Sample Time?
The sample time determines how often a block updates and produces outputs during simulation.
Why Do ArduPilot Blocks Have a Fixed Sample Time of -1 in Simulink?
In Simulink, a sample time of -1 indicates that a block inherits
its sample time, causing it to run at the model’s base rate.
The UAV Toolbox Support Package for ArduPilot® Autopilots uses a single, fixed execution rate that is synchronized with ArduPilot’s main-loop frequency rather than arbitrary Simulink multi-rate scheduling. All blocks provided by this support package execute at a single rate, the model’s base rate, which is determined by the main loop frequency of the ArduPilot firmware.
Note
The UAV Toolbox Support Package for ArduPilot Autopilots supports only single-rate modeling and does not support multi-rate configurations in Simulink.
For Copter, the main loop runs at 400Hz, resulting in a base rate
of 2.5ms. For Plane, the main loop operates at
50Hz, so the base rate is 20ms. You can verify
these sample times by visualizing the sample time information (Simulink)
within your Simulink model.
Copter

Plane

See Also
Topics
- What Is Sample Time? (Simulink)