    }
    pm.send('roadCameraState', dat)
    frame_id += 1
  
  def imu_callback(imu):
    dat = messaging.new_message('sensorEvents', 2)
    dat.sensorEvents[0].sensor = 4
    dat.sensorEvents[0].type = 0x10
    dat.sensorEvents[0].init('acceleration')
    dat.sensorEvents[0].acceleration.v = [imu.accelerometer.x, imu.accelerometer.y, imu.accelerometer.z]
 
</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) </s> remove pm = messaging.PubMaster(['roadCameraState', 'sensorEvents', 'can'])
 </s> add pm = messaging.PubMaster(['roadCameraState', 'sensorEvents', 'can', "gpsLocationExternal"])
def imu_callback(imu, vehicle_state):
  vehicle_state.bearing_deg = math.degrees(imu.compass)
    }
    pm.send('roadCameraState', dat)
    frame_id += 1
  
def imu_callback(imu, vehicle_state):
  vehicle_state.bearing_deg = math.degrees(imu.compass)
    dat = messaging.new_message('sensorEvents', 2)
    dat.sensorEvents[0].sensor = 4
    dat.sensorEvents[0].type = 0x10
    dat.sensorEvents[0].init('acceleration')
    dat.sensorEvents[0].acceleration.v = [imu.accelerometer.x, imu.accelerometer.y, imu.accelerometer.z]
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