for T=0:sampling_time:stop_time
-update animation
-run addons loop functions
-generate sensor measurements
-synchronize simulation
-execute control function
-check motor saturation
-check if robot inside the workspace
-check if the experiment is over
-update robot pose
end
Algorithm 1: Sketch of the routines inside the main loop.