How to calculate the lat/long of the ego vehicle


I’m new to using latitudes and longitudes so I have a question about how to get the lat/long of the ego vehicle at the start of each scene.

I’ve used the lat/long given:

  • boston-seaport: [42.336849169438615, -71.05785369873047]
  • singapore-onenorth: [1.2882100868743724, 103.78475189208984]
  • singapore-hollandvillage: [1.2993652317780957, 103.78217697143555]
  • singapore-queenstown: [1.2782562240223188, 103.76741409301758]

I then get the width/height translation of the ego vehicle from nusc.ego_pose for each of the videos I am interested in, as per the tutorial.

Using the lat/long and the width/meters I do a flat earth calculation, using R = 6378137m as the radius of the earth:

dLat = dn/R
dLon = de/(RCos(Pilat/180))

//OffsetPosition, decimal degrees
latO = lat + dLat * 180/Pi
lonO = lon + dLon * 180/Pi

I realise that there will be some error in this calculation but when I plot the new lat/long on Google Earth, it seems to be really far off the true location.

What am I doing wrong? Is there a better way of doing this? I just want to know the lat/long of the ego vehicle at the start of the scenes.

Thanks for any help.