PER Firmware
Loading...
Searching...
No Matches
geodetic.h File Reference

Geodetic coordinate utility header. More...

#include <math.h>
#include "utils/vector2.h"
#include "dearunits/generated/dearunits.h"
Include dependency graph for geodetic.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  geodetic_coord_t
 

Functions

static geodetic_coord_t geodetic_from_scaled (const float latitude, const float longitude)
 Build a coordinate from latitude and longitude already in degrees.
 
static vector2_t geodetic_to_local (const geodetic_coord_t origin, const geodetic_coord_t coord)
 Project a coordinate onto a local east-north plane about an origin.
 

Variables

static constexpr float METERS_PER_DEGREE = 111132.0f
 

Detailed Description

Geodetic coordinate utility header.

Projects GPS latitude/longitude onto a local cartesian plane so that planar geometry can be used on it.

Author
Amruth Nadimpally (nadim.nosp@m.paa@.nosp@m.purdu.nosp@m.e.ed.nosp@m.u)
Aditya Saini (saini.nosp@m.91@p.nosp@m.urdue.nosp@m..edu)

Function Documentation

◆ geodetic_from_scaled()

static geodetic_coord_t geodetic_from_scaled ( const float latitude,
const float longitude )
inlinestatic

Build a coordinate from latitude and longitude already in degrees.

Callers must convert packed CAN / GPS fixed-point values into degrees before calling (for example with UNPACK_COEFF_GPS_COORDINATES_LATITUDE).

Parameters
latitudeLatitude in degrees
longitudeLongitude in degrees
Returns
The coordinate in degrees.
Here is the caller graph for this function:

◆ geodetic_to_local()

static vector2_t geodetic_to_local ( const geodetic_coord_t origin,
const geodetic_coord_t coord )
inlinestatic

Project a coordinate onto a local east-north plane about an origin.

Equirectangular approximation: northing is proportional to latitude, and easting is compressed by the cosine of the origin latitude. Sub-meter accurate over the few kilometers a track spans, and linear, so straight lines stay straight and segment geometry remains valid.

Parameters
originThe coordinate that maps to (0, 0)
coordThe coordinate to project
Returns
East (x) and north (y) offset from the origin, in meters.
Here is the caller graph for this function:

Variable Documentation

◆ METERS_PER_DEGREE

float METERS_PER_DEGREE = 111132.0f
staticconstexpr