Function latlon_to_xy(const double&, const double&, const double&, const double&)

Function Documentation

std::pair<double, double> latlon_to_xy(const double &lat, const double &lon, const double &lat0, const double &lon0)

Function to convert latitude and longitude to (x, y) coordinates.

This function takes the initial and current longitude and latitude and returns a pair of values indicating the (x, y) coordinates in meters with respect to the origin of the car’s reference frame

Parameters:
  • lat – The current latitude in degrees

  • lon – The current longitude in degrees

  • lat0 – The initial latitude in degrees

  • lon0 – The initial longitude in degrees

Returns:

A pair of doubles representing the (x, y) coordinates in meters