Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: gpsd client support #4009

Open
sgofferj opened this issue Jun 1, 2024 · 14 comments
Open

[Feature Request]: gpsd client support #4009

sgofferj opened this issue Jun 1, 2024 · 14 comments
Assignees
Labels
enhancement New feature or request

Comments

@sgofferj
Copy link

sgofferj commented Jun 1, 2024

Platform

ESP32, Linux Native

Description

gpsd is the de-facto standard for sharing GPS data in Linux network. Implementing a gpsd client into Meshtastic would provide Wifi-/LAN-connected Meshtastic devices which don't have their own GPS with location and time information. I would also consider that useful for Linux native devices which run meshtasticd but want the GPS data also for other applications on the device.
The protocol is trivial. You open a tcp connection to port 2947 and send ?WATCH={"enable":true,"json":true}. Gpsd will start sending GPS and other data as JSON. ?WATCH={"enable":true,"nmea":true} will get you an NMEA stream.
A detailed protocol description and example code are available here: https://gpsd.gitlab.io/gpsd/client-howto.html

@sgofferj sgofferj added the enhancement New feature or request label Jun 1, 2024
@thebentern
Copy link
Contributor

This sounds very interesting!

@GPSFan
Copy link
Contributor

GPSFan commented Jun 1, 2024

The package version for gpsd on debian bookworm is 3.22-4.1 from Jan 2021.
3.23 has fixes for u-blox 6 &7 initialization issues and adds M10 support.
3.25.1~dev: is the current work in progress code and has "some" support for ATGM336 receivers.
As these are popular with Meshtastic folks we might have issues using the bookworm standard distribution's package. gpsd is quite flexible in its support for "unsupported" receivers and there could be some workarounds to enable 3.22 to be ok.

https://gpsd.gitlab.io/gpsd/NEWS

As for gpsd on an ESP32, that's an interesting thought.

@jp-bennett
Copy link
Collaborator

Yeah, should be relatively easy to make this work. For native, it'd just be a config entry in config.yaml, and a different code path in the GPS.cpp code.

@sgofferj
Copy link
Author

sgofferj commented Jun 1, 2024

As for gpsd on an ESP32, that's an interesting thought.

I meant, as client, of course. E.g. if you have some ESP32-based router node which is anyways connected to your wifi for MQTT.
At least a couple of years ago, having a GPS RX on a "homeserver", feeding gpsd feeding an NTP daemon was a thing as a fairly high precision and internet-independent time source. I would assume, there is some overlap between the "inet independent time source" and "off grid messaging" crowds... But IIRC somebody has ported gpsd to ESP32. Can't find it adhoc but I'm sure I ran across that somewhen.

@GPSFan
Copy link
Contributor

GPSFan commented Jun 1, 2024

I'd think that for native, we could get rid of TinyGPS++ and just grab the position/heading/speed/time or other data we want right from gpsd, letting gpsd manage the receiver(s), No NMEA decoding needed.
Would this be a goal for Meshtastic V3?

@jp-bennett
Copy link
Collaborator

I'd think that for native, we could get rid of TinyGPS++ and just grab the position/heading/speed/time or other data we want right from gpsd, letting gpsd manage the receiver(s), No NMEA decoding needed. Would this be a goal for Meshtastic V3?

Not entirely, no. It's too useful to be able to debug TinyGPS++ on native. But I could see a future where we default to gpsd on native.

@GPSFan
Copy link
Contributor

GPSFan commented Jun 1, 2024

I see your point.
I have gpsd installed on an arm64 bookworm Rock64, I also have meshtasticd installed there too, I will have a go at running them together and see what I can cobble together. What I really need is to be able to compile native on one or the other, I had less than success installing the Platformio plugin for vs code on my RPi3B+.
Maybe that was a power supply issue too ;>((

@jp-bennett
Copy link
Collaborator

I see your point.
I have gpsd installed on an arm64 bookworm Rock64, I also have meshtasticd installed there too, I will have a go at running them together and see what I can cobble together. What I really need is to be able to compile native on one or the other, I had less than success installing the Platformio plugin for vs code on my RPi3B+.
Maybe that was a power supply issue too ;>((

That issue is probably running out of ram. It takes 4gb to run the full vscode backend reliably.

@GPSFan
Copy link
Contributor

GPSFan commented Jun 1, 2024

Ahh, any chance of cross compiling?

@jp-bennett
Copy link
Collaborator

Ahh, any chance of cross compiling?

You can probably get away with running the compile from the command line, using the script in /bin. The pio command can take the -j flag to limit compile threads, if you need it.

@GPSFan
Copy link
Contributor

GPSFan commented Jun 2, 2024

Well it got everything compiled and failed in the ld phase with a bunch of undefined references in PiWebServer.cpp, This is on my Rodk64, so there is probably a missing library unique to the Pi. I'll repeat this on the Pi now that I know how to set up the venv etc.

@GPSFan
Copy link
Contributor

GPSFan commented Jun 2, 2024

Got it all compiled linked and it runs on my Pi3b+.
Had to increase the swap space from default of 100MBytes to 500MBytes.
Have the same error -7 from RadioLib when packets come in.

@sgofferj
Copy link
Author

sgofferj commented Jun 2, 2024

Regarding compiling for Arm... Oracle Cloud Services has an extremely generous free tier for Ampere Arm64 instances... I got a lot of stuff on there including a drone.io worker to build containers for Arm64.

@madeofstown
Copy link

madeofstown commented Jun 7, 2024

Have the same error -7 from RadioLib when packets come in.

I get the error -7 quite frequently on Meshtasticd. I also get it a decent amount on a Pico W and got a new RAK node recently that is also logging these errors. What is that all about? My googling has failed me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants