# Tutorial 6: Bursting mode ## Introduction In the previous tutorial, we started the robot backend via: ```bash o80_mujoco ``` This triggers the simulation of a pam robot with control running at a predefined frequency. This can be seen via: ```bash o80_console ``` It is possible to start the robot back using the "bursting mode" via: ```bash o80_mujoco --bursting_mode # or alternatively: # o80_mujoco # and using the dialog to turn on the bursting mode ``` (note: It may be that a window appears, but the robot can not be seen and a message "Simulate is not responding" is shown. This is ok for now) If after starting the backend using the starting mode you start the console: ```bash o80_console ``` you may see that a very low frequency is shown, and the iteration number does not increase. This is because in bursting mode, the robot control iterates only when being asked to do so by a frontend. For example, in a Python terminal: ```python import o80 import o80_pam # creating a frontend segment_id = "o80_pam_robot" frontend = o80_pam.FrontEnd(segment_id) # adding a command: # setting all pressures to 12000 start_iteration = frontend.latest().get_iteration() frontend.add_command([12000]*4,[12000]*4, o80.Iteration(start_iteration+1000), o80.Mode.OVERWRITE) frontend.pulse() # requesting the backend to execute 1000 iterations frontend.burst(1000) ``` When running the code, it may be seen that the iteration numbers increases to 1000, and then stop increasing again. This is because the frontend requested the backend to execute 1000 iterations only (burst function). ## Example Here is a full running example: ```python import time import math import o80 import o80_pam # default id when starting pam_robot executable segment_id = "o80_pam_robot" frontend = o80_pam.FrontEnd(segment_id) # starting at low pressure start_iteration = frontend.latest().get_iteration() frontend.add_command([12000]*4,[12000]*4, o80.Iteration(start_iteration+1000), o80.Mode.OVERWRITE) frontend.burst(2000) start_iteration = frontend.latest().get_iteration() low_pressure = 12000 high_pressure = 20000 nb_iterations = 1000 # requesting to go to high, low and again high pressures frontend.add_command([high_pressure]*4,[high_pressure]*4, o80.Iteration(start_iteration+nb_iterations), o80.Mode.OVERWRITE) frontend.add_command([low_pressure]*4,[low_pressure]*4, o80.Iteration(start_iteration+2*nb_iterations), o80.Mode.QUEUE) frontend.add_command([high_pressure]*4,[high_pressure]*4, o80.Iteration(start_iteration+3*nb_iterations), o80.Mode.QUEUE) frontend.pulse() # playing the sequence by "jumps" of 2000 iterations total_to_play = 3*nb_iterations total_played = 0 jump = 500 while total_played