tim-balloon / TIMflight

Flight MCP repo
0 stars 0 forks source link

Update `gps.c` to be a `gpsd` client #91

Open evanmayer opened 4 months ago

evanmayer commented 4 months ago

Task

We need to update gps.c in order to give mcp accurate LAT/LON data in the absence of a CSBF GPS.

Acceptance

Follow the gpsd client architecture to connect to a running instance of gpsd, and query it for the latest info from the daemon.

When complete, the module shall continuously try to query the daemon for LAT/LON data. When the daemon responds, it shall update GPSData->latitude, GPSData->longitude, and GPSData->is_new (NOT gps_info, which is unused in mcp) with the LAT/LON in degrees.

Details

gpsd has kindly provided an example client in C: https://gpsd.gitlab.io/gpsd/gpsd-client-example-code.html Copy as much as possible, with attribution.

In order to use the gpsd client API, which was installed when we installed gpsd from apt, you will need to link against lgps by editing the CMake.

GPSData is useful for pointing.c, in that it allows us to know our location if the SIP GPS data is not present.