  from openpilot.tools.sim.lib.simulated_sensors import SimulatedSensors
  
  
  def rk_loop(function, hz, exit_event: threading.Event):
    rk = Ratekeeper(hz)
    while not exit_event.is_set():
      function()
      rk.keep_time()
  
  
 
</s> remove     self.send_panda_state(simulator_state)
 </s> add     if self.idx % 50 == 0: # only send panda states at 2hz
      self.send_panda_state(simulator_state)
  rk = Ratekeeper(hz, None)
  from openpilot.tools.sim.lib.simulated_sensors import SimulatedSensors
  
  
  def rk_loop(function, hz, exit_event: threading.Event):
  rk = Ratekeeper(hz, None)
    while not exit_event.is_set():
      function()
      rk.keep_time()
  
  
keep keep keep keep replace keep keep keep keep keep
 Simulator: add metadrive as optional simulator (#29935)

* Add metadrive sim

* use monotonic

* don't use cuda if it's not available

* Cleanup metadrive patches

* PR suggestions

* fix typo 
tools/sim/bridge/common.py