  REPEAT_COUNTER = 5
  PRINT_DECIMATION = 100
  STEER_RATIO = 15.
  
  pm = messaging.PubMaster(['roadCameraState', 'sensorEvents', 'can'])
  sm = messaging.SubMaster(['carControl','controlsState'])
  
  class VehicleState:
    def __init__(self):
      self.speed = 0
 
</s> remove def imu_callback(imu):
 </s> add def imu_callback(imu, vehicle_state):
  vehicle_state.bearing_deg = math.degrees(imu.compass) </s> remove def fake_gps():
  # TODO: read GPS from CARLA
  pm = messaging.PubMaster(['gpsLocationExternal'])
  while 1:
    dat = messaging.new_message('gpsLocationExternal')
    pm.send('gpsLocationExternal', dat)
    time.sleep(0.01)
 </s> add def gps_callback(gps, vehicle_state):
  dat = messaging.new_message('gpsLocationExternal')

  # transform vel from carla to NED
  # north is -Y in CARLA
  velNED = [
    -vehicle_state.vel.y, # north/south component of NED is negative when moving south
    vehicle_state.vel.x, # positive when moving east, which is x in carla
    vehicle_state.vel.z,
  ]

  dat.gpsLocationExternal = {
    "flags": 1, # valid fix
    "verticalAccuracy": 1.0,
    "speedAccuracy": 0.1,
    "vNED": velNED,
    "bearingDeg": vehicle_state.bearing_deg,
    "latitude": gps.latitude,
    "longitude": gps.longitude,
    "altitude": gps.altitude,
    "source": log.GpsLocationData.SensorSource.ublox,
  }

  pm.send('gpsLocationExternal', dat)
pm = messaging.PubMaster(['roadCameraState', 'sensorEvents', 'can', "gpsLocationExternal"])
  REPEAT_COUNTER = 5
  PRINT_DECIMATION = 100
  STEER_RATIO = 15.
  
pm = messaging.PubMaster(['roadCameraState', 'sensorEvents', 'can', "gpsLocationExternal"])
  sm = messaging.SubMaster(['carControl','controlsState'])
  
  class VehicleState:
    def __init__(self):
      self.speed = 0
keep keep keep keep replace keep keep keep keep keep
 sim: get GPS data from CARLA (#20717)

* Send simulated carla GPS to OP

* Use ublox enum from cereal

* Add more fields to carla gnss packet

* use math.degrees

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> 
tools/sim/bridge.py