rosrate
Execute loop at fixed frequency
Description
Therosrate
object uses therateControl
(Robotics System Toolbox)superclass to inherit most of its properties and methods. The main difference is thatrateControl
uses the ROS node as a source for time information. Therefore, it can use the ROS simulation or wall clock time (see theIsSimulationTime
property).
Ifrosinit
creates a ROS master in MATLAB®,global node uses wall clock time.
The performance of therosrate
object and the ability to maintain theDesiredRate
value depends on the publishing of the clock information in ROS.
Tip
The scheduling resolution of your operating system and the level of other system activity can affect rate execution accuracy. As a result, accurate rate timing is limited to 100 Hz for execution of MATLAB code. To improve performance and execution speeds, use code generation.
Creation
Description
creates arate
= rosrate(desiredRate
)Rate
object, which enables you to execute a loop at a fixed frequency,DesiredRate
. The time source is linked to the time source of the global ROS node, which requires you to connect MATLAB to a ROS network usingrosinit
.
creates arate
= ros.Rate(node
,desiredRate
)Rate
object that operates loops at a fixed rate based on the time source linked to the specified ROS node,node
.
Properties
Object Functions
waitfor |
Pause code execution to achieve desired execution rate |
statistics |
Statistics of past execution periods |
reset |
ResetRate object |